e73ff103f8639fd05b38d6d727ef69425b5de69b
[~bandali/configs] / rc.org
1 #+title: rc.org
2 #+property: header-args :comments link :mkdirp yes :results silent
3
4 * About
5
6 This org file contains the configuration files of pretty much every
7 program I use. The files are tangled (i.e. exported, or derived) from
8 this file using =org-babel=.
9
10 Note: This file is best viewed inside Emacs with org mode.
11
12 * Configs
13
14 This section contains the configuration files (dotfiles) of various
15 programs I use.
16
17 ** dovecot
18 :PROPERTIES:
19 :header-args+: :tangle "/sudo::/etc/dovecot/dovecot.conf"
20 :END:
21
22 #+begin_src conf
23 protocols = imap
24
25 listen = 127.0.0.1
26 log_path = /var/log/dovecot.log
27 info_log_path = /var/log/dovecot-info.log
28
29 ssl = no
30 disable_plaintext_auth = no
31
32 auth_verbose = yes
33 auth_mechanisms = plain
34
35 passdb {
36 driver = passwd-file
37 args = /etc/dovecot/passwd
38 }
39
40 userdb {
41 driver = static
42 args = uid=amin gid=amin home=/home/amin/mail/%d/%n
43 default_fields = mail=maildir:/home/amin/mail/%d/%n/mail
44 }
45
46 # mail_home = /home/amin/mail/%d/%n
47 # mail_location = maildir:/home/amin/mail/%d/%n/mail:LAYOUT=fs:INBOX=/home/amin/mail/%d/%n/mail/Inbox
48
49 # namespace {
50 # inbox = yes
51 # separator = /
52 # }
53
54 mail_plugins = $mail_plugins fts fts_lucene
55
56 plugin {
57 fts = lucene
58 fts_lucene = whitespace_chars=@.
59 fts_autoindex = yes
60 }
61 #+end_src
62
63 ** libinput
64
65 Improve XPS 15 9560's touchpad experience.
66
67 # begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "plasma")) "/sudo::/etc/X11/xorg.conf.d/30-touchpad.conf")
68 #+begin_src conf :tangle no
69 Section "InputClass"
70 Identifier "libinput touchpad catchall"
71 Driver "libinput"
72 MatchIsTouchpad "on"
73 Option "ClickMethod" "clickfinger"
74 Option "NaturalScrolling" "true"
75 Option "Tapping" "on"
76 Option "TappingButtonMap" "lrm"
77 EndSection
78 #+end_src
79
80 ** mkinitcpio
81
82 #+begin_src conf :tangle /sudo::/etc/mkinitcpio.conf :comments none
83 # vim:set ft=sh
84 # MODULES
85 # The following modules are loaded before any boot hooks are
86 # run. Advanced users may wish to specify all system modules
87 # in this array. For instance:
88 # MODULES=(piix ide_disk reiserfs)
89 MODULES=(i915)
90
91 # BINARIES
92 # This setting includes any additional binaries a given user may
93 # wish into the CPIO image. This is run last, so it may be used to
94 # override the actual binaries included by a given hook
95 # BINARIES are dependency parsed, so you may safely ignore libraries
96 BINARIES=()
97
98 # FILES
99 # This setting is similar to BINARIES above, however, files are added
100 # as-is and are not parsed in any way. This is useful for config files.
101 FILES=()
102
103 # HOOKS
104 # This is the most important setting in this file. The HOOKS control the
105 # modules and scripts added to the image, and what happens at boot time.
106 # Order is important, and it is recommended that you do not change the
107 # order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
108 # help on a given hook.
109 # 'base' is _required_ unless you know precisely what you are doing.
110 # 'udev' is _required_ in order to automatically load modules
111 # 'filesystems' is _required_ unless you specify your fs modules in MODULES
112 # Examples:
113 ## This setup specifies all modules in the MODULES setting above.
114 ## No raid, lvm2, or encrypted root is needed.
115 # HOOKS=(base)
116 #
117 ## This setup will autodetect all modules for your system and should
118 ## work as a sane default
119 # HOOKS=(base udev autodetect block filesystems)
120 #
121 ## This setup will generate a 'full' image which supports most systems.
122 ## No autodetection is done.
123 # HOOKS=(base udev block filesystems)
124 #
125 ## This setup assembles a pata mdadm array with an encrypted root FS.
126 ## Note: See 'mkinitcpio -H mdadm' for more information on raid devices.
127 # HOOKS=(base udev block mdadm encrypt filesystems)
128 #
129 ## This setup loads an lvm2 volume group on a usb device.
130 # HOOKS=(base udev block lvm2 filesystems)
131 #
132 ## NOTE: If you have /usr on a separate partition, you MUST include the
133 # usr, fsck and shutdown hooks.
134 HOOKS=(base udev autodetect modconf block keyboard encrypt lvm2 resume filesystems fsck)
135
136 # COMPRESSION
137 # Use this to compress the initramfs image. By default, gzip compression
138 # is used. Use 'cat' to create an uncompressed image.
139 #COMPRESSION="gzip"
140 #COMPRESSION="bzip2"
141 #COMPRESSION="lzma"
142 #COMPRESSION="xz"
143 #COMPRESSION="lzop"
144 #COMPRESSION="lz4"
145
146 # COMPRESSION_OPTIONS
147 # Additional options for the compressor
148 #COMPRESSION_OPTIONS=()
149 #+end_src
150
151 ** mpd
152 :PROPERTIES:
153 :header-args+: :tangle ~/.config/mpd/mpd.conf
154 :END:
155
156 #+begin_src conf
157 # An example configuration file for MPD.
158 # Read the user manual for documentation: http://www.musicpd.org/doc/user/
159
160
161 # Files and directories #######################################################
162 #
163 # This setting controls the top directory which MPD will search to discover the
164 # available audio files and add them to the daemon's online database. This
165 # setting defaults to the XDG directory, otherwise the music directory will be
166 # be disabled and audio files will only be accepted over ipc socket (using
167 # file:// protocol) or streaming files over an accepted protocol.
168 #
169 music_directory "~/usr/music"
170 #
171 # This setting sets the MPD internal playlist directory. The purpose of this
172 # directory is storage for playlists created by MPD. The server will use
173 # playlist files not created by the server but only if they are in the MPD
174 # format. This setting defaults to playlist saving being disabled.
175 #
176 playlist_directory "~/.mpd/playlists"
177 #
178 # This setting sets the location of the MPD database. This file is used to
179 # load the database at server start up and store the database while the
180 # server is not up. This setting defaults to disabled which will allow
181 # MPD to accept files over ipc socket (using file:// protocol) or streaming
182 # files over an accepted protocol.
183 #
184 db_file "~/.mpd/database"
185 #
186 # These settings are the locations for the daemon log files for the daemon.
187 # These logs are great for troubleshooting, depending on your log_level
188 # settings.
189 #
190 # The special value "syslog" makes MPD use the local syslog daemon. This
191 # setting defaults to logging to syslog, otherwise logging is disabled.
192 #
193 log_file "~/.mpd/log"
194 #
195 # This setting sets the location of the file which stores the process ID
196 # for use of mpd --kill and some init scripts. This setting is disabled by
197 # default and the pid file will not be stored.
198 #
199 pid_file "~/.mpd/pid"
200 #
201 # This setting sets the location of the file which contains information about
202 # most variables to get MPD back into the same general shape it was in before
203 # it was brought down. This setting is disabled by default and the server
204 # state will be reset on server start up.
205 #
206 state_file "~/.mpd/state"
207 #
208 # The location of the sticker database. This is a database which
209 # manages dynamic information attached to songs.
210 #
211 sticker_file "~/.mpd/sticker.sql"
212 #
213 ###############################################################################
214
215
216 # General music daemon options ################################################
217 #
218 # This setting specifies the user that MPD will run as. MPD should never run as
219 # root and you may use this setting to make MPD change its user ID after
220 # initialization. This setting is disabled by default and MPD is run as the
221 # current user.
222 #
223 #user "nobody"
224 #
225 # This setting specifies the group that MPD will run as. If not specified
226 # primary group of user specified with "user" setting will be used (if set).
227 # This is useful if MPD needs to be a member of group such as "audio" to
228 # have permission to use sound card.
229 #
230 #group "nogroup"
231 #
232 # This setting sets the address for the daemon to listen on. Careful attention
233 # should be paid if this is assigned to anything other then the default, any.
234 # This setting can deny access to control of the daemon. Not effective if
235 # systemd socket activiation is in use.
236 #
237 # For network
238 #bind_to_address "any"
239 #
240 # And for Unix Socket
241 #bind_to_address "~/.mpd/socket"
242 #
243 # This setting is the TCP port that is desired for the daemon to get assigned
244 # to.
245 #
246 #port "6600"
247 #
248 # This setting controls the type of information which is logged. Available
249 # setting arguments are "default", "secure" or "verbose". The "verbose" setting
250 # argument is recommended for troubleshooting, though can quickly stretch
251 # available resources on limited hardware storage.
252 #
253 #log_level "default"
254 #
255 # If you have a problem with your MP3s ending abruptly it is recommended that
256 # you set this argument to "no" to attempt to fix the problem. If this solves
257 # the problem, it is highly recommended to fix the MP3 files with vbrfix
258 # (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
259 # point gapless MP3 playback can be enabled.
260 #
261 #gapless_mp3_playback "yes"
262 #
263 # Setting "restore_paused" to "yes" puts MPD into pause mode instead
264 # of starting playback after startup.
265 #
266 #restore_paused "no"
267 #
268 # This setting enables MPD to create playlists in a format usable by other
269 # music players.
270 #
271 #save_absolute_paths_in_playlists "no"
272 #
273 # This setting defines a list of tag types that will be extracted during the
274 # audio file discovery process. The complete list of possible values can be
275 # found in the user manual.
276 #metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
277 #
278 # This setting enables automatic update of MPD's database when files in
279 # music_directory are changed.
280 #
281 #auto_update "yes"
282 #
283 # Limit the depth of the directories being watched, 0 means only watch
284 # the music directory itself. There is no limit by default.
285 #
286 #auto_update_depth "3"
287 #
288 ###############################################################################
289
290
291 # Symbolic link behavior ######################################################
292 #
293 # If this setting is set to "yes", MPD will discover audio files by following
294 # symbolic links outside of the configured music_directory.
295 #
296 #follow_outside_symlinks "yes"
297 #
298 # If this setting is set to "yes", MPD will discover audio files by following
299 # symbolic links inside of the configured music_directory.
300 #
301 #follow_inside_symlinks "yes"
302 #
303 ###############################################################################
304
305
306 # Zeroconf / Avahi Service Discovery ##########################################
307 #
308 # If this setting is set to "yes", service information will be published with
309 # Zeroconf / Avahi.
310 #
311 #zeroconf_enabled "yes"
312 #
313 # The argument to this setting will be the Zeroconf / Avahi unique name for
314 # this MPD server on the network.
315 #
316 #zeroconf_name "Music Player"
317 #
318 ###############################################################################
319
320
321 # Permissions #################################################################
322 #
323 # If this setting is set, MPD will require password authorization. The password
324 # setting can be specified multiple times for different password profiles.
325 #
326 #password "password@read,add,control,admin"
327 #
328 # This setting specifies the permissions a user has who has not yet logged in.
329 #
330 #default_permissions "read,add,control,admin"
331 #
332 ###############################################################################
333
334
335 # Database #######################################################################
336 #
337
338 #database {
339 # plugin "proxy"
340 # host "other.mpd.host"
341 # port "6600"
342 #}
343
344 # Input #######################################################################
345 #
346
347 input {
348 plugin "curl"
349 # proxy "proxy.isp.com:8080"
350 # proxy_user "user"
351 # proxy_password "password"
352 }
353
354 #
355 ###############################################################################
356
357 # Audio Output ################################################################
358 #
359
360 audio_output {
361 type "pulse"
362 name "pulse audio"
363 }
364
365 audio_output {
366 type "fifo"
367 name "my_fifo"
368 path "/tmp/mpd.fifo"
369 format "44100:16:2"
370 }
371
372 # MPD supports various audio output types, as well as playing through multiple
373 # audio outputs at the same time, through multiple audio_output settings
374 # blocks. Setting this block is optional, though the server will only attempt
375 # autodetection for one sound card.
376 #
377 # An example of an ALSA output:
378 #
379 #audio_output {
380 # type "alsa"
381 # name "My ALSA Device"
382 ## device "hw:0,0" # optional
383 ## mixer_type "hardware" # optional
384 ## mixer_device "default" # optional
385 ## mixer_control "PCM" # optional
386 ## mixer_index "0" # optional
387 #}
388 #
389 # An example of an OSS output:
390 #
391 #audio_output {
392 # type "oss"
393 # name "My OSS Device"
394 ## device "/dev/dsp" # optional
395 ## mixer_type "hardware" # optional
396 ## mixer_device "/dev/mixer" # optional
397 ## mixer_control "PCM" # optional
398 #}
399 #
400 # An example of a shout output (for streaming to Icecast):
401 #
402 #audio_output {
403 # type "shout"
404 # encoder "vorbis" # optional
405 # name "My Shout Stream"
406 # host "localhost"
407 # port "8000"
408 # mount "/mpd.ogg"
409 # password "hackme"
410 # quality "5.0"
411 # bitrate "128"
412 # format "44100:16:1"
413 ## protocol "icecast2" # optional
414 ## user "source" # optional
415 ## description "My Stream Description" # optional
416 ## url "http://example.com" # optional
417 ## genre "jazz" # optional
418 ## public "no" # optional
419 ## timeout "2" # optional
420 ## mixer_type "software" # optional
421 #}
422 #
423 # An example of a recorder output:
424 #
425 #audio_output {
426 # type "recorder"
427 # name "My recorder"
428 # encoder "vorbis" # optional, vorbis or lame
429 # path "/var/lib/mpd/recorder/mpd.ogg"
430 ## quality "5.0" # do not define if bitrate is defined
431 # bitrate "128" # do not define if quality is defined
432 # format "44100:16:1"
433 #}
434 #
435 # An example of a httpd output (built-in HTTP streaming server):
436 #
437 #audio_output {
438 # type "httpd"
439 # name "My HTTP Stream"
440 # encoder "vorbis" # optional, vorbis or lame
441 # port "8000"
442 # bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
443 ## quality "5.0" # do not define if bitrate is defined
444 # bitrate "128" # do not define if quality is defined
445 # format "44100:16:1"
446 # max_clients "0" # optional 0=no limit
447 #}
448 #
449 # An example of a pulseaudio output (streaming to a remote pulseaudio server)
450 #
451 #audio_output {
452 # type "pulse"
453 # name "My Pulse Output"
454 ## server "remote_server" # optional
455 ## sink "remote_server_sink" # optional
456 #}
457 #
458 # An example of a winmm output (Windows multimedia API).
459 #
460 #audio_output {
461 # type "winmm"
462 # name "My WinMM output"
463 ## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
464 # or
465 ## device "0" # optional
466 ## mixer_type "hardware" # optional
467 #}
468 #
469 # An example of an openal output.
470 #
471 #audio_output {
472 # type "openal"
473 # name "My OpenAL output"
474 ## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
475 #}
476 #
477 # An example of an sndio output.
478 #
479 #audio_output {
480 # type "sndio"
481 # name "sndio output"
482 # mixer_type "software"
483 #}
484 #
485 # An example of an OS X output:
486 #
487 #audio_output {
488 # type "osx"
489 # name "My OS X Device"
490 ## device "Built-in Output" # optional
491 ## channel_map "-1,-1,0,1" # optional
492 #}
493 #
494 ## Example "pipe" output:
495 #
496 #audio_output {
497 # type "pipe"
498 # name "my pipe"
499 # command "aplay -f cd 2>/dev/null"
500 ## Or if you're want to use AudioCompress
501 # command "AudioCompress -m | aplay -f cd 2>/dev/null"
502 ## Or to send raw PCM stream through PCM:
503 # command "nc example.org 8765"
504 # format "44100:16:2"
505 #}
506 #
507 ## An example of a null output (for no audio output):
508 #
509 #audio_output {
510 # type "null"
511 # name "My Null Output"
512 # mixer_type "none" # optional
513 #}
514 #
515 ###############################################################################
516
517
518 # Normalization automatic volume adjustments ##################################
519 #
520 # This setting specifies the type of ReplayGain to use. This setting can have
521 # the argument "off", "album", "track" or "auto". "auto" is a special mode that
522 # chooses between "track" and "album" depending on the current state of
523 # random playback. If random playback is enabled then "track" mode is used.
524 # See <http://www.replaygain.org> for more details about ReplayGain.
525 # This setting is off by default.
526 #
527 #replaygain "album"
528 #
529 # This setting sets the pre-amp used for files that have ReplayGain tags. By
530 # default this setting is disabled.
531 #
532 #replaygain_preamp "0"
533 #
534 # This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
535 # By default this setting is disabled.
536 #
537 #replaygain_missing_preamp "0"
538 #
539 # This setting enables or disables ReplayGain limiting.
540 # MPD calculates actual amplification based on the ReplayGain tags
541 # and replaygain_preamp / replaygain_missing_preamp setting.
542 # If replaygain_limit is enabled MPD will never amplify audio signal
543 # above its original level. If replaygain_limit is disabled such amplification
544 # might occur. By default this setting is enabled.
545 #
546 #replaygain_limit "yes"
547 #
548 # This setting enables on-the-fly normalization volume adjustment. This will
549 # result in the volume of all playing audio to be adjusted so the output has
550 # equal "loudness". This setting is disabled by default.
551 #
552 #volume_normalization "no"
553 #
554 ###############################################################################
555
556 # Character Encoding ##########################################################
557 #
558 # If file or directory names do not display correctly for your locale then you
559 # may need to modify this setting.
560 #
561 #filesystem_charset "UTF-8"
562 #
563 ###############################################################################
564 #+end_src
565
566 ** ncmpcpp
567
568 *** config
569 :PROPERTIES:
570 :header-args+: :tangle ~/.ncmpcpp/config
571 :END:
572
573 #+begin_src conf :tangle no
574 ##############################################################
575 ## This is the example configuration file. Copy it to ##
576 ## $HOME/.ncmpcpp/config or $XDG_CONFIG_HOME/ncmpcpp/config ##
577 ## and set up your preferences. ##
578 ##############################################################
579 #
580 ##### directories ######
581 ##
582 ## Directory for storing ncmpcpp related files.
583 ## Changing it is useful if you want to store
584 ## everything somewhere else and provide command
585 ## line setting for alternative location to config
586 ## file which defines that while launching ncmpcpp.
587 ##
588 #
589 ncmpcpp_directory = ~/.ncmpcpp
590 #
591 ##
592 ## Directory for storing downloaded lyrics. It
593 ## defaults to ~/.lyrics since other MPD clients
594 ## (eg. ncmpc) also use that location.
595 ##
596 #
597 #lyrics_directory = ~/.lyrics
598 #
599 ##### connection settings #####
600 #
601 #mpd_host = localhost
602 #
603 #mpd_port = 6600
604 #
605 #mpd_connection_timeout = 5
606 #
607 ## Needed for tag editor and file operations to work.
608 ##
609 mpd_music_dir = ~/usr/music
610 #
611 #mpd_crossfade_time = 5
612 #
613 ##### music visualizer #####
614 ##
615 ## Note: In order to make music visualizer work you'll
616 ## need to use mpd fifo output, whose format parameter
617 ## has to be set to 44100:16:1 for mono visualization
618 ## or 44100:16:2 for stereo visualization. Example
619 ## configuration (it has to be put into mpd.conf):
620 ##
621 ## audio_output {
622 ## type "fifo"
623 ## name "Visualizer feed"
624 ## path "/tmp/mpd.fifo"
625 ## format "44100:16:2"
626 ## }
627 ##
628 #
629 visualizer_fifo_path = /tmp/mpd.fifo
630 #
631 ##
632 ## Note: Below parameter is needed for ncmpcpp
633 ## to determine which output provides data for
634 ## visualizer and thus allow syncing between
635 ## visualization and sound as currently there
636 ## are some problems with it.
637 ##
638 #
639 visualizer_output_name = my fifo
640 #
641 ##
642 ## If you set format to 44100:16:2, make it 'yes'.
643 ##
644 visualizer_in_stereo = yes
645 #
646 ##
647 ## Multiply received samples by given value. Very
648 ## useful for proper visualization of quiet music.
649 ##
650 #visualizer_sample_multiplier = 1
651 #
652 ##
653 ## Note: Below parameter defines how often ncmpcpp
654 ## has to "synchronize" visualizer and audio outputs.
655 ## 30 seconds is optimal value, but if you experience
656 ## synchronization problems, set it to lower value.
657 ## Keep in mind that sane values start with >=10.
658 ##
659 #
660 visualizer_sync_interval = 30
661 #
662 ##
663 ## Note: To enable spectrum frequency visualization
664 ## you need to compile ncmpcpp with fftw3 support.
665 ##
666 #
667 ## Available values: spectrum, wave, wave_filled, ellipse.
668 ##
669 visualizer_type = spectrum
670 #
671 #visualizer_look = ●▮
672 visualizer_look = "●•"
673 #
674 #visualizer_color = blue, cyan, green, yellow, magenta, red
675 #
676 ## Alternative subset of 256 colors for terminals that support it.
677 ##
678 #visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161
679 #
680 ##### system encoding #####
681 ##
682 ## ncmpcpp should detect your charset encoding
683 ## but if it failed to do so, you can specify
684 ## charset encoding you are using here.
685 ##
686 ## Note: You can see whether your ncmpcpp build
687 ## supports charset detection by checking output
688 ## of `ncmpcpp --version`.
689 ##
690 ## Note: Since MPD uses UTF-8 by default, setting
691 ## this option makes sense only if your encoding
692 ## is different.
693 ##
694 #
695 #system_encoding = ""
696 #
697 ##### delays #####
698 #
699 ## Time of inactivity (in seconds) after playlist
700 ## highlighting will be disabled (0 = always on).
701 ##
702 #playlist_disable_highlight_delay = 5
703 #
704 ## Defines how long messages are supposed to be visible.
705 ##
706 #message_delay_time = 5
707 #
708 ##### song format #####
709 ##
710 ## For a song format you can use:
711 ##
712 ## %l - length
713 ## %f - filename
714 ## %D - directory
715 ## %a - artist
716 ## %A - album artist
717 ## %t - title
718 ## %b - album
719 ## %y - date
720 ## %n - track number (01/12 -> 01)
721 ## %N - full track info (01/12 -> 01/12)
722 ## %g - genre
723 ## %c - composer
724 ## %p - performer
725 ## %d - disc
726 ## %C - comment
727 ## %P - priority
728 ## $R - begin right alignment
729 ##
730 ## If you want to make sure that a part of the format is displayed
731 ## only when certain tags are present, you can archieve it by
732 ## grouping them with brackets, e.g. '{%a - %t}' will be evaluated
733 ## to 'ARTIST - TITLE' if both tags are present or '' otherwise.
734 ## It is also possible to define a list of alternatives by providing
735 ## several groups and separating them with '|', e.g. '{%t}|{%f}'
736 ## will be evaluated to 'TITLE' or 'FILENAME' if the former is not
737 ## present.
738 ##
739 ## Note: If you want to set limit on maximal length of a tag, just
740 ## put the appropriate number between % and character that defines
741 ## tag type, e.g. to make album take max. 20 terminal cells, use '%20b'.
742 ##
743 ## In addition, formats support markers used for text attributes.
744 ## They are followed by character '$'. After that you can put:
745 ##
746 ## - 0 - default window color (discards all other colors)
747 ## - 1 - black
748 ## - 2 - red
749 ## - 3 - green
750 ## - 4 - yellow
751 ## - 5 - blue
752 ## - 6 - magenta
753 ## - 7 - cyan
754 ## - 8 - white
755 ## - 9 - end of current color
756 ## - b - bold text
757 ## - u - underline text
758 ## - r - reverse colors
759 ## - a - use alternative character set
760 ##
761 ## If you don't want to use a non-color attribute anymore, just put it
762 ## again, but this time insert character '/' between '$' and attribute
763 ## character, e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag
764 ## or filename with reversed colors.
765 ##
766 ## If you want to use 256 colors and/or background colors in formats
767 ## (the naming scheme is described below in section about color
768 ## definitions), it can be done with the syntax $(COLOR), e.g. to set
769 ## the artist tag to one of the non-standard colors and make it have
770 ## yellow background, you need to write $(197_yellow)%a$(end). Note
771 ## that for standard colors this is interchangable with attributes
772 ## listed above.
773 ##
774 ## Note: colors can be nested.
775 ##
776 #
777 #song_list_format = {%a - }{%t}|{$8%f$9}$R{$3(%l)$9}
778 #
779 #song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
780 #
781 #song_library_format = {%n - }{%t}|{%f}
782 #
783 #
784 #alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
785 #
786 #alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
787 #
788 #now_playing_prefix = $b
789 #
790 #now_playing_suffix = $/b
791 #
792 #browser_playlist_prefix = "$2playlist$9 "
793 #
794 #selected_item_prefix = $6
795 #
796 #selected_item_suffix = $9
797 #
798 #modified_item_prefix = $3> $9
799 #
800 ##
801 ## Note: attributes are not supported for the following variables.
802 ##
803 #song_window_title_format = {%a - }{%t}|{%f}
804 ##
805 ## Note: Below variables are used for sorting songs in browser.
806 ## The sort mode determines how songs are sorted, and can be used
807 ## in combination with a sort format to specify a custom sorting format.
808 ## Available values for browser_sort_mode are "name", "mtime", "format"
809 ## and "noop".
810 ##
811 #
812 #browser_sort_mode = name
813 #
814 #browser_sort_format = {%a - }{%t}|{%f} {(%l)}
815 #
816 ##### columns settings #####
817 ##
818 ## syntax of song columns list format is "column column etc."
819 ##
820 ## - syntax for each column is:
821 ##
822 ## (width of the column)[color of the column]{displayed tag}
823 ##
824 ## Note: Width is by default in %, if you want a column to
825 ## have fixed size, add 'f' after the value, e.g. (10)[white]{a}
826 ## will be the column that take 10% of screen (so the real width
827 ## will depend on actual screen size), whereas (10f)[white]{a}
828 ## will take 10 terminal cells, no matter how wide the screen is.
829 ##
830 ## - color is optional (if you want the default one,
831 ## leave the field empty).
832 ##
833 ## Note: You can give a column additional attributes by putting appropriate
834 ## character after displayed tag character. Available attributes are:
835 ##
836 ## - r - column will be right aligned
837 ## - E - if tag is empty, empty tag marker won't be displayed
838 ##
839 ## You can also:
840 ##
841 ## - give a column custom name by putting it after attributes,
842 ## separated with character ':', e.g. {lr:Length} gives you
843 ## right aligned column of lengths named "Length".
844 ##
845 ## - define sequence of tags, that have to be displayed in case
846 ## predecessor is empty in a way similar to the one in classic
847 ## song format, i.e. using '|' character, e.g. {a|c|p:Owner}
848 ## creates column named "Owner" that tries to display artist
849 ## tag and then composer and performer if previous ones are
850 ## not available.
851 ##
852 #
853 #song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
854 #
855 ##### various settings #####
856 #
857 ##
858 ## Note: Custom command that will be executed each
859 ## time song changes. Useful for notifications etc.
860 ##
861 #execute_on_song_change = ""
862 #
863 #playlist_show_mpd_host = no
864 #
865 #playlist_show_remaining_time = no
866 #
867 #playlist_shorten_total_times = no
868 #
869 #playlist_separate_albums = no
870 #
871 ##
872 ## Note: Possible display modes: classic, columns.
873 ##
874 #playlist_display_mode = columns
875 #
876 #browser_display_mode = classic
877 #
878 #search_engine_display_mode = classic
879 #
880 #playlist_editor_display_mode = classic
881 #
882 #discard_colors_if_item_is_selected = yes
883 #
884 #incremental_seeking = yes
885 #
886 #seek_time = 1
887 #
888 #volume_change_step = 2
889 #
890 #autocenter_mode = no
891 #
892 #centered_cursor = no
893 #
894 ##
895 ## Note: You can specify third character which will
896 ## be used to build 'empty' part of progressbar.
897 ##
898 #progressbar_look = =>
899 progressbar_look = "─╼╶"
900 #progressbar_look = "─⊙╶"
901 #
902 #progressbar_boldness = yes
903 #
904 ## Available values: database, playlist.
905 ##
906 #default_place_to_search_in = database
907 #
908 ## Available values: classic, alternative.
909 ##
910 #user_interface = classic
911 #
912 #data_fetching_delay = yes
913 #
914 ## Available values: artist, album_artist, date, genre, composer, performer.
915 ##
916 #media_library_primary_tag = artist
917 #
918 ## Available values: wrapped, normal.
919 ##
920 #default_find_mode = wrapped
921 #
922 #default_tag_editor_pattern = %n - %t
923 #
924 #header_visibility = yes
925 #
926 #statusbar_visibility = yes
927 #
928 #titles_visibility = yes
929 #
930 #header_text_scrolling = yes
931 #
932 #cyclic_scrolling = no
933 #
934 #lines_scrolled = 2
935 #
936 #follow_now_playing_lyrics = no
937 #
938 #fetch_lyrics_for_current_song_in_background = no
939 #
940 #store_lyrics_in_song_dir = no
941 #
942 #generate_win32_compatible_filenames = yes
943 #
944 #allow_for_physical_item_deletion = no
945 #
946 ##
947 ## Note: If you set this variable, ncmpcpp will try to
948 ## get info from last.fm in language you set and if it
949 ## fails, it will fall back to english. Otherwise it will
950 ## use english the first time.
951 ##
952 ## Note: Language has to be expressed as an ISO 639 alpha-2 code.
953 ##
954 #lastfm_preferred_language = en
955 #
956 #show_hidden_files_in_local_browser = no
957 #
958 ##
959 ## How shall screen switcher work?
960 ##
961 ## - "previous" - switch between the current and previous screen.
962 ## - "screen1,...,screenN" - switch between given sequence of screens.
963 ##
964 ## Screens available for use: help, playlist, browser, search_engine,
965 ## media_library, playlist_editor, tag_editor, outputs, visualizer, clock.
966 ##
967 #screen_switcher_mode = playlist, browser
968 #
969 ##
970 ## Note: You can define startup screen
971 ## by choosing screen from the list above.
972 ##
973 #startup_screen = playlist
974 #
975 ##
976 ## Note: You can define startup slave screen
977 ## by choosing screen from the list above or
978 ## an empty value for no slave screen.
979 ##
980 #startup_slave_screen = ""
981 #
982 #startup_slave_screen_focus = no
983 #
984 ##
985 ## Default width of locked screen (in %).
986 ## Acceptable values are from 20 to 80.
987 ##
988 #
989 #locked_screen_width_part = 50
990 #
991 #ask_for_locked_screen_width_part = yes
992 #
993 #jump_to_now_playing_song_at_start = yes
994 #
995 #ask_before_clearing_playlists = yes
996 #
997 #clock_display_seconds = no
998 #
999 #display_volume_level = yes
1000 #
1001 #display_bitrate = no
1002 #
1003 #display_remaining_time = no
1004 #
1005 ## Available values: none, basic, extended, perl.
1006 ##
1007 #regular_expressions = perl
1008 #
1009 ##
1010 ## Note: If below is enabled, ncmpcpp will ignore leading
1011 ## "The" word while sorting items in browser, tags in
1012 ## media library, etc.
1013 ##
1014 #ignore_leading_the = no
1015 #
1016 #block_search_constraints_change_if_items_found = yes
1017 #
1018 #mouse_support = yes
1019 #
1020 #mouse_list_scroll_whole_page = yes
1021 #
1022 #empty_tag_marker = <empty>
1023 #
1024 #tags_separator = " | "
1025 #
1026 #tag_editor_extended_numeration = no
1027 #
1028 #media_library_sort_by_mtime = no
1029 #
1030 #enable_window_title = yes
1031 #
1032 ##
1033 ## Note: You can choose default search mode for search
1034 ## engine. Available modes are:
1035 ##
1036 ## - 1 - use mpd built-in searching (no regexes, pattern matching)
1037 ## - 2 - use ncmpcpp searching (pattern matching with support for regexes,
1038 ## but if your mpd is on a remote machine, downloading big database
1039 ## to process it can take a while
1040 ## - 3 - match only exact values (this mode uses mpd function for searching
1041 ## in database and local one for searching in current playlist)
1042 ##
1043 #
1044 #search_engine_default_search_mode = 1
1045 #
1046 #external_editor = nano
1047 #
1048 ## Note: set to yes if external editor is a console application.
1049 ##
1050 #use_console_editor = yes
1051 #
1052 ##### colors definitions #####
1053 ##
1054 ## It is possible to set a background color by setting a color
1055 ## value "<foreground>_<background>", e.g. red_black will set
1056 ## foregound color to red and background color to black.
1057 ##
1058 ## In addition, for terminals that support 256 colors it
1059 ## is possible to set one of them by using a number in range
1060 ## [1, 256] instead of color name, e.g. numerical value
1061 ## corresponding to red_black is 2_1. To find out if the
1062 ## terminal supports 256 colors, run ncmpcpp and check out
1063 ## the bottom of the help screen for list of available colors
1064 ## and their numerical values.
1065 ##
1066 ## Note: due to technical limitations of ncurses, if 256 colors
1067 ## are used, it is possible to either use only the colors with
1068 ## default background color, or all pairs from 1_1 up to 254_127,
1069 ## depending on the ncurses version used.
1070 ##
1071 #
1072 #colors_enabled = yes
1073 #
1074 #empty_tag_color = cyan
1075 #
1076 #header_window_color = default
1077 #
1078 #volume_color = default
1079 #
1080 #state_line_color = default
1081 #
1082 #state_flags_color = default
1083 #
1084 #main_window_color = yellow
1085 #
1086 #color1 = white
1087 #
1088 #color2 = green
1089 #
1090 #main_window_highlight_color = yellow
1091 #
1092 #progressbar_color = black
1093 #
1094 #progressbar_elapsed_color = green
1095 #
1096 #statusbar_color = default
1097 #
1098 #alternative_ui_separator_color = black
1099 #
1100 #active_column_color = red
1101 #
1102 #window_border_color = green
1103 #
1104 #active_window_border = red
1105 #
1106 #+end_src
1107
1108 *** bindings
1109 :PROPERTIES:
1110 :header-args+: :tangle ~/.ncmpcpp/bindings
1111 :END:
1112
1113 #+begin_src conf :tangle no
1114 def_key "j"
1115 scroll_down
1116 def_key "k"
1117 scroll_up
1118
1119 def_key "ctrl-u"
1120 page_up
1121 def_key "ctrl-d"
1122 page_down
1123
1124 def_key "h"
1125 previous_column
1126 def_key "l"
1127 next_column
1128
1129 def_key "."
1130 show_lyrics
1131
1132 def_key "n"
1133 next_found_item
1134 def_key "N"
1135 previous_found_item
1136
1137 def_key "J"
1138 move_sort_order_down
1139 def_key "K"
1140 move_sort_order_up
1141 #+end_src
1142
1143 ** pacman
1144
1145 *** conf
1146
1147 #+begin_src conf :tangle /sudo::/etc/pacman.conf :comments none
1148 #
1149 # /etc/pacman.conf
1150 #
1151 # See the pacman.conf(5) manpage for option and repository directives
1152
1153 #
1154 # GENERAL OPTIONS
1155 #
1156 [options]
1157 # The following paths are commented out with their default values listed.
1158 # If you wish to use different paths, uncomment and update the paths.
1159 #RootDir = /
1160 #DBPath = /var/lib/pacman/
1161 #CacheDir = /var/cache/pacman/pkg/
1162 #LogFile = /var/log/pacman.log
1163 #GPGDir = /etc/pacman.d/gnupg/
1164 #HookDir = /etc/pacman.d/hooks/
1165 HoldPkg = pacman glibc
1166 #XferCommand = /usr/bin/curl -L -C - -f -o %o %u
1167 #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
1168 #CleanMethod = KeepInstalled
1169 #UseDelta = 0.7
1170 Architecture = auto
1171
1172 # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
1173 #IgnorePkg =
1174 #IgnoreGroup =
1175
1176 #NoUpgrade =
1177 #NoExtract =
1178
1179 # Misc options
1180 #UseSyslog
1181 Color
1182 TotalDownload
1183 CheckSpace
1184 VerbosePkgLists
1185
1186 # By default, pacman accepts packages signed by keys that its local keyring
1187 # trusts (see pacman-key and its man page), as well as unsigned packages.
1188 SigLevel = Required DatabaseOptional
1189 LocalFileSigLevel = Optional
1190 #RemoteFileSigLevel = Required
1191
1192 # NOTE: You must run `pacman-key --init` before first using pacman; the local
1193 # keyring can then be populated with the keys of all Arch/Parabola packagers
1194 # with `pacman-key --populate archlinux` and `pacman-key --populate parabola`.
1195
1196 #
1197 # REPOSITORIES
1198 # - can be defined here or included from another file
1199 # - pacman will search repositories in the order defined here
1200 # - local/custom mirrors can be added here or in separate files
1201 # - repositories listed first will take precedence when packages
1202 # have identical names, regardless of version number
1203 # - URLs will have $repo replaced by the name of the current repo
1204 # - URLs will have $arch replaced by the name of the architecture
1205 #
1206 # Repository entries are of the format:
1207 # [repo-name]
1208 # Server = ServerName
1209 # Include = IncludePath
1210 #
1211 # The header [repo-name] is crucial - it must be present and
1212 # uncommented to enable the repo.
1213 #
1214
1215 # The testing repositories are disabled by default. To enable, uncomment the
1216 # repo name header and Include lines. You can add preferred servers immediately
1217 # after the header, and they will be used before the default mirrors.
1218
1219 # NOTE: Nonprism is a particular repository that aims to provide software built
1220 # and patched without services under global data surveillance programs like PRISM,
1221 # XKeyscore and Tempora. For more info see: https://wiki.parabola.nu/Nonprism
1222
1223 #[nonprism-testing]
1224 #Include = /etc/pacman.d/mirrorlist
1225
1226 #[nonprism]
1227 #Include = /etc/pacman.d/mirrorlist
1228
1229 [libre-testing]
1230 Include = /etc/pacman.d/mirrorlist
1231
1232 [libre]
1233 Include = /etc/pacman.d/mirrorlist
1234
1235 #[testing]
1236 #Include = /etc/pacman.d/mirrorlist
1237
1238 [core]
1239 Include = /etc/pacman.d/mirrorlist
1240
1241 [extra]
1242 Include = /etc/pacman.d/mirrorlist
1243
1244 #[community-testing]
1245 #Include = /etc/pacman.d/mirrorlist
1246
1247 [community]
1248 Include = /etc/pacman.d/mirrorlist
1249
1250 # The PCR (Parabola Community Repository) contains packages maintained by trusted
1251 # members of the Parabola community. It also contains packages maintained by
1252 # Parabola developers, but that the developer decided didn't belong in core/libre.
1253
1254 #[pcr-testing]
1255 #Include = /etc/pacman.d/mirrorlist
1256
1257 [pcr]
1258 Include = /etc/pacman.d/mirrorlist
1259
1260 # If you want to run 32 bit applications on your x86_64 system,
1261 # enable the libre-multilib, multilib and pcr-multilib repositories as required here.
1262
1263 #[nonprism-multilib-testing]
1264 #Include = /etc/pacman.d/mirrorlist
1265
1266 #[nonprism-multilib]
1267 #Include = /etc/pacman.d/mirrorlist
1268
1269 #[libre-multilib-testing]
1270 #Include = /etc/pacman.d/mirrorlist
1271
1272 #[libre-multilib]
1273 #Include = /etc/pacman.d/mirrorlist
1274
1275 #[multilib-testing]
1276 #Include = /etc/pacman.d/mirrorlist
1277
1278 #[multilib]
1279 #Include = /etc/pacman.d/mirrorlist
1280
1281 #[pcr-multilib-testing]
1282 #Include = /etc/pacman.d/mirrorlist
1283
1284 #[pcr-multilib]
1285 #Include = /etc/pacman.d/mirrorlist
1286
1287 # Parabola also supports another community projects and personal repositories, to
1288 # find them check out this wiki page: https://wiki.parabola.nu/Repositories
1289
1290 # An example of a custom package repository. See the pacman manpage for
1291 # tips on creating your own repositories.
1292 #[custom]
1293 #SigLevel = Optional TrustAll
1294 #Server = file:///home/custompkgs
1295
1296 Include = /etc/pacman.d/*.conf
1297 #+end_src
1298
1299 *** mirrorlist
1300
1301 #+begin_src conf :tangle /sudo::/etc/pacman.d/mirrorlist :comments none
1302 # Parabola GNU/Linux-libre - Last Updated: Wed Dec 20 02:59:35 GMT 2017
1303
1304 Server = http://mirror.fsf.org/parabola/$repo/os/$arch
1305 Server = http://mirror.fsf.org/parabola/$repo/os/$arch
1306 Server = http://mirror.fsf.org/parabola/$repo/os/$arch
1307 Server = http://mirror.fsf.org/parabola/$repo/os/$arch
1308
1309 # Location: London, UK
1310 # Responsible: Parabola Project
1311 # Note: Not really a mirror, automatically redirects you to an Arch
1312 # mirror when possible. Works best specifying it a few times in a
1313 # row (404s workaround).
1314 # Server = http://redirector.parabola.nu/$repo/os/$arch
1315 Server = https://redirector.parabola.nu/$repo/os/$arch
1316
1317 # Location: Reykjavík, Iceland
1318 # Responsible: Parabola Project
1319 # Note: Not really a mirror, automatically redirects you to a Parabola
1320 # mirror that has the file you are looking for.
1321 # Server = http://repomirror.parabola.nu/$repo/os/$arch
1322 Server = https://repomirror.parabola.nu/$repo/os/$arch
1323
1324 # Location: Falkenstein, Germany
1325 # Server = http://mirror.grapentin.org/parabola/$repo/os/$arch
1326 Server = https://mirror.grapentin.org/parabola/$repo/os/$arch
1327
1328 # Location: Volendam, Netherlands
1329 Server = https://jeweet.net/repo/parabola/$repo/os/$arch
1330
1331 # Location: Amsterdam, Netherlands
1332 # Note: Not really a mirror, but a high-speed 10GiB cache for
1333 # mirror.yandex.ru/mirrors/parabola
1334 # Server = http://parabola.isacdaavid.info:8080/$repo/os/$arch
1335 Server = https://parabola.isacdaavid.info:8081/$repo/os/$arch
1336
1337 # Location: Moscow, Russian Federation
1338 # Server = http://mirror.yandex.ru/mirrors/parabola/$repo/os/$arch
1339 Server = https://mirror.yandex.ru/mirrors/parabola/$repo/os/$arch
1340
1341 # Location: Ho Chi Minh City, Vietnam
1342 # Server = http://mirror.freedif.org/Parabola/$repo/os/$arch
1343 Server = https://mirror.freedif.org/Parabola/$repo/os/$arch
1344
1345 # Location: Los Angeles, CA, USA
1346 # Note: Also visit http://alfplayer.com/ for its SNAPSHOTS ARCHIVE
1347 Server = http://alfplayer.com/parabola/$repo/os/$arch
1348
1349 # Location: Boston, MA, USA
1350 Server = http://mirror.fsf.org/parabola/$repo/os/$arch
1351
1352 # Location: Austin, TX, USA
1353 # Server = http://parabola.serverpit.com/
1354 Server = https://parabola.serverpit.com/
1355
1356 # Location: Reykjavík, Iceland
1357 # Responsible: Parabola Project
1358 # Note: Currently pointing to repomirror.parabola.nu
1359 # Server = http://repo.parabola.nu/$repo/os/$arch
1360 Server = https://repo.parabola.nu/$repo/os/$arch
1361 #+end_src
1362
1363 ** pigeonhole
1364 *** amin.sieve
1365 :PROPERTIES:
1366 :header-args+: :tangle ~/mail/bndl.org/amin/sieve/amin.sieve :comments none
1367 :END:
1368
1369 #+begin_src conf
1370 require ["regex", "variables", "fileinto", "envelope",
1371 "mailbox", "imap4flags", "include"];
1372
1373 # webmasters
1374 if anyof (
1375 address :is "from" ["webmasters@gnu.org", "webmasters-comment@gnu.org"]) {
1376 fileinto :create "gnu.webmasters";
1377 stop;
1378 }
1379
1380 include :personal "lists";
1381 #+end_src
1382
1383 *** lists.sieve
1384 :PROPERTIES:
1385 :header-args+: :tangle ~/mail/bndl.org/amin/sieve/lists.sieve :comments none
1386 :END:
1387
1388 #+begin_src conf
1389 require ["regex", "variables", "fileinto", "envelope",
1390 "mailbox", "imap4flags", "include"];
1391
1392 # mailing lists
1393 if anyof (
1394 header :contains "list-id"
1395 [ "<emacs-devel.gnu.org>"
1396 , "<emacs-orgmode.gnu.org>"
1397 , "<emacsconf-discuss.gnu.org>"
1398 , "<fencepost-users.gnu.org>"
1399 , "<guix-devel.gnu.org>"
1400 , "<guile-devel.gnu.org>"
1401 , "<help-gnu-emacs.gnu.org>"
1402 , "<info-gnu-emacs.gnu.org>"
1403 , "<info-guix.gnu.org>"
1404 , "<www-commits.gnu.org>"
1405 , "<www-discuss.gnu.org>"
1406 , "<deepspec.lists.cs.princeton.edu>"
1407 , "<haskell-cafe.haskell.org>"
1408 , "<haskell-art.we.lurk.org>"
1409 , "<notmuch.notmuchmail.org>"
1410 ] ) {
1411 if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
1412 set :lower "listname" "${1}";
1413 fileinto :create "gnu.${listname}";
1414 stop;
1415 }
1416 }
1417
1418 # sr.ht lists, with dots ('.') omitted
1419 if anyof (
1420 header :contains "list-id"
1421 [ "<~bandali/public-inbox@lists.sr.ht>"
1422 , "<~sircmpwn/sr.ht-admins@lists.sr.ht>"
1423 , "<~sircmpwn/sr.ht-announce@lists.sr.ht>"
1424 , "<~sircmpwn/sr.ht-dev@lists.sr.ht>"
1425 , "<~sircmpwn/sr.ht-discuss@lists.sr.ht>"
1426 ] ) {
1427 if header :regex "list-id" "(~[a-z_0-9-]+)/([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)@" {
1428 set :lower "username" "${1}";
1429 set :lower "listname" "${2}${3}${4}${5}${6}${7}";
1430 fileinto :create "gnu.${username}.${listname}";
1431 stop;
1432 }
1433 }
1434 #+end_src
1435
1436 ** PowerTOP
1437 :PROPERTIES:
1438 :header-args+: :tangle "/sudo::/etc/systemd/system/powertop.service"
1439 :END:
1440
1441 #+begin_src conf
1442 [Unit]
1443 Description=Powertop tunings
1444
1445 [Service]
1446 ExecStart=/usr/bin/powertop --auto-tune
1447 RemainAfterExit=true
1448
1449 [Install]
1450 WantedBy=multi-user.target
1451 #+end_src
1452
1453 ** redshift
1454 :PROPERTIES:
1455 :header-args+: :tangle ~/.config/redshift.conf :comments none
1456 :END:
1457
1458 #+begin_src conf
1459 ; Global settings for redshift
1460 [redshift]
1461 ; Set the day and night screen temperatures (Neutral is 6500K)
1462 ;temp-day=5700
1463 ;temp-night=3500
1464
1465 ;temp-day=6500
1466 temp-day=6200
1467 ;temp-night=4800
1468 ;temp-night=5000
1469 ;temp-night=4500
1470 temp-night=4000
1471
1472 ; Enable/Disable a smooth transition between day and night
1473 ; 0 will cause a direct change from day to night screen temperature.
1474 ; 1 will gradually increase or decrease the screen temperature.
1475 transition=1
1476
1477 ; Set the screen brightness. Default is 1.0.
1478 ;brightness=0.9
1479 ; It is also possible to use different settings for day and night
1480 ; since version 1.8.
1481 ;brightness-day=0.7
1482 ;brightness-night=0.4
1483 ; Set the screen gamma (for all colors, or each color channel
1484 ; individually)
1485 ;gamma=0.8
1486 ;gamma=1.0
1487 ;gamma=0.8:0.7:0.8
1488 ; This can also be set individually for day and night since
1489 ; version 1.10.
1490 ;gamma-day=0.8:0.7:0.8
1491 ;gamma-night=0.6
1492
1493 ; Set the location-provider: 'geoclue2' or 'manual'
1494 ; type 'redshift -l list' to see possible values.
1495 ; The location provider settings are in a different section.
1496 ;location-provider=manual
1497 location-provider=geoclue2
1498
1499 ; Set the adjustment-method: 'randr', 'vidmode'
1500 ; type 'redshift -m list' to see all possible values.
1501 ; 'randr' is the preferred method, 'vidmode' is an older API.
1502 ; but works in some cases when 'randr' does not.
1503 ; The adjustment method settings are in a different section.
1504 adjustment-method=randr
1505
1506 ; Configuration of the location-provider:
1507 ; type 'redshift -l PROVIDER:help' to see the settings.
1508 ; ex: 'redshift -l manual:help'
1509 ; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
1510 ; are negative numbers.
1511 ;[manual]
1512 ;lat=48.1
1513 ;lon=11.6
1514
1515 ; Configuration of the adjustment-method
1516 ; type 'redshift -m METHOD:help' to see the settings.
1517 ; ex: 'redshift -m randr:help'
1518 ; In this example, randr is configured to adjust screen 1.
1519 ; Note that the numbering starts from 0, so this is actually the
1520 ; second screen. If this option is not specified, Redshift will try
1521 ; to adjust _all_ screens.
1522 ;[randr]
1523 ;screen=1
1524 #+end_src
1525
1526 ** systemd
1527
1528 Keep boot messages on tty1 (see [[https://wiki.archlinux.org/index.php/getty#Have_boot_messages_stay_on_tty1][here]])
1529
1530 #+begin_src conf :tangle /sudo::/etc/systemd/system/getty@tty1.service.d/noclear.conf
1531 [Service]
1532 TTYVTDisallocate=no
1533 #+end_src
1534
1535 ** TLP
1536
1537 *** langa
1538
1539 #+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "langa")) "/sudo::/etc/default/tlp")
1540 # ------------------------------------------------------------------------------
1541 # tlp - Parameters for power saving
1542 # See full explanation: https://linrunner.de/en/tlp/docs/tlp-configuration.html
1543
1544 # Notes:
1545 # - Some parameters are disabled, remove the leading '#' to enable # them;
1546 # shown values are suggestions not defaults
1547 # - Default *: intrinsic default that is effective when the parameter is missing
1548 # or disabled by a leading '#'; use PARAM="" to disable intrinsic defaults for
1549 # parameters with text string values
1550 # - Default <none>: do nothing or use kernel/hardware defaults
1551
1552 # Set to 0 to disable, 1 to enable TLP.
1553 # Default: 0
1554 TLP_ENABLE=1
1555
1556 # Operation mode when no power supply can be detected: AC, BAT.
1557 # Concerns some desktop and embedded hardware only.
1558 # Default: <none>
1559 TLP_DEFAULT_MODE=AC
1560
1561 # Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
1562 # Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
1563 # Default: 0
1564 TLP_PERSISTENT_DEFAULT=0
1565
1566 # Seconds laptop mode has to wait after the disk goes idle before doing a sync.
1567 # Non-zero value enables, zero disables laptop mode.
1568 # Default: 0 (AC), 2 (BAT)
1569 DISK_IDLE_SECS_ON_AC=0
1570 DISK_IDLE_SECS_ON_BAT=2
1571
1572 # Dirty page values (timeouts in secs).
1573 # Default: 15 (AC + BAT)
1574 MAX_LOST_WORK_SECS_ON_AC=15
1575 MAX_LOST_WORK_SECS_ON_BAT=60
1576
1577 # Note: CPU parameters below are disabled by default, remove the leading #
1578 # to enable them, otherwise kernel defaults will be used.
1579
1580 # Select a CPU frequency scaling governor.
1581 # Intel Core i processor with intel_pstate driver:
1582 # powersave(*), performance.
1583 # Older hardware with acpi-cpufreq driver:
1584 # ondemand(*), powersave, performance, conservative, schedutil.
1585 # (*) is recommended.
1586 # Use tlp-stat -p to show the active driver and available governors.
1587 # Important:
1588 # powersave for intel_pstate and ondemand for acpi-cpufreq are power
1589 # efficient for *almost all* workloads and therefore kernel and most
1590 # distributions have chosen them as defaults. If you still want to change,
1591 # you should know what you're doing! You *must* disable your distribution's
1592 # governor settings or conflicts will occur.
1593 # Default: <none>
1594 #CPU_SCALING_GOVERNOR_ON_AC=powersave
1595 #CPU_SCALING_GOVERNOR_ON_BAT=powersave
1596
1597 # Set the min/max frequency available for the scaling governor.
1598 # Possible values depend on your CPU. For available frequencies see
1599 # the output of tlp-stat -p.
1600 # Default: <none>
1601 #CPU_SCALING_MIN_FREQ_ON_AC=0
1602 #CPU_SCALING_MAX_FREQ_ON_AC=0
1603 #CPU_SCALING_MIN_FREQ_ON_BAT=0
1604 #CPU_SCALING_MAX_FREQ_ON_BAT=0
1605
1606 # Set energy performance hints (HWP) for Intel P-state governor:
1607 # performance, balance_performance, default, balance_power, power
1608 # Values are given in order of increasing power saving.
1609 # Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
1610 # Default: <none>
1611 CPU_HWP_ON_AC=balance_performance
1612 CPU_HWP_ON_BAT=balance_power
1613
1614 # Set Intel P-state performance: 0..100 (%).
1615 # Limit the max/min P-state to control the power dissipation of the CPU.
1616 # Values are stated as a percentage of the available performance.
1617 # Requires an Intel Core i processor with intel_pstate driver.
1618 # Default: <none>
1619 #CPU_MIN_PERF_ON_AC=0
1620 #CPU_MAX_PERF_ON_AC=100
1621 #CPU_MIN_PERF_ON_BAT=0
1622 #CPU_MAX_PERF_ON_BAT=30
1623
1624 # Set the CPU "turbo boost" feature: 0=disable, 1=allow
1625 # Requires an Intel Core i processor.
1626 # Important:
1627 # - This may conflict with your distribution's governor settings
1628 # - A value of 1 does *not* activate boosting, it just allows it
1629 # Default: <none>
1630 #CPU_BOOST_ON_AC=1
1631 #CPU_BOOST_ON_BAT=0
1632
1633 # Minimize number of used CPU cores/hyper-threads under light load conditions:
1634 # 0=disable, 1=enable.
1635 # Default: <none>
1636 SCHED_POWERSAVE_ON_AC=0
1637 SCHED_POWERSAVE_ON_BAT=1
1638
1639 # Kernel NMI Watchdog:
1640 # 0=disable (default, saves power), 1=enable (for kernel debugging only).
1641 # Default: <none>
1642 NMI_WATCHDOG=0
1643
1644 # Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
1645 # Frequency voltage pairs are written to:
1646 # /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
1647 # CAUTION: only use this, if you thoroughly understand what you are doing!
1648 # Default: <none>.
1649 #PHC_CONTROLS="F:V F:V F:V F:V"
1650
1651 # Set CPU performance versus energy savings policy:
1652 # performance, balance-performance, default, balance-power, power.
1653 # Values are given in order of increasing power saving.
1654 # Requires kernel module msr and x86_energy_perf_policy from linux-tools.
1655 # Default: <none>
1656 ENERGY_PERF_POLICY_ON_AC=performance
1657 ENERGY_PERF_POLICY_ON_BAT=balance-power
1658
1659 # Disk devices; separate multiple devices with spaces.
1660 # Devices can be specified by disk ID also (lookup with: tlp diskid).
1661 # Note: DISK parameters below are effective only when this option is configured.
1662 # Default: "nvme0n1 sda"
1663 DISK_DEVICES="sda sdb"
1664
1665 # Disk advanced power management level: 1..254, 255 (max saving, min, off).
1666 # Levels 1..127 may spin down the disk; 255 allowable on most drives.
1667 # Separate values for multiple disks with spaces. Use the special value 'keep'
1668 # to keep the hardware default for the particular disk.
1669 # Default: <none>
1670 DISK_APM_LEVEL_ON_AC="254 254"
1671 DISK_APM_LEVEL_ON_BAT="128 128"
1672
1673 # Hard disk spin down timeout:
1674 # 0: spin down disabled
1675 # 1..240: timeouts from 5s to 20min (in units of 5s)
1676 # 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
1677 # See 'man hdparm' for details.
1678 # Separate values for multiple disks with spaces. Use the special value 'keep'
1679 # to keep the hardware default for the particular disk.
1680 # Default: <none>
1681 #DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
1682 #DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
1683
1684 # Select I/O scheduler for the disk devices.
1685 # Multi queue (blk-mq) schedulers:
1686 # mq-deadline(*), none, kyber, bfq
1687 # Single queue schedulers:
1688 # deadline(*), cfq, bfq, noop
1689 # (*) recommended.
1690 # Separate values for multiple disks with spaces. Use the special value 'keep'
1691 # to keep the kernel default scheduler for the particular disk.
1692 # Notes:
1693 # - Multi queue (blk-mq) may need kernel boot option 'scsi_mod.use_blk_mq=1'
1694 # and 'modprobe mq-deadline-iosched|kyber|bfq' on kernels < 5.0
1695 # - Single queue schedulers are legacy now and were removed together with
1696 # the old block layer in kernel 5.0
1697 # Default: keep
1698 #DISK_IOSCHED="mq-deadline mq-deadline"
1699
1700 # AHCI link power management (ALPM) for disk devices:
1701 # min_power, med_power_with_dipm(*), medium_power, max_performance.
1702 # (*) Kernel >= 4.15 required, then recommended.
1703 # Multiple values separated with spaces are tried sequentially until success.
1704 # Default: <none>
1705 SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
1706 SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
1707
1708 # Exclude host devices from AHCI link power management.
1709 # Separate multiple hosts with spaces.
1710 # Default: <none>
1711 #SATA_LINKPWR_BLACKLIST="host1"
1712
1713 # Runtime Power Management for AHCI host and disks devices:
1714 # on=disable, auto=enable.
1715 # EXPERIMENTAL ** WARNING: auto may cause system lockups/data loss.
1716 # Default: <none>
1717 #AHCI_RUNTIME_PM_ON_AC=on
1718 #AHCI_RUNTIME_PM_ON_BAT=on
1719
1720 # Seconds of inactivity before disk is suspended.
1721 # Note: effective only when AHCI_RUNTIME_PM_ON_AC/BAT is activated.
1722 # Default: 15
1723 AHCI_RUNTIME_PM_TIMEOUT=15
1724
1725 # PCI Express Active State Power Management (PCIe ASPM):
1726 # default(*), performance, powersave.
1727 # (*) keeps BIOS ASPM defaults (recommended)
1728 # Default: <none>
1729 #PCIE_ASPM_ON_AC=default
1730 #PCIE_ASPM_ON_BAT=default
1731
1732 # Set the min/max/turbo frequency for the Intel GPU.
1733 # Possible values depend on your hardware. For available frequencies see
1734 # the output of tlp-stat -g.
1735 # Default: <none>
1736 #INTEL_GPU_MIN_FREQ_ON_AC=0
1737 #INTEL_GPU_MIN_FREQ_ON_BAT=0
1738 #INTEL_GPU_MAX_FREQ_ON_AC=0
1739 #INTEL_GPU_MAX_FREQ_ON_BAT=0
1740 #INTEL_GPU_BOOST_FREQ_ON_AC=0
1741 #INTEL_GPU_BOOST_FREQ_ON_BAT=0
1742
1743 # Radeon graphics clock speed (profile method): low, mid, high, auto, default;
1744 # auto = mid on BAT, high on AC.
1745 # Default: default
1746 RADEON_POWER_PROFILE_ON_AC=default
1747 RADEON_POWER_PROFILE_ON_BAT=default
1748
1749 # Radeon dynamic power management method (DPM): battery, performance.
1750 # Default: <none>
1751 RADEON_DPM_STATE_ON_AC=performance
1752 RADEON_DPM_STATE_ON_BAT=battery
1753
1754 # Radeon DPM performance level: auto, low, high; auto is recommended.
1755 # Note: effective only when RADEON_DPM_STATE_ON_AC/BAT is activated.
1756 # Default: auto
1757 RADEON_DPM_PERF_LEVEL_ON_AC=auto
1758 RADEON_DPM_PERF_LEVEL_ON_BAT=auto
1759
1760 # WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
1761 # Default: <none>
1762 WIFI_PWR_ON_AC=off
1763 WIFI_PWR_ON_BAT=on
1764
1765 # Disable wake on LAN: Y/N.
1766 # Default: N
1767 WOL_DISABLE=Y
1768
1769 # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
1770 # A value of 0 disables, >=1 enables power saving (recommended: 1).
1771 # Default: <none>
1772 SOUND_POWER_SAVE_ON_AC=0
1773 SOUND_POWER_SAVE_ON_BAT=0
1774
1775 # Disable controller too (HDA only): Y/N.
1776 # Note: effective only when SOUND_POWER_SAVE_ON_AC/BAT is activated.
1777 # Default: Y
1778 SOUND_POWER_SAVE_CONTROLLER=N
1779
1780 # Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
1781 # Drive can be powered on again by releasing (and reinserting) the eject lever
1782 # or by pressing the disc eject button on newer models.
1783 # Note: an UltraBay/MediaBay hard disk is never powered off.
1784 # Default: 0
1785 BAY_POWEROFF_ON_AC=0
1786 BAY_POWEROFF_ON_BAT=0
1787 # Optical drive device to power off
1788 # Default: sr0
1789 BAY_DEVICE="sr0"
1790
1791 # Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
1792 # Default: <none>
1793 RUNTIME_PM_ON_AC=on
1794 RUNTIME_PM_ON_BAT=auto
1795
1796 # Exclude PCI(e) device adresses the following list from Runtime PM
1797 # (separate with spaces). Use lspci to get the adresses (1st column).
1798 # Default: <none>
1799 #RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
1800
1801 # Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
1802 # Default when unconfigured is "amdgpu nouveau nvidia radeon" which
1803 # prevents accidential power-on of dGPU in hybrid graphics setups.
1804 # Separate multiple drivers with spaces.
1805 # Default: "amdgpu mei_me nouveau nvidia pcieport radeon", use "" to disable
1806 # completely.
1807 #RUNTIME_PM_DRIVER_BLACKLIST="amdgpu mei_me nouveau nvidia pcieport radeon"
1808
1809 # Set to 0 to disable, 1 to enable USB autosuspend feature.
1810 # Default: 0
1811 USB_AUTOSUSPEND=1
1812
1813 # Exclude listed devices from USB autosuspend (separate with spaces).
1814 # Use lsusb to get the ids.
1815 # Note: input devices (usbhid) are excluded automatically
1816 # Default: <none>
1817 #USB_BLACKLIST="1111:2222 3333:4444"
1818
1819 # Bluetooth devices are excluded from USB autosuspend:
1820 # 0=do not exclude, 1=exclude.
1821 # Default: 0
1822 USB_BLACKLIST_BTUSB=0
1823
1824 # Phone devices are excluded from USB autosuspend:
1825 # 0=do not exclude, 1=exclude (enable charging).
1826 # Default: 0
1827 USB_BLACKLIST_PHONE=0
1828
1829 # Printers are excluded from USB autosuspend:
1830 # 0=do not exclude, 1=exclude.
1831 # Default: 1
1832 USB_BLACKLIST_PRINTER=1
1833
1834 # WWAN devices are excluded from USB autosuspend:
1835 # 0=do not exclude, 1=exclude.
1836 # Default: 0
1837 USB_BLACKLIST_WWAN=0
1838
1839 # Include listed devices into USB autosuspend even if already excluded
1840 # by the blacklists above (separate with spaces). Use lsusb to get the ids.
1841 # Default: <none>
1842 #USB_WHITELIST="1111:2222 3333:4444"
1843
1844 # Set to 1 to disable autosuspend before shutdown, 0 to do nothing
1845 # (workaround for USB devices that cause shutdown problems).
1846 # Default: 0
1847 #USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
1848
1849 # Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
1850 # on system startup: 0=disable, 1=enable.
1851 # Note: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
1852 # are ignored when this is enabled.
1853 # Default: 0
1854 #RESTORE_DEVICE_STATE_ON_STARTUP=0
1855 RESTORE_DEVICE_STATE_ON_STARTUP=1
1856
1857 # Radio devices to disable on startup: bluetooth, wifi, wwan.
1858 # Separate multiple devices with spaces.
1859 # Default: <none>
1860 #DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
1861
1862 # Radio devices to enable on startup: bluetooth, wifi, wwan.
1863 # Separate multiple devices with spaces.
1864 # Default: <none>
1865 #DEVICES_TO_ENABLE_ON_STARTUP="wifi"
1866
1867 # Radio devices to disable on shutdown: bluetooth, wifi, wwan.
1868 # (workaround for devices that are blocking shutdown).
1869 # Default: <none>
1870 #DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
1871
1872 # Radio devices to enable on shutdown: bluetooth, wifi, wwan.
1873 # (to prevent other operating systems from missing radios).
1874 # Default: <none>
1875 #DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
1876
1877 # Radio devices to enable on AC: bluetooth, wifi, wwan.
1878 # Default: <none>
1879 #DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
1880
1881 # Radio devices to disable on battery: bluetooth, wifi, wwan.
1882 # Default: <none>
1883 #DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
1884 DEVICES_TO_DISABLE_ON_BAT="bluetooth"
1885
1886 # Radio devices to disable on battery when not in use (not connected):
1887 # bluetooth, wifi, wwan.
1888 # Default: <none>
1889 #DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
1890
1891 # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
1892 # required). Charging starts when the remaining capacity falls below the
1893 # START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
1894 # Main / Internal battery (values in %)
1895 # Default: <none>
1896 #START_CHARGE_THRESH_BAT0=75
1897 #STOP_CHARGE_THRESH_BAT0=80
1898 # Ultrabay / Slice / Replaceable battery (values in %)
1899 # Default: <none>
1900 #START_CHARGE_THRESH_BAT1=75
1901 #STOP_CHARGE_THRESH_BAT1=80
1902
1903 # Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
1904 # Default: 0
1905 #RESTORE_THRESHOLDS_ON_BAT=1
1906
1907 # Battery feature drivers: 0=disable, 1=enable
1908 # Default: 1 (all)
1909 NATACPI_ENABLE=1
1910 TPACPI_ENABLE=1
1911 TPSMAPI_ENABLE=1
1912
1913 # ------------------------------------------------------------------------------
1914 # tlp-rdw - Parameters for the radio device wizard
1915 # Possible devices: bluetooth, wifi, wwan.
1916
1917 # Notes:
1918 # - Parameters are disabled by default, remove the leading # to enable them
1919 # - Separate multiple radio devices with spaces
1920
1921 # Default: <none> (for all parameters below)
1922
1923 # Radio devices to disable on connect.
1924 #DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
1925 #DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
1926 #DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
1927
1928 # Radio devices to enable on disconnect.
1929 #DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
1930 #DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
1931 #DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
1932
1933 # Radio devices to enable/disable when docked.
1934 #DEVICES_TO_ENABLE_ON_DOCK=""
1935 #DEVICES_TO_DISABLE_ON_DOCK=""
1936
1937 # Radio devices to enable/disable when undocked.
1938 #DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
1939 #DEVICES_TO_DISABLE_ON_UNDOCK=""
1940 #+end_src
1941
1942 *** shemshak
1943
1944 #+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "shemshak")) "/sudo::/etc/default/tlp")
1945 # ------------------------------------------------------------------------------
1946 # tlp - Parameters for power saving
1947 # See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
1948
1949 # Hint: some features are disabled by default, remove the leading # to enable
1950 # them.
1951
1952 # Set to 0 to disable, 1 to enable TLP.
1953 TLP_ENABLE=1
1954
1955 # Operation mode when no power supply can be detected: AC, BAT.
1956 # Concerns some desktop and embedded hardware only.
1957 TLP_DEFAULT_MODE=AC
1958
1959 # Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
1960 # Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
1961 TLP_PERSISTENT_DEFAULT=0
1962
1963 # Seconds laptop mode has to wait after the disk goes idle before doing a sync.
1964 # Non-zero value enables, zero disables laptop mode.
1965 DISK_IDLE_SECS_ON_AC=0
1966 DISK_IDLE_SECS_ON_BAT=2
1967
1968 # Dirty page values (timeouts in secs).
1969 MAX_LOST_WORK_SECS_ON_AC=15
1970 MAX_LOST_WORK_SECS_ON_BAT=60
1971
1972 # Hint: CPU parameters below are disabled by default, remove the leading #
1973 # to enable them, otherwise kernel default values are used.
1974
1975 # Select a CPU frequency scaling governor.
1976 # Intel Core i processor with intel_pstate driver:
1977 # powersave(*), performance.
1978 # Older hardware with acpi-cpufreq driver:
1979 # ondemand(*), powersave, performance, conservative, schedutil.
1980 # (*) is recommended.
1981 # Hint: use tlp-stat -p to show the active driver and available governors.
1982 # Important:
1983 # powersave for intel_pstate and ondemand for acpi-cpufreq are power
1984 # efficient for *almost all* workloads and therefore kernel and most
1985 # distributions have chosen them as defaults. If you still want to change,
1986 # you should know what you're doing! You *must* disable your distribution's
1987 # governor settings or conflicts will occur.
1988 #CPU_SCALING_GOVERNOR_ON_AC=powersave
1989 #CPU_SCALING_GOVERNOR_ON_BAT=powersave
1990
1991 # Set the min/max frequency available for the scaling governor.
1992 # Possible values strongly depend on your CPU. For available frequencies see
1993 # the output of tlp-stat -p.
1994 #CPU_SCALING_MIN_FREQ_ON_AC=0
1995 #CPU_SCALING_MAX_FREQ_ON_AC=0
1996 #CPU_SCALING_MIN_FREQ_ON_BAT=0
1997 #CPU_SCALING_MAX_FREQ_ON_BAT=0
1998
1999 # Set energy performance hints (HWP) for Intel P-state governor:
2000 # performance, balance_performance, default, balance_power, power
2001 # Values are given in order of increasing power saving.
2002 # Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
2003 CPU_HWP_ON_AC=balance_performance
2004 CPU_HWP_ON_BAT=balance_power
2005
2006 # Set Intel P-state performance: 0..100 (%).
2007 # Limit the max/min P-state to control the power dissipation of the CPU.
2008 # Values are stated as a percentage of the available performance.
2009 # Requires an Intel Core i processor with intel_pstate driver.
2010 #CPU_MIN_PERF_ON_AC=0
2011 #CPU_MAX_PERF_ON_AC=100
2012 #CPU_MIN_PERF_ON_BAT=0
2013 #CPU_MAX_PERF_ON_BAT=30
2014
2015 # Set the CPU "turbo boost" feature: 0=disable, 1=allow
2016 # Requires an Intel Core i processor.
2017 # Important:
2018 # - This may conflict with your distribution's governor settings
2019 # - A value of 1 does *not* activate boosting, it just allows it
2020 #CPU_BOOST_ON_AC=1
2021 #CPU_BOOST_ON_BAT=0
2022
2023 # Minimize number of used CPU cores/hyper-threads under light load conditions:
2024 # 0=disable, 1=enable.
2025 SCHED_POWERSAVE_ON_AC=0
2026 SCHED_POWERSAVE_ON_BAT=1
2027
2028 # Kernel NMI Watchdog:
2029 # 0=disable (default, saves power), 1=enable (for kernel debugging only).
2030 NMI_WATCHDOG=0
2031
2032 # Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
2033 # Frequency voltage pairs are written to:
2034 # /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
2035 # CAUTION: only use this, if you thoroughly understand what you are doing!
2036 #PHC_CONTROLS="F:V F:V F:V F:V"
2037
2038 # Set CPU performance versus energy savings policy:
2039 # performance, balance-performance, default, balance-power, power.
2040 # Values are given in order of increasing power saving.
2041 # Requires kernel module msr and x86_energy_perf_policy from linux-tools.
2042 ENERGY_PERF_POLICY_ON_AC=performance
2043 ENERGY_PERF_POLICY_ON_BAT=balance-power
2044
2045 # Disk devices; separate multiple devices with spaces (default: sda).
2046 # Devices can be specified by disk ID also (lookup with: tlp diskid).
2047 DISK_DEVICES="sda sdb"
2048
2049 # Disk advanced power management level: 1..254, 255 (max saving, min, off).
2050 # Levels 1..127 may spin down the disk; 255 allowable on most drives.
2051 # Separate values for multiple disks with spaces. Use the special value 'keep'
2052 # to keep the hardware default for the particular disk.
2053 DISK_APM_LEVEL_ON_AC="254 254"
2054 DISK_APM_LEVEL_ON_BAT="128 128"
2055
2056 # Hard disk spin down timeout:
2057 # 0: spin down disabled
2058 # 1..240: timeouts from 5s to 20min (in units of 5s)
2059 # 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
2060 # See 'man hdparm' for details.
2061 # Separate values for multiple disks with spaces. Use the special value 'keep'
2062 # to keep the hardware default for the particular disk.
2063 #DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
2064 #DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
2065
2066 # Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
2067 # Separate values for multiple disks with spaces. Use the special value 'keep'
2068 # to keep the kernel default scheduler for the particular disk.
2069 #DISK_IOSCHED="cfq cfq"
2070
2071 # AHCI link power management (ALPM) for disk devices:
2072 # min_power, med_power_with_dipm(*), medium_power, max_performance.
2073 # (*) Kernel >= 4.15 required, then recommended.
2074 # Multiple values separated with spaces are tried sequentially until success.
2075 SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
2076 SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
2077
2078 # Exclude host devices from AHCI link power management.
2079 # Separate multiple hosts with spaces.
2080 #SATA_LINKPWR_BLACKLIST="host1"
2081
2082 # Runtime Power Management for AHCI host and disks devices:
2083 # on=disable, auto=enable.
2084 # EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
2085 #AHCI_RUNTIME_PM_ON_AC=on
2086 #AHCI_RUNTIME_PM_ON_BAT=on
2087
2088 # Seconds of inactivity before disk is suspended.
2089 AHCI_RUNTIME_PM_TIMEOUT=15
2090
2091 # PCI Express Active State Power Management (PCIe ASPM):
2092 # default, performance, powersave.
2093 PCIE_ASPM_ON_AC=performance
2094 PCIE_ASPM_ON_BAT=powersave
2095
2096 # Radeon graphics clock speed (profile method): low, mid, high, auto, default;
2097 # auto = mid on BAT, high on AC; default = use hardware defaults.
2098 RADEON_POWER_PROFILE_ON_AC=high
2099 RADEON_POWER_PROFILE_ON_BAT=low
2100
2101 # Radeon dynamic power management method (DPM): battery, performance.
2102 RADEON_DPM_STATE_ON_AC=performance
2103 RADEON_DPM_STATE_ON_BAT=battery
2104
2105 # Radeon DPM performance level: auto, low, high; auto is recommended.
2106 RADEON_DPM_PERF_LEVEL_ON_AC=auto
2107 RADEON_DPM_PERF_LEVEL_ON_BAT=auto
2108
2109 # WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
2110 WIFI_PWR_ON_AC=off
2111 WIFI_PWR_ON_BAT=on
2112
2113 # Disable wake on LAN: Y/N.
2114 WOL_DISABLE=Y
2115
2116 # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
2117 # A value of 0 disables, >=1 enables power saving (recommended: 1).
2118 SOUND_POWER_SAVE_ON_AC=0
2119 SOUND_POWER_SAVE_ON_BAT=0
2120
2121 # Disable controller too (HDA only): Y/N.
2122 SOUND_POWER_SAVE_CONTROLLER=N
2123
2124 # Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
2125 # Drive can be powered on again by releasing (and reinserting) the eject lever
2126 # or by pressing the disc eject button on newer models.
2127 # Note: an UltraBay/MediaBay hard disk is never powered off.
2128 BAY_POWEROFF_ON_AC=0
2129 BAY_POWEROFF_ON_BAT=0
2130 # Optical drive device to power off (default sr0).
2131 BAY_DEVICE="sr0"
2132
2133 # Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
2134 RUNTIME_PM_ON_AC=on
2135 RUNTIME_PM_ON_BAT=auto
2136
2137 # Exclude PCI(e) device adresses the following list from Runtime PM
2138 # (separate with spaces). Use lspci to get the adresses (1st column).
2139 #RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
2140 RUNTIME_PM_BLACKLIST="01:00.0"
2141
2142 # Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
2143 # Default when unconfigured is "amdgpu nouveau nvidia radeon" which
2144 # prevents accidential power-on of dGPU in hybrid graphics setups.
2145 # Use "" to disable the feature completely.
2146 # Separate multiple drivers with spaces.
2147 #RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"
2148
2149 # Set to 0 to disable, 1 to enable USB autosuspend feature.
2150 USB_AUTOSUSPEND=1
2151
2152 # Exclude listed devices from USB autosuspend (separate with spaces).
2153 # Use lsusb to get the ids.
2154 # Note: input devices (usbhid) are excluded automatically
2155 #USB_BLACKLIST="1111:2222 3333:4444"
2156
2157 # Bluetooth devices are excluded from USB autosuspend:
2158 # 0=do not exclude, 1=exclude.
2159 USB_BLACKLIST_BTUSB=0
2160
2161 # Phone devices are excluded from USB autosuspend:
2162 # 0=do not exclude, 1=exclude (enable charging).
2163 USB_BLACKLIST_PHONE=0
2164
2165 # Printers are excluded from USB autosuspend:
2166 # 0=do not exclude, 1=exclude.
2167 USB_BLACKLIST_PRINTER=1
2168
2169 # WWAN devices are excluded from USB autosuspend:
2170 # 0=do not exclude, 1=exclude.
2171 USB_BLACKLIST_WWAN=1
2172
2173 # Include listed devices into USB autosuspend even if already excluded
2174 # by the blacklists above (separate with spaces).
2175 # Use lsusb to get the ids.
2176 #USB_WHITELIST="1111:2222 3333:4444"
2177
2178 # Set to 1 to disable autosuspend before shutdown, 0 to do nothing
2179 # (workaround for USB devices that cause shutdown problems).
2180 #USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
2181
2182 # Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
2183 # on system startup: 0=disable, 1=enable.
2184 # Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
2185 # are ignored when this is enabled!
2186 #RESTORE_DEVICE_STATE_ON_STARTUP=0
2187 RESTORE_DEVICE_STATE_ON_STARTUP=1
2188
2189 # Radio devices to disable on startup: bluetooth, wifi, wwan.
2190 # Separate multiple devices with spaces.
2191 #DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
2192
2193 # Radio devices to enable on startup: bluetooth, wifi, wwan.
2194 # Separate multiple devices with spaces.
2195 #DEVICES_TO_ENABLE_ON_STARTUP="wifi"
2196
2197 # Radio devices to disable on shutdown: bluetooth, wifi, wwan.
2198 # (workaround for devices that are blocking shutdown).
2199 #DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
2200
2201 # Radio devices to enable on shutdown: bluetooth, wifi, wwan.
2202 # (to prevent other operating systems from missing radios).
2203 #DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
2204
2205 # Radio devices to enable on AC: bluetooth, wifi, wwan.
2206 #DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
2207
2208 # Radio devices to disable on battery: bluetooth, wifi, wwan.
2209 #DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
2210
2211 # Radio devices to disable on battery when not in use (not connected):
2212 # bluetooth, wifi, wwan.
2213 #DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
2214
2215 # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
2216 # required). Charging starts when the remaining capacity falls below the
2217 # START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
2218 # Main / Internal battery (values in %)
2219 #START_CHARGE_THRESH_BAT0=75
2220 #STOP_CHARGE_THRESH_BAT0=80
2221 # Ultrabay / Slice / Replaceable battery (values in %)
2222 #START_CHARGE_THRESH_BAT1=75
2223 #STOP_CHARGE_THRESH_BAT1=80
2224
2225 # Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
2226 #RESTORE_THRESHOLDS_ON_BAT=1
2227
2228 # ------------------------------------------------------------------------------
2229 # tlp-rdw - Parameters for the radio device wizard
2230 # Possible devices: bluetooth, wifi, wwan.
2231
2232 # Hints:
2233 # - Parameters are disabled by default, remove the leading # to enable them
2234 # - Separate multiple radio devices with spaces
2235
2236 # Radio devices to disable on connect.
2237 #DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
2238 #DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
2239 #DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
2240
2241 # Radio devices to enable on disconnect.
2242 #DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
2243 #DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
2244 #DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
2245
2246 # Radio devices to enable/disable when docked.
2247 #DEVICES_TO_ENABLE_ON_DOCK=""
2248 #DEVICES_TO_DISABLE_ON_DOCK=""
2249
2250 # Radio devices to enable/disable when undocked.
2251 #DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
2252 #DEVICES_TO_DISABLE_ON_UNDOCK=""
2253 #+end_src
2254
2255 ** X
2256
2257 *** xprofile
2258 :PROPERTIES:
2259 :header-args+: :tangle ~/.xprofile
2260 :END:
2261
2262 =~/.xprofile= is similar in style to =~/.xinitrc=, but on the
2263 contrary, it's automatically sourced by LightDM, my display manager of
2264 choice.
2265
2266 #+begin_src sh :tangle no
2267 xset -b # disable bell
2268 xset r rate 200 45 # repeat delay (ms) and rate (repeats/sec)
2269
2270 # setxkbmap -option compose:ralt
2271
2272 setxkbmap -option ctrl:nocaps # turn capslock into control
2273 setxkbmap -option altwin:swap_alt_win # swap alt and super
2274
2275 if [ $(hostname) = "plasma" ]
2276 then
2277 setxkbmap -option ctrl:rctrl_ralt # turn right control into right alt
2278 fi
2279
2280 if [ $(hostname) = "enigma" ]
2281 then
2282 xmodmap -e "keycode 135 = Alt_R" # remap menu key to alt
2283 fi
2284
2285 light -Scrs "intel_backlight" 2
2286
2287 source $HOME/.zprofile
2288
2289 export _JAVA_AWT_WM_NONREPARENTING=1
2290 export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
2291
2292 if [ $(hostname) = "plasma" ]
2293 then
2294 unlock-def-gk.py &
2295 fi
2296
2297 bspwm &
2298 #+end_src
2299
2300 *** xkb us_ab keyboard layout
2301
2302 #+begin_src conf :tangle "/sudo::/usr/share/X11/xkb/symbols/us_ab" :comments none
2303 default partial alphanumeric_keys
2304 xkb_symbols "us_ab" {
2305 include "us(basic)"
2306 name[Group1]= "English (US)(aminb)";
2307
2308 key <MENU> { [ Alt_R ] };
2309 };
2310 #+end_src
2311
2312 ** Zsh
2313
2314 My zsh setup is built on [[https://github.com/zimfw/zimfw][Zim]]. Further, my zshrc references [[https://github.com/junegunn/fzf][fzf]],
2315 [[https://github.com/zsh-users/zsh-autosuggestions][zsh-autosuggestions]], and [[https://github.com/hlissner/zsh-autopair][zsh-autopair]]; so be sure to have them
2316 installed.
2317
2318 *** zimrc
2319 :PROPERTIES:
2320 :header-args+: :tangle ~/.zimrc
2321 :END:
2322
2323 #+begin_src sh
2324 #################
2325 # CORE SETTINGS #
2326 #################
2327
2328 #
2329 # Zim settings
2330 #
2331
2332 # Select what modules you would like enabled.
2333 # The second line of modules may depend on options set by modules in the first
2334 # line. These dependencies are noted on the respective module's README.md.
2335 zmodules=(directory environment git git-info history input ssh utility custom \
2336 syntax-highlighting history-substring-search prompt completion)
2337
2338
2339 ###################
2340 # MODULE SETTINGS #
2341 ###################
2342
2343 #
2344 # Prompt
2345 #
2346
2347 # Set your desired prompt here
2348 zprompt_theme='pure'
2349 #PURE_PROMPT_SYMBOL=λ
2350 #PURE_PROMPT_SYMBOL=δ
2351 PURE_PROMPT_SYMBOL=➜
2352
2353 #
2354 # Completion
2355 #
2356
2357 # set an optional host-specific filename for the completion cache file
2358 # if none is provided, the default '.zcompdump' is used.
2359 #zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}"
2360
2361 #
2362 # Utility
2363 #
2364
2365 # Uncomment to enable command correction prompts
2366 # See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput
2367 setopt CORRECT
2368
2369 #
2370 # Environment
2371 #
2372
2373 # Set the string below to the desired terminal title format string.
2374 # The terminal title is redrawn upon directory change, however, variables like
2375 # ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data:
2376 # http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
2377 # The example below uses the following format: 'username@host:/current/directory'
2378 ztermtitle='%n@%m:%~'
2379
2380 #
2381 # Input
2382 #
2383
2384 # Uncomment to enable double-dot expansion.
2385 # This appends '../' to your input for each '.' you type after an initial '..'
2386 #zdouble_dot_expand='true'
2387
2388 #
2389 # Syntax-Highlighting
2390 #
2391
2392 # This determines what highlighters will be used with the syntax-highlighting module.
2393 # Documentation of the highlighters can be found here:
2394 # https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
2395 # For (u)rxvt, termite and gnome-terminal users,
2396 # removing the 'cursor' highlighter will fix the disappearing cursor problem
2397 #zhighlighters=(main brackets cursor)
2398 zhighlighters=(main brackets pattern)
2399
2400 #
2401 # SSH
2402 #
2403
2404 # Load these ssh identities with the ssh module
2405 zssh_ids=(id_ed25519_bandali)
2406
2407 #
2408 # Pacman
2409 #
2410
2411 # Set (optional) pacman front-end.
2412 zpacman_frontend='yay'
2413
2414 # Load any helper scripts as defined here
2415 #zpacman_helper=(aur)
2416
2417
2418 #+end_src
2419
2420 *** zlogin
2421 :PROPERTIES:
2422 :header-args+: :tangle ~/.zlogin
2423 :END:
2424
2425 #+begin_src sh
2426 #
2427 # User configuration sourced by login shells
2428 #
2429
2430 # Initialize zim
2431 [[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh
2432
2433 #+end_src
2434
2435 *** zprofile
2436 :PROPERTIES:
2437 :header-args+: :tangle ~/.zprofile
2438 :END:
2439
2440 #+begin_src sh
2441 #PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
2442 #PATH=$HOME/.gem/ruby/2.4.0/bin:$PATH
2443 export PATH=$HOME/.local/bin:$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH
2444 export XDG_CONFIG_HOME=$HOME/.config
2445 export XDG_DATA_HOME=$HOME/.local/share
2446 export XDG_DATA_DIRS=/usr/local/share:/usr/share
2447 export MAILDIR="$HOME/mail"
2448 export CVS_RSH=ssh
2449 #export MATHMODELS=$HOME/src/eiffel/mathmodels
2450 #export RUST_SRC_PATH=~/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src
2451 #export PATH=$PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/
2452
2453 # Eiffel2Java stuff
2454 #export JAVA_HOME=/usr/lib/jvm/default
2455 #export CPATH=$CPATH:"$JAVA_HOME/include:$JAVA_HOME/include/linux"
2456 #export LIBRARY_PATH=$LIBRARY_PATH:"$JAVA_HOME/jre/lib/amd64/server"
2457 #export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$JAVA_HOME/jre/lib/amd64/server"
2458
2459 #export PATH="$HOME/usr/build/pvs:$PATH"
2460 #export SBCLISP_HOME=/usr/share/sbcl-source
2461 #export PVS_LIBRARY_PATH="$HOME/usr/build/pvs/nasalib"
2462
2463 export MOZ_USE_XINPUT2=1 # precise scrolling in firefox
2464
2465 #export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
2466 #export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
2467
2468 export NIXPKGS=$HOME/src/git/nixpkgs
2469
2470 if [ -e /home/amin/.nix-profile/etc/profile.d/nix.sh ]; then . /home/amin/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
2471
2472 export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
2473 export PATH="/$HOME/.config/guix/current/bin${PATH:+:}$PATH"
2474 export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
2475 export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
2476 export GIT_SSL_CAINFO="$SSL_CERT_FILE"
2477 #+end_src
2478
2479 *** zshenv
2480 :PROPERTIES:
2481 :header-args+: :tangle ~/.zshenv
2482 :END:
2483
2484 #+begin_src sh
2485 # Ensure that a non-login, non-interactive shell has a defined environment.
2486 if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
2487 source "${ZDOTDIR:-$HOME}/.zprofile"
2488 fi
2489 #+end_src
2490
2491 *** zshrc
2492 :PROPERTIES:
2493 :header-args+: :tangle ~/.zshrc
2494 :END:
2495
2496 #+begin_src sh
2497 # Bash-like navigation
2498 #export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
2499 #export WORDCHARS='*?-[]~=&;!#$%^(){}<>'
2500 export WORDCHARS='*?[]~=&;!#$%^(){}<>'
2501 #ZLE_SPACE_SUFFIX_CHARS=$'|&'
2502
2503 #disable -r time # disable shell reserved word
2504 #alias time='time -p' # -p for POSIX output
2505
2506 # rehash if last command was pacaur or pacman
2507 # (so that zsh picks up changes in $PATH immediately)
2508 TRAPUSR1() { rehash}; precmd() { [[ $history[$[ HISTCMD -1 ]] == *(pacaur|pacman)* ]] && killall -USR1 zsh }
2509
2510 #
2511 # User configuration sourced by interactive shells
2512 #
2513
2514 # Define zim location
2515 export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
2516
2517 # Start zim
2518 [[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
2519
2520 ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
2521 #ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold'
2522
2523 setopt globdots
2524
2525 source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
2526 # source ~/.zsh/zsh-autopair/autopair.zsh
2527
2528
2529 ### fzf ###
2530
2531 source /usr/share/fzf/key-bindings.zsh
2532 source /usr/share/fzf/completion.zsh
2533
2534 # Accept history selection instead of putting it on
2535 # the command line
2536 fzf-history-widget-accept() {
2537 fzf-history-widget
2538 zle accept-line
2539 }
2540 #zle -N fzf-history-widget-accept
2541 #bindkey '^R' fzf-history-widget-accept
2542
2543 # alt+c preview
2544 export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
2545
2546 ### fzf ###
2547
2548
2549 # aliases
2550 alias mpv="mpv --ytdl-format mp4"
2551 alias mv="mv -iv"
2552 alias cp="cp -iv"
2553 alias scl=systemctl
2554 alias jcl=journalctl
2555 alias m="mbsync csclub; mbsync uwaterloo; mbsync amin"
2556 alias best="youtube-dl -f best"
2557 alias sd="ssh deb"
2558 alias sf="ssh fp"
2559 alias sn="ssh nix"
2560
2561 aur() {
2562 cd ~/usr/build
2563 git clone https://aur.archlinux.org/${1}.git
2564 cd ${1}
2565 }
2566
2567 # i-beam cursor
2568 echo -e "\033[5 q"
2569 #echo -e "\033[6 q"
2570
2571 #+end_src
2572
2573 * Scripts
2574
2575 This section contains various useful scripts and the ones used by the
2576 programs above. For instance, =toggle-tablet= for switching to and
2577 from tablet mode on my X220T, =toggle-presentation-mode= for toggling
2578 Xfce's presentation mode which keeps the screen awake, and
2579 =rofi-light= a small utility that uses [[https://github.com/DaveDavenport/rofi][Rofi]] to ask and [[https://github.com/haikarainen/light][light]] to set an
2580 exact brightness value.
2581
2582 ** battery-percentage-time
2583 :PROPERTIES:
2584 :header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh"
2585 :END:
2586
2587 #+begin_src sh :tangle no
2588 dbus_send() {
2589 label=$1
2590 dbus-send --print-reply=literal --system \
2591 --dest=org.freedesktop.UPower \
2592 /org/freedesktop/UPower/devices/battery_BAT0 \
2593 org.freedesktop.DBus.Properties.Get \
2594 string:org.freedesktop.UPower.Device \
2595 string:"${label}" | awk '{print $3}'
2596 }
2597
2598 perc=$(dbus_send 'Percentage')
2599 state=$(dbus_send 'State')
2600
2601 if [ "$state" -eq 2 ]; then # Discharging
2602 secs=$(dbus_send 'TimeToEmpty')
2603 elif [ "$state" -eq 1 ]; then # Charging
2604 secs=$(dbus_send 'TimeToFull')
2605 fi
2606
2607 printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
2608 #+end_src
2609
2610 ** my-i3status.py
2611 :PROPERTIES:
2612 :header-args+: :tangle ~/.local/bin/my-i3status.py :shebang "#!/usr/bin/env python2"
2613 :END:
2614
2615 #+begin_src python :comments none
2616 # -*- coding: utf-8 -*-
2617
2618 # This script is a simple wrapper which prefixes each i3status line with custom
2619 # information. It is based on:
2620 # https://github.com/i3/i3status/blob/master/contrib/wrapper.py
2621 #
2622 # In ~/.i3status.conf, add the following line:
2623 # output_format = "i3bar"
2624 # in the 'general' section.
2625 # Then, in ~/.config/i3/config or ~/.config/sway/config add:
2626 # status_command i3status | my-i3status.py
2627 # in the 'bar' section. Make sure my-i3status.py is in $PATH.
2628 #
2629 # © 2012 Valentin Haenel <valentin.haenel@gmx.de>
2630 # © 2018 Amin Bandali <bandali@gnu.org>
2631 #
2632 # This program is free software. It comes without any warranty, to the extent
2633 # permitted by applicable law. You can redistribute it and/or modify it under
2634 # the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
2635 # 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
2636 # details.
2637
2638 import sys
2639 import json
2640 import os
2641
2642 def get_nosleep():
2643 """ Return true if ~/.nosleep exists. """
2644 return os.path.isfile(os.path.expanduser("~/.nosleep"))
2645
2646 def print_line(message):
2647 """ Non-buffered printing to stdout. """
2648 sys.stdout.write(message + '\n')
2649 sys.stdout.flush()
2650
2651 def read_line():
2652 """ Interrupted respecting reader for stdin. """
2653 # try reading a line, removing any extra whitespace
2654 try:
2655 line = sys.stdin.readline().strip()
2656 # i3status sends EOF, or an empty line
2657 if not line:
2658 sys.exit(3)
2659 return line
2660 # exit on ctrl-c
2661 except KeyboardInterrupt:
2662 sys.exit()
2663
2664 if __name__ == '__main__':
2665 # Skip the first line which contains the version header.
2666 print_line(read_line())
2667
2668 # The second line contains the start of the infinite array.
2669 print_line(read_line())
2670
2671 while True:
2672 line, prefix = read_line(), ''
2673 # ignore comma at start of lines
2674 if line.startswith(','):
2675 line, prefix = line[1:], ','
2676
2677 if get_nosleep():
2678 j = json.loads(line)
2679 # insert information into the start of the json, but could be anywhere
2680 j.insert(0, {'full_text' : '•', 'name' : 'nosleep'})
2681 # and echo back new encoded json
2682 print_line(prefix+json.dumps(j))
2683 else:
2684 print_line(prefix+line)
2685 #+end_src
2686
2687 ** rofi-light
2688 :PROPERTIES:
2689 :header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/bash"
2690 :END:
2691
2692 #+begin_src bash
2693 cur=$(light -G)
2694 val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12)
2695 [ -n "$val" ] && light -S $val
2696 #+end_src
2697
2698 ** rofi-remmina.py
2699 :PROPERTIES:
2700 :header-args+: :tangle ~/.local/bin/rofi-remmina.py :shebang "#!/usr/bin/env python2"
2701 :END:
2702
2703 #+begin_src python
2704 import ConfigParser
2705 import os
2706 from subprocess import Popen, PIPE
2707
2708 remmina_dir = os.path.expanduser("~/.local/share/remmina")
2709
2710 fdict = dict()
2711
2712 for f in os.listdir(remmina_dir):
2713 fp = os.path.join(remmina_dir, f)
2714 c = ConfigParser.ConfigParser()
2715 c.read(fp)
2716 n = c.get('remmina', 'name')
2717 fdict[n] = fp
2718
2719 lines = max(min(15, len(fdict)), 1);
2720 width = len(max(fdict.keys(), key=len))
2721 rofi = Popen(["rofi", "-i", "-dmenu", \
2722 "-l", str(lines), "-width", str(width), \
2723 "-p", "connection"], stdout=PIPE, stdin=PIPE)
2724 selected = rofi.communicate("\n" \
2725 .join(fdict.keys()) \
2726 .encode("utf-8"))[0] \
2727 .decode("utf-8") \
2728 .strip()
2729 rofi.wait()
2730
2731 r = Popen(["remmina", "-c", fdict[selected]])
2732 r.wait()
2733 #+end_src
2734
2735 ** s (run sway)
2736 :PROPERTIES:
2737 :header-args+: :tangle ~/.local/bin/s :shebang "#!/bin/bash"
2738 :END:
2739
2740 #+begin_src bash
2741 export _JAVA_AWT_WM_NONREPARENTING=1
2742 export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
2743 light -Nr 2
2744 source $HOME/.zprofile
2745 sway
2746 #+end_src
2747
2748 ** sway-ws-util
2749 :PROPERTIES:
2750 :header-args+: :tangle ~/.local/bin/sway-ws-util :shebang "#!/bin/bash"
2751 :END:
2752
2753 #+begin_src bash
2754 curr_ws=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true).name')
2755 [[ $curr_ws -eq 1 ]] && prev_ws=10 || prev_ws=$((curr_ws-1))
2756 [[ $curr_ws -eq 10 ]] && next_ws=1 || next_ws=$((curr_ws+1))
2757 dest_ws=-1
2758 op=-1
2759
2760 if [ "$1" = "switch" ] || [ "$1" = "move" ]; then
2761 op="$1"
2762 if [ "$2" = "prev" ]; then
2763 dest_ws="$prev_ws"
2764 elif [ "$2" = "next" ]; then
2765 dest_ws="$next_ws"
2766 else
2767 echo "Usage: $0 $1 {prev|next} [follow]"
2768 exit 1
2769 fi
2770 else
2771 echo "Usage: $0 {switch|move} {prev|next} [follow]"
2772 exit 1
2773 fi
2774
2775 if [ "$op" = "switch" ]; then
2776 sway workspace "$dest_ws"
2777 elif [ "$op" = "move" ]; then
2778 sway move container to workspace "$dest_ws"
2779 if [ "$3" = "follow" ]; then
2780 sway workspace "$dest_ws"
2781 fi
2782 fi
2783 #+end_src
2784
2785 ** toggle-presentation-mode
2786 :PROPERTIES:
2787 :header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/bash"
2788 :END:
2789
2790 #+begin_src bash :tangle no
2791 xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
2792 #+end_src
2793
2794 ** toggle-tablet
2795 :PROPERTIES:
2796 :header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/bash"
2797 :END:
2798
2799 This script toggles between a 'normal' mode and a 'tablet' mode, doing
2800 a few things:
2801
2802 - rotates the screen using =xrandr=, so that rotating the physical
2803 display of my X220t would have the laptop's battery on the right
2804 hand side,
2805 - enables touch screen,
2806 - properly rotates the stylus pen and touch screen pointers, and
2807 - toggles between RGB and Vertical BGR sub-pixel order.
2808
2809 #+begin_src bash :tangle no
2810 case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
2811 0) # Screen is not rotated, we should rotate it right (90°)
2812 xrandr -o 3
2813 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
2814 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
2815 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
2816 xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
2817 ;;
2818 1) # Currently top is rotated right, we should set it normal (0°)
2819 xrandr -o 0
2820 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
2821 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
2822 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
2823 xfconf-query -c xsettings -p /Xft/RGBA -s rgb
2824 ;;
2825 *)
2826 echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
2827 exit 1
2828 ;;
2829 esac
2830 #+end_src
2831
2832 ** volume-info
2833 :PROPERTIES:
2834 :header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
2835 :END:
2836
2837 #+begin_src sh :tangle no
2838 cur_vol=$(pamixer --get-volume)
2839
2840 if [ $(pamixer --get-mute) = true ]; then
2841 printf 'mt \n' "$cur_vol"
2842 else
2843 printf '%02d \n' "$cur_vol"
2844 fi
2845 #+end_src
2846
2847 ** zathura-sync.sh
2848 :PROPERTIES:
2849 :header-args+: :tangle ~/.local/bin/zathura-sync.sh :shebang "#!/bin/sh"
2850 :END:
2851
2852 #+begin_src sh
2853 pos="$1"
2854 pdffile="$2"
2855 zathura --synctex-forward "$pos" "$pdffile" || \
2856 (
2857 zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" &
2858 sleep 1; zathura --synctex-forward "$pos" "$pdffile" )
2859 #+end_src