move scripts from ~/.local/bin to rc.org
[~bandali/configs] / rc.org
... / ...
CommitLineData
1#+title: rc.org
2#+property: header-args :comments no :mkdirp yes :results silent
3
4* About
5
6This org file contains the configuration files of pretty much every
7program I use. The files are tangled (i.e. exported, or derived) from
8this file using =org-babel=.
9
10Note: This file is best viewed inside Emacs with org mode.
11
12* Configs
13
14This section contains the configuration files (dotfiles) of various
15programs I use besides GNU Emacs.
16
17** Fontconfig
18:PROPERTIES:
19:header-args+: :tangle ~/.config/fontconfig/fonts.conf
20:END:
21
22#+begin_src xml
23<?xml version="1.0"?>
24<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
25<fontconfig>
26 <match target="font">
27 <edit mode="assign" name="rgba">
28 <const>rgb</const>
29 </edit>
30 </match>
31 <match target="font">
32 <edit mode="assign" name="hinting">
33 <bool>true</bool>
34 </edit>
35 </match>
36 <match target="font">
37 <edit mode="assign" name="hintstyle">
38 <const>hintslight</const>
39 </edit>
40 </match>
41 <match target="font">
42 <edit mode="assign" name="antialias">
43 <bool>true</bool>
44 </edit>
45 </match>
46 <match target="font">
47 <edit mode="assign" name="lcdfilter">
48 <const>lcddefault</const>
49 </edit>
50 </match>
51 <dir>~/.fonts</dir>
52
53 <!-- Use Liberation Sans for Helvetica (instead of Nimbus Sans) -->
54 <alias binding="same">
55 <family>Helvetica</family>
56 <prefer>
57 <family>Liberation Sans</family>
58 </prefer>
59</alias>
60</fontconfig>
61#+end_src
62
63** getmail
64:PROPERTIES:
65:header-args+: :tangle ~/.config/getmail/getmailrc
66:END:
67
68#+begin_src conf
69[retriever]
70type = SimplePOP3SSLRetriever
71server = fencepost.gnu.org
72username = bandali
73password_command = ("gpg", "--no-tty", "-q", "-d", "/home/bandali/.passwd/gnu.gpg")
74port = 995
75use_apop = True
76
77[destination]
78type = Maildir
79path = ~/mail/gnu.local/bandali/mail/
80
81# [destination]
82# type = MDA_external
83# path = /usr/lib/dovecot/deliver
84# arguments = ('-e', '-f', '%(sender)', '-d', 'bandali@gnu.local')
85
86[options]
87read_all = false
88delete_after = 1
89# delete = true
90received = false
91delivered_to = false
92#+end_src
93
94** Git
95
96*** config
97:PROPERTIES:
98:header-args+: :tangle ~/.config/git/config
99:END:
100
101#+begin_src conf
102[user]
103 name = Amin Bandali
104 email = bandali@gnu.org
105 signingkey = BE6273738E616D6D1B3A08E8A21A020248816103
106
107[commit]
108 gpgsign = true
109
110# [format]
111# signoff = true
112
113[core]
114 autocrlf = input # CRLF -> LF on commit
115 editor = emacsclient -t
116 pager = "less"
117
118[mailmap]
119 file = ~/.config/git/mailmap
120
121[alias]
122 git = !exec git # handle nested git calls, e.g. git git status
123 aliases = config --get-regexp '^alias\\.'
124 a = add
125 s = status
126 sl = status --long
127 c = checkout
128 cb = checkout -b
129 b = branch
130 r = rebase
131 p = pull
132 pr = pull --rebase
133 ps = push
134 psf = push --force
135 nmam = "!f() { notmuch show --format=raw $1 | git am -; }; f"
136 nmam3 = "!f() { notmuch show --format=raw $1 | git am -3 -; }; f"
137
138[color]
139 ui = auto
140[color "status"]
141 added = green bold
142 changed = red bold
143 untracked = red bold
144[color "branch"]
145 current = green bold
146 remote = magenta bold
147[color "diff"]
148 new = green bold
149 old = red bold
150
151# [status]
152# # showUntrackedFiles = all
153# short=true
154# branch=true
155
156[github]
157 user = notbandali
158
159[sendemail]
160 smtpuser = bandali
161 smtpserver = fencepost.gnu.org
162 smtpserverport = 587
163 smtpencryption = tls
164 annotate = yes
165
166[transfer]
167 fsckObjects = true
168#+end_src
169
170*** ignore
171:PROPERTIES:
172:header-args+: :tangle ~/.config/git/ignore
173:END:
174
175#+begin_src conf
176*.orig
177*.py[co]
178*.sublime-workspace
179*~
180.DS_Store
181*.elc
182*-autoloads.el
183TAGS
184#+end_src
185
186*** mailmap
187:PROPERTIES:
188:header-args+: :tangle ~/.config/git/mailmap
189:END:
190
191#+begin_src conf
192<bandali@gnu.org> <mab@gnu.org>
193<bandali@gnu.org> <amin@gnu.org>
194<bandali@gnu.org> <aminb@gnu.org>
195<bandali@gnu.org> <amin@aminb.org>
196<bandali@gnu.org> <me@aminb.org>
197#+end_src
198
199** GnuPG
200:PROPERTIES:
201:header-args+: :tangle ~/.gnupg/gpg-agent.conf
202:END:
203
204#+begin_src conf
205default-cache-ttl 43200
206max-cache-ttl 86400
207
208default-cache-ttl-ssh 43200
209max-cache-ttl-ssh 86400
210
211pinentry-program /home/bandali/.guix-profile/bin/pinentry-emacs
212allow-emacs-pinentry
213allow-loopback-pinentry
214#+end_src
215
216** GTK
217
218*** GTK+ 2
219:PROPERTIES:
220:header-args+: :tangle ~/.gtkrc-2.0
221:END:
222
223#+begin_src conf
224gtk-theme-name="Xfce"
225# gtk-icon-theme-name="elementary Xfce darker"
226gtk-font-name="Roboto 10"
227# gtk-font-name="Source Code Variable 10"
228gtk-menu-images=0
229# gtk-key-theme-name = "Emacs"
230#+end_src
231
232*** GTK+ 3
233:PROPERTIES:
234:header-args+: :tangle ~/.config/gtk-3.0/settings.ini
235:END:
236
237#+begin_src conf
238[Settings]
239gtk-icon-theme-name = Adwaita
240# gtk-theme-name = Adwaita
241
242gtk-theme-name = Xfce
243# gtk-theme-name = Arc-Darker
244# gtk-theme-name = Numix-ArchBlue
245
246gtk-font-name = Roboto 10
247# gtk-font-name = Source Code Variable Medium 10
248# gtk-key-theme-name = Emacs
249#+end_src
250
251** Guix
252
253*** Channels
254:PROPERTIES:
255:header-args+: :tangle ~/.config/guix/channels.scm
256:END:
257
258#+begin_src scheme
259(list (channel
260 (name 'guix) ; https://git.savannah.gnu.org/git/guix.git
261 (url "file:///home/bandali/src/git/guix"))
262 (channel
263 (name 'guix-bandali) ; https://git.sr.ht/~bandali/guix-bandali
264 (url "file:///home/bandali/src/git/guix-bandali")))
265#+end_src
266
267*** Profile manifests
268
269To install/update the packages of the default profile, use
270#+begin_example
271guix package -m $MY_GUIX_MANIFESTS/main.scm
272#+end_example
273and for other profiles, use
274#+begin_example
275guix package -m $MY_GUIX_MANIFESTS/name.scm -p $MY_GUIX_PROFILES/name/name
276#+end_example
277where =name= is the name of the profile (e.g. =doc=, =media=, ...).
278
279**** doc
280:PROPERTIES:
281:header-args+: :tangle ~/.config/guix/manifest/doc.scm
282:END:
283
284#+begin_src scheme
285(specifications->manifest
286 '("libreoffice"
287 "texlive-amsfonts"
288 "texlive-base"
289 "texlive-latex-listings"
290 ;; "texlive-palatino"
291 "texlive-xcolor"
292))
293#+end_src
294
295**** main
296:PROPERTIES:
297:header-args+: :tangle ~/.config/guix/manifest/main.scm
298:END:
299
300#+begin_src scheme
301(specifications->manifest
302 '("alsa-utils"
303 "bash-completion"
304 "cpufrequtils"
305 "cpupower"
306 "cvs"
307 "dunst"
308 "emacs"
309 "emacs-alert"
310 "emacs-amx"
311 "emacs-async"
312 "emacs-biblio-git"
313 "emacs-boxquote"
314 "emacs-company"
315 "emacs-company-ebdb"
316 "emacs-crux"
317 "emacs-dash"
318 "emacs-debbugs"
319 "emacs-diff-hl"
320 "emacs-dmenu"
321 "emacs-doom-themes"
322 "emacs-ebdb"
323 "emacs-emmet-mode"
324 ;; "emacs-emojify"
325 "emacs-erc-hl-nicks"
326 "emacs-erc-scrolltoplace"
327 "emacs-eshell-up"
328 "emacs-exec-path-from-shell"
329 "emacs-expand-region"
330 "emacs-exwm"
331 "emacs-exwm-edit"
332 "emacs-flycheck"
333 "emacs-geiser"
334 ;; "emacs-gnus-harvest"
335 "emacs-guix"
336 "emacs-helpful"
337 "emacs-hl-todo"
338 "emacs-ivy"
339 "emacs-magit"
340 "emacs-message-x"
341 "emacs-minions"
342 ;; "emacs-multi-term"
343 "emacs-multiple-cursors"
344 "emacs-mwim"
345 ;; "emacs-next"
346 ;; "emacs-next-delight"
347 "emacs-no-littering"
348 "emacs-org"
349 "emacs-org-contrib"
350 "emacs-org-ref"
351 "emacs-orgalist"
352 "emacs-page-break-lines"
353 "emacs-pass"
354 "emacs-pinentry"
355 "emacs-projectile"
356 "emacs-shrink-path-git"
357 "emacs-smart-mode-line"
358 "emacs-typo"
359 "emacs-unkillable-scratch"
360 "emacs-use-package"
361 "emacs-web-mode"
362 "emacs-which-key"
363 "emacs-yasnippet"
364 "emacs-znc-git"
365 "font-adobe-source-code-pro"
366 "font-gnu-freefont-ttf"
367 "font-google-roboto"
368 "font-liberation"
369 "font-linuxlibertine"
370 "font-sil-gentium"
371 "font-tex-gyre"
372 ;; "font-ubuntu"
373 "font-vazir"
374 "getmail"
375 "gettext"
376 "git"
377 "git:send-email"
378 "gnupg"
379 "guile"
380 "haunt"
381 "htop"
382 "hunspell"
383 "hunspell-dict-en-ca"
384 "hunspell-dict-en-us"
385 "isync"
386 "light"
387 "msmtp"
388 "ncdu"
389 "notmuch"
390 "openjdk"
391 "openssh"
392 "openssl"
393 "pass-otp"
394 "password-store"
395 "pasystray"
396 "pinentry-emacs"
397 "poppler" ; for 'pdffonts'
398 "rofi"
399 "rofi-pass"
400 "rsync"
401 "rxvt-unicode"
402 "screen"
403 "scrot"
404 "setxkbmap"
405 "strace"
406 "thinkfan"
407 "unzip"
408 "wget"
409 "xdg-user-dirs"
410 ;; "xkbcomp"
411 "xmodmap"
412 "xrdb"
413 "xset"
414 "xsetroot"))
415#+end_src
416
417**** media
418:PROPERTIES:
419:header-args+: :tangle ~/.config/guix/manifest/media.scm
420:END:
421
422#+begin_src scheme
423(specifications->manifest
424 '("audacity"
425 "gimp"
426 "inkscape"
427 "mpv"
428 "youtube-dl"))
429#+end_src
430
431**** web
432:PROPERTIES:
433:header-args+: :tangle ~/.config/guix/manifest/web.scm
434:END:
435
436#+begin_src scheme
437(specifications->manifest
438 '("icecat"
439 "rtv"))
440#+end_src
441
442*** Systems
443
444**** chaman
445:PROPERTIES:
446:header-args+: :tangle ~/.config/guix/system/chaman.scm
447:END:
448
449#+begin_src scheme
450(use-modules (gnu)
451 (gnu packages certs) ; for nss-certs
452 (gnu packages emacs-xyz) ; for exwm
453 (gnu packages linux)) ; for powertop
454(use-service-modules admin desktop mail networking pm ssh xorg)
455
456(operating-system
457 (host-name "chaman")
458 (locale "en_CA.utf8")
459 (timezone "Canada/Eastern")
460 (keyboard-layout
461 (keyboard-layout "us" "basic"))
462 (bootloader
463 (bootloader-configuration
464 (bootloader grub-bootloader)
465 (target "/dev/sda")
466 (keyboard-layout keyboard-layout)))
467 (mapped-devices
468 (list (mapped-device
469 (source
470 (uuid "283da85e-2c84-47e6-a8ca-20f4e8efb806"))
471 (target "groot")
472 (type luks-device-mapping))
473 (mapped-device
474 (source
475 (uuid "017ddebc-c2c3-4a0a-bda4-d47ec0bc67f0"))
476 (target "data")
477 (type luks-device-mapping))))
478 (file-systems
479 (cons* (file-system
480 (mount-point "/")
481 (device "/dev/mapper/groot")
482 (type "ext4")
483 (dependencies mapped-devices))
484 (file-system
485 (mount-point "/data")
486 (device "/dev/mapper/data")
487 (type "ext4")
488 (dependencies mapped-devices))
489 %base-file-systems))
490 (users
491 (cons* (user-account
492 (name "bandali")
493 (group "users")
494 (home-directory "/home/bandali")
495 (supplementary-groups
496 '("wheel" "netdev" "audio" "video")))
497 %base-user-accounts))
498 (packages
499 (cons* nss-certs
500 emacs-exwm
501 %base-packages))
502 (services
503 (cons*
504 (service xfce-desktop-service-type)
505 (set-xorg-configuration
506 (xorg-configuration
507 (keyboard-layout keyboard-layout)))
508 (dovecot-service
509 #:config
510 (dovecot-configuration
511 ;; (log-path "/dev/stderr")
512 (protocols (list (protocol-configuration
513 (name "imap"))))
514 (ssl? "no")
515 (listen '("127.0.0.1"))
516 (disable-plaintext-auth? #f)
517 (auth-mechanisms '("plain"))
518 (postmaster-address "bandali@gnu.local")
519 (mail-location "maildir:/home/bandali/mail/%d/%n/mail")
520 (userdbs (list (userdb-configuration
521 (driver "static")
522 (args (list "uid=bandali" "gid=users" "home=/home/bandali/mail/%d/%n")))))
523 (passdbs (list (passdb-configuration
524 (driver "passwd-file")
525 (args (list "/data/dovecot-passwd")))))))
526 (service rottlog-service-type)
527 (service thermald-service-type)
528 (service tlp-service-type
529 (tlp-configuration
530 (cpu-boost-on-ac? #t)
531 (sound-power-save-on-bat 0)
532 (sound-power-save-controller? #f)
533 ;; (usb-blacklist "0e8f:00a8") ;for some reason doesn't seem to work
534 (usb-autosuspend? #f)))
535 (simple-service 'my-powertop-auto-tune activation-service-type
536 #~(zero? (system* #$(file-append powertop "/sbin/powertop")
537 "--auto-tune")))
538 (simple-service 'light-udev-rules udev-service-type (list light))
539 %desktop-services)))
540#+end_src
541
542** isync
543:PROPERTIES:
544:header-args+: :tangle ~/.config/isync/mbsyncrc
545:END:
546
547#+begin_src conf
548# Global defaults
549CopyArrivalDate yes
550Create Both
551Expunge Both
552
553######
554IMAPAccount shemshak
555Host mail.shemshak.org
556User amin@shemshak.org
557PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak.gpg"
558SSLType IMAPS
559
560IMAPStore shemshak-remote
561Account shemshak
562
563IMAPAccount shemshak-local
564Host 127.0.0.1
565Port 143
566User amin@shemshak.local
567PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak-local.gpg"
568SSLType None
569
570IMAPStore shemshak-local
571Account shemshak-local
572
573Channel shemshak
574Master :shemshak-remote:
575Slave :shemshak-local:
576Patterns *
577
578######
579IMAPAccount gnub
580Host mail.shemshak.org
581User gnu@bandali.eu.org
582PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub.gpg"
583SSLType IMAPS
584
585IMAPStore gnub-remote
586Account gnub
587
588IMAPAccount gnub-local
589Host 127.0.0.1
590Port 143
591User bandali@gnu.local
592PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub-local.gpg"
593SSLType None
594
595IMAPStore gnub-local
596Account gnub-local
597
598Channel gnub
599Master :gnub-remote:
600Slave :gnub-local:
601Patterns *
602
603######
604IMAPAccount uwaterloo
605Host connect.uwaterloo.ca
606User abandali
607PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo.gpg"
608SSLType IMAPS
609
610IMAPStore uwaterloo-remote
611Account uwaterloo
612
613IMAPAccount uwaterloo-local
614Host 127.0.0.1
615Port 143
616User abandali@uw.local
617PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo-local.gpg"
618SSLType None
619
620IMAPStore uwaterloo-local
621Account uwaterloo-local
622
623Channel uwaterloo
624Master :uwaterloo-remote:
625Slave :uwaterloo-local:
626Patterns *
627
628######
629IMAPAccount csclub
630Host mail.csclub.uwaterloo.ca
631User abandali
632PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub.gpg"
633SSLType IMAPS
634
635IMAPStore csclub-remote
636Account csclub
637
638IMAPAccount csclub-local
639Host 127.0.0.1
640Port 143
641User abandali@csc.uw.local
642PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub-local.gpg"
643SSLType None
644
645IMAPStore csclub-local
646Account csclub-local
647
648Channel csclub
649Master :csclub-remote:
650Slave :csclub-local:
651Patterns *
652#+end_src
653
654** Latexmk
655:PROPERTIES:
656:header-args+: :tangle ~/.config/latexmk/latexmkrc
657:END:
658
659#+begin_src conf
660$pdf_previewer = "start zathura %O %S";
661$clean_ext = "aux out";
662
663# $pdf_update_method = 4;
664# $pdf_update_command = "zathura %O %S";
665
666# Synctex allows one to jump to from the PDF in Zathura to the source in Emacs
667# by Ctrl+click in the PDF.
668# Tell latexmk to use Zathura as a previewer, and run emacsclient as the Synctex
669# editor.
670# $pdf_previewer = 'exec zathura --synctex-forward -x \'emacsclient --no-wait +%{line} %{input}\' %O %S';
671#+end_src
672
673** mpd
674:PROPERTIES:
675:header-args+: :tangle ~/.config/mpd/mpd.conf
676:END:
677
678#+begin_src conf
679# An example configuration file for MPD.
680# Read the user manual for documentation: http://www.musicpd.org/doc/user/
681
682
683# Files and directories #######################################################
684#
685# This setting controls the top directory which MPD will search to discover the
686# available audio files and add them to the daemon's online database. This
687# setting defaults to the XDG directory, otherwise the music directory will be
688# be disabled and audio files will only be accepted over ipc socket (using
689# file:// protocol) or streaming files over an accepted protocol.
690#
691music_directory "~/usr/music"
692#
693# This setting sets the MPD internal playlist directory. The purpose of this
694# directory is storage for playlists created by MPD. The server will use
695# playlist files not created by the server but only if they are in the MPD
696# format. This setting defaults to playlist saving being disabled.
697#
698playlist_directory "~/.mpd/playlists"
699#
700# This setting sets the location of the MPD database. This file is used to
701# load the database at server start up and store the database while the
702# server is not up. This setting defaults to disabled which will allow
703# MPD to accept files over ipc socket (using file:// protocol) or streaming
704# files over an accepted protocol.
705#
706db_file "~/.mpd/database"
707#
708# These settings are the locations for the daemon log files for the daemon.
709# These logs are great for troubleshooting, depending on your log_level
710# settings.
711#
712# The special value "syslog" makes MPD use the local syslog daemon. This
713# setting defaults to logging to syslog, otherwise logging is disabled.
714#
715log_file "~/.mpd/log"
716#
717# This setting sets the location of the file which stores the process ID
718# for use of mpd --kill and some init scripts. This setting is disabled by
719# default and the pid file will not be stored.
720#
721pid_file "~/.mpd/pid"
722#
723# This setting sets the location of the file which contains information about
724# most variables to get MPD back into the same general shape it was in before
725# it was brought down. This setting is disabled by default and the server
726# state will be reset on server start up.
727#
728state_file "~/.mpd/state"
729#
730# The location of the sticker database. This is a database which
731# manages dynamic information attached to songs.
732#
733sticker_file "~/.mpd/sticker.sql"
734#
735###############################################################################
736
737
738# General music daemon options ################################################
739#
740# This setting specifies the user that MPD will run as. MPD should never run as
741# root and you may use this setting to make MPD change its user ID after
742# initialization. This setting is disabled by default and MPD is run as the
743# current user.
744#
745#user "nobody"
746#
747# This setting specifies the group that MPD will run as. If not specified
748# primary group of user specified with "user" setting will be used (if set).
749# This is useful if MPD needs to be a member of group such as "audio" to
750# have permission to use sound card.
751#
752#group "nogroup"
753#
754# This setting sets the address for the daemon to listen on. Careful attention
755# should be paid if this is assigned to anything other then the default, any.
756# This setting can deny access to control of the daemon. Not effective if
757# systemd socket activiation is in use.
758#
759# For network
760#bind_to_address "any"
761#
762# And for Unix Socket
763#bind_to_address "~/.mpd/socket"
764#
765# This setting is the TCP port that is desired for the daemon to get assigned
766# to.
767#
768#port "6600"
769#
770# This setting controls the type of information which is logged. Available
771# setting arguments are "default", "secure" or "verbose". The "verbose" setting
772# argument is recommended for troubleshooting, though can quickly stretch
773# available resources on limited hardware storage.
774#
775#log_level "default"
776#
777# If you have a problem with your MP3s ending abruptly it is recommended that
778# you set this argument to "no" to attempt to fix the problem. If this solves
779# the problem, it is highly recommended to fix the MP3 files with vbrfix
780# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
781# point gapless MP3 playback can be enabled.
782#
783#gapless_mp3_playback "yes"
784#
785# Setting "restore_paused" to "yes" puts MPD into pause mode instead
786# of starting playback after startup.
787#
788#restore_paused "no"
789#
790# This setting enables MPD to create playlists in a format usable by other
791# music players.
792#
793#save_absolute_paths_in_playlists "no"
794#
795# This setting defines a list of tag types that will be extracted during the
796# audio file discovery process. The complete list of possible values can be
797# found in the user manual.
798#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
799#
800# This setting enables automatic update of MPD's database when files in
801# music_directory are changed.
802#
803#auto_update "yes"
804#
805# Limit the depth of the directories being watched, 0 means only watch
806# the music directory itself. There is no limit by default.
807#
808#auto_update_depth "3"
809#
810###############################################################################
811
812
813# Symbolic link behavior ######################################################
814#
815# If this setting is set to "yes", MPD will discover audio files by following
816# symbolic links outside of the configured music_directory.
817#
818#follow_outside_symlinks "yes"
819#
820# If this setting is set to "yes", MPD will discover audio files by following
821# symbolic links inside of the configured music_directory.
822#
823#follow_inside_symlinks "yes"
824#
825###############################################################################
826
827
828# Zeroconf / Avahi Service Discovery ##########################################
829#
830# If this setting is set to "yes", service information will be published with
831# Zeroconf / Avahi.
832#
833#zeroconf_enabled "yes"
834#
835# The argument to this setting will be the Zeroconf / Avahi unique name for
836# this MPD server on the network.
837#
838#zeroconf_name "Music Player"
839#
840###############################################################################
841
842
843# Permissions #################################################################
844#
845# If this setting is set, MPD will require password authorization. The password
846# setting can be specified multiple times for different password profiles.
847#
848#password "password@read,add,control,admin"
849#
850# This setting specifies the permissions a user has who has not yet logged in.
851#
852#default_permissions "read,add,control,admin"
853#
854###############################################################################
855
856
857# Database #######################################################################
858#
859
860#database {
861# plugin "proxy"
862# host "other.mpd.host"
863# port "6600"
864#}
865
866# Input #######################################################################
867#
868
869input {
870 plugin "curl"
871# proxy "proxy.isp.com:8080"
872# proxy_user "user"
873# proxy_password "password"
874}
875
876#
877###############################################################################
878
879# Audio Output ################################################################
880#
881
882audio_output {
883 type "pulse"
884 name "pulse audio"
885}
886
887audio_output {
888 type "fifo"
889 name "my_fifo"
890 path "/tmp/mpd.fifo"
891 format "44100:16:2"
892}
893
894# MPD supports various audio output types, as well as playing through multiple
895# audio outputs at the same time, through multiple audio_output settings
896# blocks. Setting this block is optional, though the server will only attempt
897# autodetection for one sound card.
898#
899# An example of an ALSA output:
900#
901#audio_output {
902# type "alsa"
903# name "My ALSA Device"
904## device "hw:0,0" # optional
905## mixer_type "hardware" # optional
906## mixer_device "default" # optional
907## mixer_control "PCM" # optional
908## mixer_index "0" # optional
909#}
910#
911# An example of an OSS output:
912#
913#audio_output {
914# type "oss"
915# name "My OSS Device"
916## device "/dev/dsp" # optional
917## mixer_type "hardware" # optional
918## mixer_device "/dev/mixer" # optional
919## mixer_control "PCM" # optional
920#}
921#
922# An example of a shout output (for streaming to Icecast):
923#
924#audio_output {
925# type "shout"
926# encoder "vorbis" # optional
927# name "My Shout Stream"
928# host "localhost"
929# port "8000"
930# mount "/mpd.ogg"
931# password "hackme"
932# quality "5.0"
933# bitrate "128"
934# format "44100:16:1"
935## protocol "icecast2" # optional
936## user "source" # optional
937## description "My Stream Description" # optional
938## url "http://example.com" # optional
939## genre "jazz" # optional
940## public "no" # optional
941## timeout "2" # optional
942## mixer_type "software" # optional
943#}
944#
945# An example of a recorder output:
946#
947#audio_output {
948# type "recorder"
949# name "My recorder"
950# encoder "vorbis" # optional, vorbis or lame
951# path "/var/lib/mpd/recorder/mpd.ogg"
952## quality "5.0" # do not define if bitrate is defined
953# bitrate "128" # do not define if quality is defined
954# format "44100:16:1"
955#}
956#
957# An example of a httpd output (built-in HTTP streaming server):
958#
959#audio_output {
960# type "httpd"
961# name "My HTTP Stream"
962# encoder "vorbis" # optional, vorbis or lame
963# port "8000"
964# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
965## quality "5.0" # do not define if bitrate is defined
966# bitrate "128" # do not define if quality is defined
967# format "44100:16:1"
968# max_clients "0" # optional 0=no limit
969#}
970#
971# An example of a pulseaudio output (streaming to a remote pulseaudio server)
972#
973#audio_output {
974# type "pulse"
975# name "My Pulse Output"
976## server "remote_server" # optional
977## sink "remote_server_sink" # optional
978#}
979#
980# An example of a winmm output (Windows multimedia API).
981#
982#audio_output {
983# type "winmm"
984# name "My WinMM output"
985## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
986# or
987## device "0" # optional
988## mixer_type "hardware" # optional
989#}
990#
991# An example of an openal output.
992#
993#audio_output {
994# type "openal"
995# name "My OpenAL output"
996## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
997#}
998#
999# An example of an sndio output.
1000#
1001#audio_output {
1002# type "sndio"
1003# name "sndio output"
1004# mixer_type "software"
1005#}
1006#
1007# An example of an OS X output:
1008#
1009#audio_output {
1010# type "osx"
1011# name "My OS X Device"
1012## device "Built-in Output" # optional
1013## channel_map "-1,-1,0,1" # optional
1014#}
1015#
1016## Example "pipe" output:
1017#
1018#audio_output {
1019# type "pipe"
1020# name "my pipe"
1021# command "aplay -f cd 2>/dev/null"
1022## Or if you're want to use AudioCompress
1023# command "AudioCompress -m | aplay -f cd 2>/dev/null"
1024## Or to send raw PCM stream through PCM:
1025# command "nc example.org 8765"
1026# format "44100:16:2"
1027#}
1028#
1029## An example of a null output (for no audio output):
1030#
1031#audio_output {
1032# type "null"
1033# name "My Null Output"
1034# mixer_type "none" # optional
1035#}
1036#
1037###############################################################################
1038
1039
1040# Normalization automatic volume adjustments ##################################
1041#
1042# This setting specifies the type of ReplayGain to use. This setting can have
1043# the argument "off", "album", "track" or "auto". "auto" is a special mode that
1044# chooses between "track" and "album" depending on the current state of
1045# random playback. If random playback is enabled then "track" mode is used.
1046# See <http://www.replaygain.org> for more details about ReplayGain.
1047# This setting is off by default.
1048#
1049#replaygain "album"
1050#
1051# This setting sets the pre-amp used for files that have ReplayGain tags. By
1052# default this setting is disabled.
1053#
1054#replaygain_preamp "0"
1055#
1056# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
1057# By default this setting is disabled.
1058#
1059#replaygain_missing_preamp "0"
1060#
1061# This setting enables or disables ReplayGain limiting.
1062# MPD calculates actual amplification based on the ReplayGain tags
1063# and replaygain_preamp / replaygain_missing_preamp setting.
1064# If replaygain_limit is enabled MPD will never amplify audio signal
1065# above its original level. If replaygain_limit is disabled such amplification
1066# might occur. By default this setting is enabled.
1067#
1068#replaygain_limit "yes"
1069#
1070# This setting enables on-the-fly normalization volume adjustment. This will
1071# result in the volume of all playing audio to be adjusted so the output has
1072# equal "loudness". This setting is disabled by default.
1073#
1074#volume_normalization "no"
1075#
1076###############################################################################
1077
1078# Character Encoding ##########################################################
1079#
1080# If file or directory names do not display correctly for your locale then you
1081# may need to modify this setting.
1082#
1083#filesystem_charset "UTF-8"
1084#
1085###############################################################################
1086#+end_src
1087
1088** msmtp
1089:PROPERTIES:
1090:header-args+: :tangle ~/.config/msmtp/config
1091:END:
1092
1093#+begin_src conf
1094# Set default values for all following accounts.
1095defaults
1096port 587
1097tls on
1098auth on
1099#tls_trust_file /etc/ssl/certs/ca-certificates.crt
1100logfile ~/.msmtp.log
1101
1102account shemshak
1103host mail.shemshak.org
1104# use `msmtp -a shemshak --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1105tls_fingerprint 01:6F:1B:92:0A:E8:47:35:62:80:DD:17:F5:9A:9D:26:7D:59:E2:EC:69:67:36:69:2F:58:8C:89:57:66:F6:B1
1106tls_starttls on
1107from amin@shemshak.org
1108user amin@shemshak.org
1109passwordeval gpg --no-tty -q -d ~/.passwd/shemshak.gpg
1110
1111account aminb : shemshak
1112from amin@aminb.org
1113account bndl : shemshak
1114from amin@bndl.org
1115
1116account gnu
1117host fencepost.gnu.org
1118# use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1119tls_fingerprint A5:E9:14:9F:46:3E:8E:0F:09:8C:5D:21:C2:BE:DE:77:BE:8B:E7:82:6C:56:78:0C:62:CA:46:D7:18:FE:33:05
1120tls_starttls on
1121from bandali@gnu.org
1122user bandali
1123passwordeval gpg --no-tty -q -d ~/.passwd/gnu.gpg
1124
1125account gnu-mab : gnu
1126from mab@gnu.org
1127account gnu-aminb : gnu
1128from aminb@gnu.org
1129account gnu-amin : gnu
1130from amin@gnu.org
1131
1132account uwaterloo
1133host connect.uwaterloo.ca
1134tls_starttls on
1135from abandali@uwaterloo.ca
1136user abandali
1137passwordeval gpg --no-tty -q -d ~/.passwd/uwaterloo.gpg
1138tls_trust_file /etc/ssl/certs/ca-certificates.crt
1139
1140account uwaterloo-friendly : uwaterloo
1141from bandali@uwaterloo.ca
1142
1143account csclub
1144host mail.csclub.uwaterloo.ca
1145tls_starttls on
1146from abandali@csclub.uwaterloo.ca
1147user abandali
1148passwordeval gpg --no-tty -q -d ~/.passwd/csclub.gpg
1149tls_trust_file /etc/ssl/certs/ca-certificates.crt
1150
1151account csclub-friendly : csclub
1152from bandali@csclub.uwaterloo.ca
1153
1154# Set a default account
1155account default : shemshak
1156#+end_src
1157
1158** ncmpcpp
1159
1160*** config
1161:PROPERTIES:
1162:header-args+: :tangle ~/.ncmpcpp/config
1163:END:
1164
1165#+begin_src conf :tangle no
1166##############################################################
1167## This is the example configuration file. Copy it to ##
1168## $HOME/.ncmpcpp/config or $XDG_CONFIG_HOME/ncmpcpp/config ##
1169## and set up your preferences. ##
1170##############################################################
1171#
1172##### directories ######
1173##
1174## Directory for storing ncmpcpp related files.
1175## Changing it is useful if you want to store
1176## everything somewhere else and provide command
1177## line setting for alternative location to config
1178## file which defines that while launching ncmpcpp.
1179##
1180#
1181ncmpcpp_directory = ~/.ncmpcpp
1182#
1183##
1184## Directory for storing downloaded lyrics. It
1185## defaults to ~/.lyrics since other MPD clients
1186## (eg. ncmpc) also use that location.
1187##
1188#
1189#lyrics_directory = ~/.lyrics
1190#
1191##### connection settings #####
1192#
1193#mpd_host = localhost
1194#
1195#mpd_port = 6600
1196#
1197#mpd_connection_timeout = 5
1198#
1199## Needed for tag editor and file operations to work.
1200##
1201mpd_music_dir = ~/usr/music
1202#
1203#mpd_crossfade_time = 5
1204#
1205##### music visualizer #####
1206##
1207## Note: In order to make music visualizer work you'll
1208## need to use mpd fifo output, whose format parameter
1209## has to be set to 44100:16:1 for mono visualization
1210## or 44100:16:2 for stereo visualization. Example
1211## configuration (it has to be put into mpd.conf):
1212##
1213## audio_output {
1214## type "fifo"
1215## name "Visualizer feed"
1216## path "/tmp/mpd.fifo"
1217## format "44100:16:2"
1218## }
1219##
1220#
1221visualizer_fifo_path = /tmp/mpd.fifo
1222#
1223##
1224## Note: Below parameter is needed for ncmpcpp
1225## to determine which output provides data for
1226## visualizer and thus allow syncing between
1227## visualization and sound as currently there
1228## are some problems with it.
1229##
1230#
1231visualizer_output_name = my fifo
1232#
1233##
1234## If you set format to 44100:16:2, make it 'yes'.
1235##
1236visualizer_in_stereo = yes
1237#
1238##
1239## Multiply received samples by given value. Very
1240## useful for proper visualization of quiet music.
1241##
1242#visualizer_sample_multiplier = 1
1243#
1244##
1245## Note: Below parameter defines how often ncmpcpp
1246## has to "synchronize" visualizer and audio outputs.
1247## 30 seconds is optimal value, but if you experience
1248## synchronization problems, set it to lower value.
1249## Keep in mind that sane values start with >=10.
1250##
1251#
1252visualizer_sync_interval = 30
1253#
1254##
1255## Note: To enable spectrum frequency visualization
1256## you need to compile ncmpcpp with fftw3 support.
1257##
1258#
1259## Available values: spectrum, wave, wave_filled, ellipse.
1260##
1261visualizer_type = spectrum
1262#
1263#visualizer_look = ●▮
1264visualizer_look = "●•"
1265#
1266#visualizer_color = blue, cyan, green, yellow, magenta, red
1267#
1268## Alternative subset of 256 colors for terminals that support it.
1269##
1270#visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161
1271#
1272##### system encoding #####
1273##
1274## ncmpcpp should detect your charset encoding
1275## but if it failed to do so, you can specify
1276## charset encoding you are using here.
1277##
1278## Note: You can see whether your ncmpcpp build
1279## supports charset detection by checking output
1280## of `ncmpcpp --version`.
1281##
1282## Note: Since MPD uses UTF-8 by default, setting
1283## this option makes sense only if your encoding
1284## is different.
1285##
1286#
1287#system_encoding = ""
1288#
1289##### delays #####
1290#
1291## Time of inactivity (in seconds) after playlist
1292## highlighting will be disabled (0 = always on).
1293##
1294#playlist_disable_highlight_delay = 5
1295#
1296## Defines how long messages are supposed to be visible.
1297##
1298#message_delay_time = 5
1299#
1300##### song format #####
1301##
1302## For a song format you can use:
1303##
1304## %l - length
1305## %f - filename
1306## %D - directory
1307## %a - artist
1308## %A - album artist
1309## %t - title
1310## %b - album
1311## %y - date
1312## %n - track number (01/12 -> 01)
1313## %N - full track info (01/12 -> 01/12)
1314## %g - genre
1315## %c - composer
1316## %p - performer
1317## %d - disc
1318## %C - comment
1319## %P - priority
1320## $R - begin right alignment
1321##
1322## If you want to make sure that a part of the format is displayed
1323## only when certain tags are present, you can archieve it by
1324## grouping them with brackets, e.g. '{%a - %t}' will be evaluated
1325## to 'ARTIST - TITLE' if both tags are present or '' otherwise.
1326## It is also possible to define a list of alternatives by providing
1327## several groups and separating them with '|', e.g. '{%t}|{%f}'
1328## will be evaluated to 'TITLE' or 'FILENAME' if the former is not
1329## present.
1330##
1331## Note: If you want to set limit on maximal length of a tag, just
1332## put the appropriate number between % and character that defines
1333## tag type, e.g. to make album take max. 20 terminal cells, use '%20b'.
1334##
1335## In addition, formats support markers used for text attributes.
1336## They are followed by character '$'. After that you can put:
1337##
1338## - 0 - default window color (discards all other colors)
1339## - 1 - black
1340## - 2 - red
1341## - 3 - green
1342## - 4 - yellow
1343## - 5 - blue
1344## - 6 - magenta
1345## - 7 - cyan
1346## - 8 - white
1347## - 9 - end of current color
1348## - b - bold text
1349## - u - underline text
1350## - r - reverse colors
1351## - a - use alternative character set
1352##
1353## If you don't want to use a non-color attribute anymore, just put it
1354## again, but this time insert character '/' between '$' and attribute
1355## character, e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag
1356## or filename with reversed colors.
1357##
1358## If you want to use 256 colors and/or background colors in formats
1359## (the naming scheme is described below in section about color
1360## definitions), it can be done with the syntax $(COLOR), e.g. to set
1361## the artist tag to one of the non-standard colors and make it have
1362## yellow background, you need to write $(197_yellow)%a$(end). Note
1363## that for standard colors this is interchangable with attributes
1364## listed above.
1365##
1366## Note: colors can be nested.
1367##
1368#
1369#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3(%l)$9}
1370#
1371#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
1372#
1373#song_library_format = {%n - }{%t}|{%f}
1374#
1375#
1376#alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
1377#
1378#alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
1379#
1380#now_playing_prefix = $b
1381#
1382#now_playing_suffix = $/b
1383#
1384#browser_playlist_prefix = "$2playlist$9 "
1385#
1386#selected_item_prefix = $6
1387#
1388#selected_item_suffix = $9
1389#
1390#modified_item_prefix = $3> $9
1391#
1392##
1393## Note: attributes are not supported for the following variables.
1394##
1395#song_window_title_format = {%a - }{%t}|{%f}
1396##
1397## Note: Below variables are used for sorting songs in browser.
1398## The sort mode determines how songs are sorted, and can be used
1399## in combination with a sort format to specify a custom sorting format.
1400## Available values for browser_sort_mode are "name", "mtime", "format"
1401## and "noop".
1402##
1403#
1404#browser_sort_mode = name
1405#
1406#browser_sort_format = {%a - }{%t}|{%f} {(%l)}
1407#
1408##### columns settings #####
1409##
1410## syntax of song columns list format is "column column etc."
1411##
1412## - syntax for each column is:
1413##
1414## (width of the column)[color of the column]{displayed tag}
1415##
1416## Note: Width is by default in %, if you want a column to
1417## have fixed size, add 'f' after the value, e.g. (10)[white]{a}
1418## will be the column that take 10% of screen (so the real width
1419## will depend on actual screen size), whereas (10f)[white]{a}
1420## will take 10 terminal cells, no matter how wide the screen is.
1421##
1422## - color is optional (if you want the default one,
1423## leave the field empty).
1424##
1425## Note: You can give a column additional attributes by putting appropriate
1426## character after displayed tag character. Available attributes are:
1427##
1428## - r - column will be right aligned
1429## - E - if tag is empty, empty tag marker won't be displayed
1430##
1431## You can also:
1432##
1433## - give a column custom name by putting it after attributes,
1434## separated with character ':', e.g. {lr:Length} gives you
1435## right aligned column of lengths named "Length".
1436##
1437## - define sequence of tags, that have to be displayed in case
1438## predecessor is empty in a way similar to the one in classic
1439## song format, i.e. using '|' character, e.g. {a|c|p:Owner}
1440## creates column named "Owner" that tries to display artist
1441## tag and then composer and performer if previous ones are
1442## not available.
1443##
1444#
1445#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
1446#
1447##### various settings #####
1448#
1449##
1450## Note: Custom command that will be executed each
1451## time song changes. Useful for notifications etc.
1452##
1453#execute_on_song_change = ""
1454#
1455#playlist_show_mpd_host = no
1456#
1457#playlist_show_remaining_time = no
1458#
1459#playlist_shorten_total_times = no
1460#
1461#playlist_separate_albums = no
1462#
1463##
1464## Note: Possible display modes: classic, columns.
1465##
1466#playlist_display_mode = columns
1467#
1468#browser_display_mode = classic
1469#
1470#search_engine_display_mode = classic
1471#
1472#playlist_editor_display_mode = classic
1473#
1474#discard_colors_if_item_is_selected = yes
1475#
1476#incremental_seeking = yes
1477#
1478#seek_time = 1
1479#
1480#volume_change_step = 2
1481#
1482#autocenter_mode = no
1483#
1484#centered_cursor = no
1485#
1486##
1487## Note: You can specify third character which will
1488## be used to build 'empty' part of progressbar.
1489##
1490#progressbar_look = =>
1491progressbar_look = "─╼╶"
1492#progressbar_look = "─⊙╶"
1493#
1494#progressbar_boldness = yes
1495#
1496## Available values: database, playlist.
1497##
1498#default_place_to_search_in = database
1499#
1500## Available values: classic, alternative.
1501##
1502#user_interface = classic
1503#
1504#data_fetching_delay = yes
1505#
1506## Available values: artist, album_artist, date, genre, composer, performer.
1507##
1508#media_library_primary_tag = artist
1509#
1510## Available values: wrapped, normal.
1511##
1512#default_find_mode = wrapped
1513#
1514#default_tag_editor_pattern = %n - %t
1515#
1516#header_visibility = yes
1517#
1518#statusbar_visibility = yes
1519#
1520#titles_visibility = yes
1521#
1522#header_text_scrolling = yes
1523#
1524#cyclic_scrolling = no
1525#
1526#lines_scrolled = 2
1527#
1528#follow_now_playing_lyrics = no
1529#
1530#fetch_lyrics_for_current_song_in_background = no
1531#
1532#store_lyrics_in_song_dir = no
1533#
1534#generate_win32_compatible_filenames = yes
1535#
1536#allow_for_physical_item_deletion = no
1537#
1538##
1539## Note: If you set this variable, ncmpcpp will try to
1540## get info from last.fm in language you set and if it
1541## fails, it will fall back to english. Otherwise it will
1542## use english the first time.
1543##
1544## Note: Language has to be expressed as an ISO 639 alpha-2 code.
1545##
1546#lastfm_preferred_language = en
1547#
1548#show_hidden_files_in_local_browser = no
1549#
1550##
1551## How shall screen switcher work?
1552##
1553## - "previous" - switch between the current and previous screen.
1554## - "screen1,...,screenN" - switch between given sequence of screens.
1555##
1556## Screens available for use: help, playlist, browser, search_engine,
1557## media_library, playlist_editor, tag_editor, outputs, visualizer, clock.
1558##
1559#screen_switcher_mode = playlist, browser
1560#
1561##
1562## Note: You can define startup screen
1563## by choosing screen from the list above.
1564##
1565#startup_screen = playlist
1566#
1567##
1568## Note: You can define startup slave screen
1569## by choosing screen from the list above or
1570## an empty value for no slave screen.
1571##
1572#startup_slave_screen = ""
1573#
1574#startup_slave_screen_focus = no
1575#
1576##
1577## Default width of locked screen (in %).
1578## Acceptable values are from 20 to 80.
1579##
1580#
1581#locked_screen_width_part = 50
1582#
1583#ask_for_locked_screen_width_part = yes
1584#
1585#jump_to_now_playing_song_at_start = yes
1586#
1587#ask_before_clearing_playlists = yes
1588#
1589#clock_display_seconds = no
1590#
1591#display_volume_level = yes
1592#
1593#display_bitrate = no
1594#
1595#display_remaining_time = no
1596#
1597## Available values: none, basic, extended, perl.
1598##
1599#regular_expressions = perl
1600#
1601##
1602## Note: If below is enabled, ncmpcpp will ignore leading
1603## "The" word while sorting items in browser, tags in
1604## media library, etc.
1605##
1606#ignore_leading_the = no
1607#
1608#block_search_constraints_change_if_items_found = yes
1609#
1610#mouse_support = yes
1611#
1612#mouse_list_scroll_whole_page = yes
1613#
1614#empty_tag_marker = <empty>
1615#
1616#tags_separator = " | "
1617#
1618#tag_editor_extended_numeration = no
1619#
1620#media_library_sort_by_mtime = no
1621#
1622#enable_window_title = yes
1623#
1624##
1625## Note: You can choose default search mode for search
1626## engine. Available modes are:
1627##
1628## - 1 - use mpd built-in searching (no regexes, pattern matching)
1629## - 2 - use ncmpcpp searching (pattern matching with support for regexes,
1630## but if your mpd is on a remote machine, downloading big database
1631## to process it can take a while
1632## - 3 - match only exact values (this mode uses mpd function for searching
1633## in database and local one for searching in current playlist)
1634##
1635#
1636#search_engine_default_search_mode = 1
1637#
1638#external_editor = nano
1639#
1640## Note: set to yes if external editor is a console application.
1641##
1642#use_console_editor = yes
1643#
1644##### colors definitions #####
1645##
1646## It is possible to set a background color by setting a color
1647## value "<foreground>_<background>", e.g. red_black will set
1648## foregound color to red and background color to black.
1649##
1650## In addition, for terminals that support 256 colors it
1651## is possible to set one of them by using a number in range
1652## [1, 256] instead of color name, e.g. numerical value
1653## corresponding to red_black is 2_1. To find out if the
1654## terminal supports 256 colors, run ncmpcpp and check out
1655## the bottom of the help screen for list of available colors
1656## and their numerical values.
1657##
1658## Note: due to technical limitations of ncurses, if 256 colors
1659## are used, it is possible to either use only the colors with
1660## default background color, or all pairs from 1_1 up to 254_127,
1661## depending on the ncurses version used.
1662##
1663#
1664#colors_enabled = yes
1665#
1666#empty_tag_color = cyan
1667#
1668#header_window_color = default
1669#
1670#volume_color = default
1671#
1672#state_line_color = default
1673#
1674#state_flags_color = default
1675#
1676#main_window_color = yellow
1677#
1678#color1 = white
1679#
1680#color2 = green
1681#
1682#main_window_highlight_color = yellow
1683#
1684#progressbar_color = black
1685#
1686#progressbar_elapsed_color = green
1687#
1688#statusbar_color = default
1689#
1690#alternative_ui_separator_color = black
1691#
1692#active_column_color = red
1693#
1694#window_border_color = green
1695#
1696#active_window_border = red
1697#
1698#+end_src
1699
1700*** bindings
1701:PROPERTIES:
1702:header-args+: :tangle ~/.ncmpcpp/bindings
1703:END:
1704
1705#+begin_src conf :tangle no
1706def_key "j"
1707 scroll_down
1708def_key "k"
1709 scroll_up
1710
1711def_key "ctrl-u"
1712 page_up
1713def_key "ctrl-d"
1714 page_down
1715
1716def_key "h"
1717 previous_column
1718def_key "l"
1719 next_column
1720
1721def_key "."
1722 show_lyrics
1723
1724def_key "n"
1725 next_found_item
1726def_key "N"
1727 previous_found_item
1728
1729def_key "J"
1730 move_sort_order_down
1731def_key "K"
1732 move_sort_order_up
1733#+end_src
1734
1735** pigeonhole
1736*** amin.sieve
1737:PROPERTIES:
1738:header-args+: :tangle ~/mail/bndl.org/amin/sieve/amin.sieve :comments none
1739:END:
1740
1741#+begin_src conf
1742require ["regex", "variables", "fileinto", "envelope",
1743 "mailbox", "imap4flags", "include"];
1744
1745# webmasters
1746if anyof (
1747 address :is "from" ["webmasters@gnu.org", "webmasters-comment@gnu.org"]) {
1748 fileinto :create "gnu.webmasters";
1749 stop;
1750}
1751
1752include :personal "lists";
1753#+end_src
1754
1755*** lists.sieve
1756:PROPERTIES:
1757:header-args+: :tangle ~/mail/bndl.org/amin/sieve/lists.sieve :comments none
1758:END:
1759
1760#+begin_src conf
1761require ["regex", "variables", "fileinto", "envelope",
1762 "mailbox", "imap4flags", "include"];
1763
1764# mailing lists
1765if anyof (
1766 header :contains "list-id"
1767 [ "<emacs-devel.gnu.org>"
1768 , "<emacs-orgmode.gnu.org>"
1769 , "<emacsconf-discuss.gnu.org>"
1770 , "<fencepost-users.gnu.org>"
1771 , "<guix-devel.gnu.org>"
1772 , "<guile-devel.gnu.org>"
1773 , "<help-gnu-emacs.gnu.org>"
1774 , "<info-gnu-emacs.gnu.org>"
1775 , "<info-guix.gnu.org>"
1776 , "<www-commits.gnu.org>"
1777 , "<www-discuss.gnu.org>"
1778 , "<deepspec.lists.cs.princeton.edu>"
1779 , "<haskell-cafe.haskell.org>"
1780 , "<haskell-art.we.lurk.org>"
1781 , "<notmuch.notmuchmail.org>"
1782 ] ) {
1783 if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
1784 set :lower "listname" "${1}";
1785 fileinto :create "gnu.${listname}";
1786 stop;
1787 }
1788}
1789
1790# sr.ht lists, with dots ('.') omitted
1791if anyof (
1792 header :contains "list-id"
1793 [ "<~bandali/public-inbox@lists.sr.ht>"
1794 , "<~sircmpwn/sr.ht-admins@lists.sr.ht>"
1795 , "<~sircmpwn/sr.ht-announce@lists.sr.ht>"
1796 , "<~sircmpwn/sr.ht-dev@lists.sr.ht>"
1797 , "<~sircmpwn/sr.ht-discuss@lists.sr.ht>"
1798 ] ) {
1799 if header :regex "list-id" "(~[a-z_0-9-]+)/([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)\\.?([^.]*)@" {
1800 set :lower "username" "${1}";
1801 set :lower "listname" "${2}${3}${4}${5}${6}${7}";
1802 fileinto :create "gnu.${username}.${listname}";
1803 stop;
1804 }
1805}
1806#+end_src
1807
1808** Readline
1809:PROPERTIES:
1810:header-args+: :tangle ~/.config/readline/inputrc
1811:END:
1812
1813#+begin_src conf
1814set enable-bracketed-paste on
1815
1816set colored-stats on
1817set colored-completion-prefix on
1818set completion-ignore-case on
1819set menu-complete-display-prefix on
1820set page-completions off
1821set show-all-if-ambiguous on
1822set show-all-if-unmodified on
1823set visible-stats on
1824
1825TAB: menu-complete
1826"\e[Z": menu-complete-backward
1827
1828"\e[A": history-search-backward
1829"\e[B": history-search-forward
1830#+end_src
1831
1832** rofi
1833:PROPERTIES:
1834:header-args+: :tangle ~/.config/rofi/config
1835:END:
1836
1837#+begin_src conf
1838! rofi.font: Ubuntu Mono 13
1839! rofi.font: Inconsolata 16
1840! rofi.font: Iosevka 13
1841! rofi.font: Source Code Pro 11
1842rofi.font: Source Code Pro 10.5
1843rofi.modi: run,window
1844! rofi.width: 640
1845rofi.width: 600
1846!rofi.location: 2
1847!rofi.yoffset: 200
1848rofi.monitor: -1
1849!rofi.lines: 10
1850
1851rofi.theme: ~/.guix-profile/share/rofi/themes/gruvbox-light-hard.rasi
1852#+end_src
1853
1854** rofi-pass
1855:PROPERTIES:
1856:header-args+: :tangle ~/.config/rofi-pass/config
1857:END:
1858
1859#+begin_src conf
1860# permanently set alternative root dir
1861# root=/path/to/root
1862
1863# rofi command. Make sure to have "$@" as last argument
1864_rofi () {
1865 #rofi -no-auto-select -kb-accept-entry "!Return" -i -no-levenshtein-sort "$@"
1866 rofi -i -no-auto-select -kb-accept-entry "!Return" "$@"
1867}
1868
1869# xdotool needs the keyboard layout to be set using setxkbmap
1870# You can do this in your autostart scripts (e.g. xinitrc)
1871
1872# If for some reason, you cannot do this, you can set the command here.
1873# and set fix_layout to true
1874fix_layout=false
1875
1876layout_cmd () {
1877 setxkbmap us
1878}
1879
1880# fields to be used
1881URL_field='url'
1882USERNAME_field='user'
1883AUTOTYPE_field='autotype'
1884
1885# delay to be used for :delay keyword
1886delay=2
1887
1888## Programs to be used
1889# Editor
1890EDITOR='gvim -f'
1891
1892# Browser
1893BROWSER='chromium'
1894
1895## Misc settings
1896
1897default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
1898auto_enter='false'
1899notify='false'
1900default_autotype='user :tab pass'
1901
1902# color of the help messages
1903# leave empty for autodetection
1904help_color="#4872FF"
1905
1906# Clipboard settings
1907# Possible options: primary, clipboard, both
1908clip=primary
1909
1910# Options for generating new password entries
1911# default_user is also used for password files that have no user field.
1912default_user=aminb
1913default_user2=bandali
1914password_length=30
1915
1916# Custom Keybindings
1917#autotype="Alt+1"
1918autotype="Alt+m"
1919type_user="Alt+2"
1920type_pass="Alt+3"
1921open_url="Alt+4"
1922copy_name="Alt+u"
1923copy_url="Alt+l"
1924copy_pass="Alt+p"
1925show="Alt+o"
1926copy_entry="Alt+2"
1927type_entry="Alt+1"
1928copy_menu="Alt+c"
1929action_menu="Alt+a"
1930type_menu="Alt+t"
1931help="Alt+h"
1932switch="Alt+x"
1933insert_pass="Alt+n"
1934#+end_src
1935
1936** Screen
1937:PROPERTIES:
1938:header-args+: :tangle ~/.config/screen/screenrc
1939:END:
1940
1941#+begin_src screen
1942startup_message off
1943caption always "%{= kc}GNU Screen $USER@%H (load: %l)%-28=%{= .m}%D %d.%m.%Y %0c"
1944#+end_src
1945
1946** Shell
1947
1948*** GNU Bash
1949:PROPERTIES:
1950:header-args+: :tangle ~/.bashrc
1951:END:
1952
1953#+begin_src bash
1954# Bash initialization for interactive non-login shells and
1955# for remote shells (info "(bash) Bash Startup Files").
1956
1957# Export 'SHELL' to child processes. Programs such as 'screen'
1958# honor it and otherwise use /bin/sh.
1959export SHELL
1960
1961if [[ $- != *i* ]]
1962then
1963 # We are being invoked from a non-interactive shell. If this
1964 # is an SSH session (as in "ssh host command"), source
1965 # /etc/profile so we get PATH and other essential variables.
1966 [[ -n "$SSH_CLIENT" ]] && source /etc/profile
1967
1968 # Don't do anything else.
1969 return
1970fi
1971
1972if [ -n "$IS_GUIX_SYSTEM" ]; then
1973 # Source the system-wide file.
1974 source /etc/bashrc
1975fi
1976
1977# from https://unix.stackexchange.com/a/55935
1978b_prompt() {
1979 cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
1980 printf $cwd
1981}
1982
1983if [ $(id -u) == "0" ]; then
1984 PS1='`printf "\[\e[1;31m\]\$\[\e[00m\]"` '
1985else
1986 PS1='\$ '
1987fi
1988PS1="\u@\h:\w/`[ -n "$GUIX_ENVIRONMENT" ] && printf \" [env]\"`\n$PS1"
1989
1990# set terminal title
1991PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: $(b_prompt)\007"'
1992
1993# i-beam cursor
1994# echo -e "\033[5 q" # blinking
1995echo -e "\033[6 q" # non-blinking
1996
1997# various bash tweaks
1998# append to the history file, don't overwrite it
1999shopt -s histappend
2000shopt -s cmdhist
2001# check the window size after each command and, if necessary,
2002# update the values of LINES and COLUMNS.
2003shopt -s checkwinsize
2004# If set, the pattern "**" used in a pathname expansion context will
2005# match all files and zero or more directories and subdirectories.
2006#shopt -s globstar
2007# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
2008HISTSIZE=
2009HISTFILESIZE=
2010# don't put duplicate lines or lines starting with space in the
2011# history.
2012HISTCONTROL=ignoreboth
2013# ignore a few very common commands and don't add them to history
2014HISTIGNORE='ls:l:s:g:[bf]g:history'
2015HISTTIMEFORMAT='%F %T '
2016stty stop ""
2017
2018# aliases
2019alias ls='ls -p --color=auto'
2020alias l='ls -lh' # long format and human-readable sizes
2021alias ll='l -A' # long format, all files
2022alias dir='dir --color=auto'
2023alias vdir='vdir --color=auto'
2024alias grep='grep --color=auto'
2025alias fgrep='fgrep --color=auto'
2026alias egrep='egrep --color=auto'
2027alias mpv="mpv --ytdl-format mp4"
2028alias mv="mv -iv"
2029alias cp="cp -iv"
2030alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
2031alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
2032alias m="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
2033alias best="youtube-dl -f best"
2034alias e="$EDITOR"
2035alias se="SUDO_EDITOR=\"emacsclient\" sudo -e"
2036
2037aur() {
2038 cd ~/usr/builds
2039 [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git
2040 cd ${1}
2041}
2042
2043function t {
2044 cd $(mktemp -d /tmp/$1.XXXX)
2045}
2046
2047# separate alias definitions file, if exists
2048if [ -f ~/.bash_aliases ]; then
2049 . ~/.bash_aliases
2050fi
2051
2052# enable programmable completion features (not needed if already
2053# enabled in /etc/bash.bashrc and if /etc/profile sources
2054# /etc/bash.bashrc).
2055if ! shopt -oq posix; then
2056 if [ -f /usr/share/bash-completion/bash_completion ]; then
2057 . /usr/share/bash-completion/bash_completion
2058 elif [ -f /etc/bash_completion ]; then
2059 . /etc/bash_completion
2060 fi
2061fi
2062
2063# source Guix shell config dirs, for vte.sh and bash completions
2064GUIX_PROFILES=("${HOME}/.guix-profile"
2065 "${HOME}/.config/guix/current")
2066for profile in "${GUIX_PROFILES[@]}"; do
2067 for dir in "${profile}/etc/bash_completion.d" "${profile}/etc/profile.d"; do
2068 if [ -d "${dir}" ]; then
2069 for f in "${dir}"/*; do
2070 . $f
2071 done
2072 fi
2073 done
2074done
2075#+end_src
2076
2077*** profile
2078:PROPERTIES:
2079:header-args+: :tangle ~/.profile
2080:END:
2081
2082#+begin_src sh
2083# ~/.profile: executed by the command interpreter for login shells.
2084# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
2085# exists.
2086
2087# source host-specific profile
2088if [ -f "$HOME/.config/profiles/$(hostname)" ]; then
2089 . "$HOME/.config/profiles/$(hostname)"
2090fi
2091
2092export EDITOR="emacsclient -nw"
2093export VISUAL="emcl"
2094
2095PATH="$HOME/usr/local/bin:$HOME/.local/bin:$PATH"
2096PATH="$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH"
2097if [ -z "$IS_GUIX_SYSTEM" ]; then
2098 PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
2099 INFOPATH="$HOME/.config/guix/current/share/info${INFOPATH:+:}$INFOPATH"
2100 export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
2101fi
2102export PATH
2103export INFOPATH
2104
2105export MY_GUIX_MANIFESTS="$HOME/.config/guix/manifest"
2106export MY_GUIX_PROFILES="$HOME/.config/guix/profile"
2107
2108export XDG_CONFIG_HOME="$HOME/.config"
2109export XDG_DATA_HOME="$HOME/.local/share"
2110
2111if [ -f "$HOME/.config/user-dirs.dirs" ]; then
2112 set -a
2113 . "$HOME/.config/user-dirs.dirs"
2114 set +a
2115fi
2116
2117export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
2118export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
2119
2120export MAILDIR="$HOME/mail"
2121export CVS_RSH="ssh"
2122
2123if [ -x "$(command -v go)" ]; then
2124 export GOPATH="$HOME/src/go"
2125 export PATH="$GOPATH/bin:$PATH"
2126fi
2127
2128# if running bash
2129if [ -n "$BASH_VERSION" ]; then
2130 # include .bashrc if it exists
2131 if [ -f "$HOME/.bashrc" ]; then
2132 . "$HOME/.bashrc"
2133 fi
2134fi
2135
2136if [ -z "$IS_GUIX_SYSTEM" ]; then
2137 # if guix is installed
2138 if [ -x "$(command -v guix)" ]; then
2139 SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
2140 if [ -d "$SSL_CERT_DIR" -o -h "$SSL_CERT_DIR" ]; then
2141 export SSL_CERT_DIR
2142 export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
2143 else
2144 printf "it seems you forgot to \`guix install nss-certs\'\n"
2145 fi
2146 GUIX_PROFILE="$HOME/.guix-profile"
2147 . "$GUIX_PROFILE/etc/profile"
2148 unset XDG_DATA_DIRS
2149 fi
2150fi
2151
2152for p in $MY_GUIX_PROFILES/*; do
2153 profile=$p/$(basename "$p")
2154 if [ -f "$profile"/etc/profile ]; then
2155 GUIX_PROFILE="$profile"
2156 . "$GUIX_PROFILE"/etc/profile
2157 fi
2158 unset profile
2159done
2160
2161# start an ssh-agent (with guix's openssh)
2162if [ -z "$IS_GUIX_SYSTEM" ]; then
2163 if ! pgrep -u "$USER" ssh-agent > /dev/null; then
2164 ssh-agent > ~/.ssh-agent-thing
2165 fi
2166 if [[ ! "$SSH_AUTH_SOCK" ]]; then
2167 eval "$(<~/.ssh-agent-thing)"
2168 fi
2169fi
2170
2171# footenote: when on a foreign distro and using Xfce, don't forget to
2172# disable its auto-start of gpg- and ssh-agent, by issuing
2173# xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
2174# xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false
2175# see https://docs.xfce.org/xfce/xfce4-session/advanced#ssh_and_gpg_agents
2176# also, MATE does something similar with gnome-keyring-daemon:
2177# http://william.shallum.net/random-notes/disabling-gnome-keyring-daemon-ssh-agent-on-mate-desktop
2178#+end_src
2179
2180*** per-host profiles
2181
2182Host-specific profiles, sourced from =~/.profile=. Each
2183=~/.config/profiles/HOST= file will be sourced on the machine with
2184=hostname= of =HOST=.
2185
2186**** chaman
2187:PROPERTIES:
2188:header-args+: :tangle ~/.config/profiles/chaman
2189:END:
2190
2191#+begin_src sh
2192export IS_GUIX_SYSTEM=true
2193
2194if [ -x "$(command -v xinput)" ]; then
2195 xinput --set-prop "TPPS/2 IBM TrackPoint" 'libinput Accel Speed' -0.4
2196fi
2197
2198setxkbmap \
2199 -layout us,ir \
2200 -option ctrl:nocaps \
2201 -option grp:shifts_toggle
2202
2203xmodmap -e "keysym Menu = Super_R"
2204
2205xsetroot -cursor_name left_ptr
2206xset r rate 200 45
2207xset b off
2208#+end_src
2209
2210**** darrud
2211:PROPERTIES:
2212:header-args+: :tangle ~/.config/profiles/darrud
2213:END:
2214
2215#+begin_src sh
2216export INFOPATH="$HOME/usr/local/share/info${INFOPATH:+:}$INFOPATH"
2217#+end_src
2218
2219**** langa
2220:PROPERTIES:
2221:header-args+: :tangle ~/.config/profiles/langa
2222:END:
2223
2224#+begin_src sh
2225export XDG_DATA_DIRS="/usr/share/mate:/usr/local/share/:/usr/share/"
2226#+end_src
2227
2228** redshift
2229:PROPERTIES:
2230:header-args+: :tangle ~/.config/redshift.conf :comments none
2231:END:
2232
2233#+begin_src conf
2234; Global settings for redshift
2235[redshift]
2236; Set the day and night screen temperatures (Neutral is 6500K)
2237;temp-day=5700
2238;temp-night=3500
2239
2240;temp-day=6500
2241temp-day=6200
2242;temp-night=4800
2243;temp-night=5000
2244;temp-night=4500
2245temp-night=4000
2246
2247; Enable/Disable a smooth transition between day and night
2248; 0 will cause a direct change from day to night screen temperature.
2249; 1 will gradually increase or decrease the screen temperature.
2250transition=1
2251
2252; Set the screen brightness. Default is 1.0.
2253;brightness=0.9
2254; It is also possible to use different settings for day and night
2255; since version 1.8.
2256;brightness-day=0.7
2257;brightness-night=0.4
2258; Set the screen gamma (for all colors, or each color channel
2259; individually)
2260;gamma=0.8
2261;gamma=1.0
2262;gamma=0.8:0.7:0.8
2263; This can also be set individually for day and night since
2264; version 1.10.
2265;gamma-day=0.8:0.7:0.8
2266;gamma-night=0.6
2267
2268; Set the location-provider: 'geoclue2' or 'manual'
2269; type 'redshift -l list' to see possible values.
2270; The location provider settings are in a different section.
2271;location-provider=manual
2272location-provider=geoclue2
2273
2274; Set the adjustment-method: 'randr', 'vidmode'
2275; type 'redshift -m list' to see all possible values.
2276; 'randr' is the preferred method, 'vidmode' is an older API.
2277; but works in some cases when 'randr' does not.
2278; The adjustment method settings are in a different section.
2279adjustment-method=randr
2280
2281; Configuration of the location-provider:
2282; type 'redshift -l PROVIDER:help' to see the settings.
2283; ex: 'redshift -l manual:help'
2284; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
2285; are negative numbers.
2286;[manual]
2287;lat=48.1
2288;lon=11.6
2289
2290; Configuration of the adjustment-method
2291; type 'redshift -m METHOD:help' to see the settings.
2292; ex: 'redshift -m randr:help'
2293; In this example, randr is configured to adjust screen 1.
2294; Note that the numbering starts from 0, so this is actually the
2295; second screen. If this option is not specified, Redshift will try
2296; to adjust _all_ screens.
2297;[randr]
2298;screen=1
2299#+end_src
2300
2301** signature
2302:PROPERTIES:
2303:header-args+: :tangle ~/.signature
2304:END:
2305
2306My email signature.
2307
2308#+begin_src
2309Amin Bandali
2310Free Software activist | GNU maintainer & webmaster
2311GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
2312https://bandali.eu.org
2313#+end_src
2314
2315** systemd
2316
2317Keep boot messages on tty1 (see [[https://wiki.archlinux.org/index.php/getty#Have_boot_messages_stay_on_tty1][here]])
2318
2319#+begin_src conf :tangle /sudo::/etc/systemd/system/getty@tty1.service.d/noclear.conf
2320[Service]
2321TTYVTDisallocate=no
2322#+end_src
2323
2324** TLP
2325
2326*** langa
2327
2328#+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "langa")) "/sudo::/etc/default/tlp")
2329# ------------------------------------------------------------------------------
2330# tlp - Parameters for power saving
2331# See full explanation: https://linrunner.de/en/tlp/docs/tlp-configuration.html
2332
2333# Notes:
2334# - Some parameters are disabled, remove the leading '#' to enable # them;
2335# shown values are suggestions not defaults
2336# - Default *: intrinsic default that is effective when the parameter is missing
2337# or disabled by a leading '#'; use PARAM="" to disable intrinsic defaults for
2338# parameters with text string values
2339# - Default <none>: do nothing or use kernel/hardware defaults
2340
2341# Set to 0 to disable, 1 to enable TLP.
2342# Default: 0
2343TLP_ENABLE=1
2344
2345# Operation mode when no power supply can be detected: AC, BAT.
2346# Concerns some desktop and embedded hardware only.
2347# Default: <none>
2348TLP_DEFAULT_MODE=AC
2349
2350# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
2351# Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
2352# Default: 0
2353TLP_PERSISTENT_DEFAULT=0
2354
2355# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
2356# Non-zero value enables, zero disables laptop mode.
2357# Default: 0 (AC), 2 (BAT)
2358DISK_IDLE_SECS_ON_AC=0
2359DISK_IDLE_SECS_ON_BAT=2
2360
2361# Dirty page values (timeouts in secs).
2362# Default: 15 (AC + BAT)
2363MAX_LOST_WORK_SECS_ON_AC=15
2364MAX_LOST_WORK_SECS_ON_BAT=60
2365
2366# Note: CPU parameters below are disabled by default, remove the leading #
2367# to enable them, otherwise kernel defaults will be used.
2368
2369# Select a CPU frequency scaling governor.
2370# Intel Core i processor with intel_pstate driver:
2371# powersave(*), performance.
2372# Older hardware with acpi-cpufreq driver:
2373# ondemand(*), powersave, performance, conservative, schedutil.
2374# (*) is recommended.
2375# Use tlp-stat -p to show the active driver and available governors.
2376# Important:
2377# powersave for intel_pstate and ondemand for acpi-cpufreq are power
2378# efficient for *almost all* workloads and therefore kernel and most
2379# distributions have chosen them as defaults. If you still want to change,
2380# you should know what you're doing! You *must* disable your distribution's
2381# governor settings or conflicts will occur.
2382# Default: <none>
2383#CPU_SCALING_GOVERNOR_ON_AC=powersave
2384#CPU_SCALING_GOVERNOR_ON_BAT=powersave
2385
2386# Set the min/max frequency available for the scaling governor.
2387# Possible values depend on your CPU. For available frequencies see
2388# the output of tlp-stat -p.
2389# Default: <none>
2390#CPU_SCALING_MIN_FREQ_ON_AC=0
2391#CPU_SCALING_MAX_FREQ_ON_AC=0
2392#CPU_SCALING_MIN_FREQ_ON_BAT=0
2393#CPU_SCALING_MAX_FREQ_ON_BAT=0
2394
2395# Set energy performance hints (HWP) for Intel P-state governor:
2396# performance, balance_performance, default, balance_power, power
2397# Values are given in order of increasing power saving.
2398# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
2399# Default: <none>
2400CPU_HWP_ON_AC=balance_performance
2401CPU_HWP_ON_BAT=balance_power
2402
2403# Set Intel P-state performance: 0..100 (%).
2404# Limit the max/min P-state to control the power dissipation of the CPU.
2405# Values are stated as a percentage of the available performance.
2406# Requires an Intel Core i processor with intel_pstate driver.
2407# Default: <none>
2408#CPU_MIN_PERF_ON_AC=0
2409#CPU_MAX_PERF_ON_AC=100
2410#CPU_MIN_PERF_ON_BAT=0
2411#CPU_MAX_PERF_ON_BAT=30
2412
2413# Set the CPU "turbo boost" feature: 0=disable, 1=allow
2414# Requires an Intel Core i processor.
2415# Important:
2416# - This may conflict with your distribution's governor settings
2417# - A value of 1 does *not* activate boosting, it just allows it
2418# Default: <none>
2419#CPU_BOOST_ON_AC=1
2420#CPU_BOOST_ON_BAT=0
2421
2422# Minimize number of used CPU cores/hyper-threads under light load conditions:
2423# 0=disable, 1=enable.
2424# Default: <none>
2425SCHED_POWERSAVE_ON_AC=0
2426SCHED_POWERSAVE_ON_BAT=1
2427
2428# Kernel NMI Watchdog:
2429# 0=disable (default, saves power), 1=enable (for kernel debugging only).
2430# Default: <none>
2431NMI_WATCHDOG=0
2432
2433# Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
2434# Frequency voltage pairs are written to:
2435# /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
2436# CAUTION: only use this, if you thoroughly understand what you are doing!
2437# Default: <none>.
2438#PHC_CONTROLS="F:V F:V F:V F:V"
2439
2440# Set CPU performance versus energy savings policy:
2441# performance, balance-performance, default, balance-power, power.
2442# Values are given in order of increasing power saving.
2443# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
2444# Default: <none>
2445ENERGY_PERF_POLICY_ON_AC=performance
2446ENERGY_PERF_POLICY_ON_BAT=balance-power
2447
2448# Disk devices; separate multiple devices with spaces.
2449# Devices can be specified by disk ID also (lookup with: tlp diskid).
2450# Note: DISK parameters below are effective only when this option is configured.
2451# Default: "nvme0n1 sda"
2452DISK_DEVICES="sda sdb"
2453
2454# Disk advanced power management level: 1..254, 255 (max saving, min, off).
2455# Levels 1..127 may spin down the disk; 255 allowable on most drives.
2456# Separate values for multiple disks with spaces. Use the special value 'keep'
2457# to keep the hardware default for the particular disk.
2458# Default: <none>
2459DISK_APM_LEVEL_ON_AC="254 254"
2460DISK_APM_LEVEL_ON_BAT="128 128"
2461
2462# Hard disk spin down timeout:
2463# 0: spin down disabled
2464# 1..240: timeouts from 5s to 20min (in units of 5s)
2465# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
2466# See 'man hdparm' for details.
2467# Separate values for multiple disks with spaces. Use the special value 'keep'
2468# to keep the hardware default for the particular disk.
2469# Default: <none>
2470#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
2471#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
2472
2473# Select I/O scheduler for the disk devices.
2474# Multi queue (blk-mq) schedulers:
2475# mq-deadline(*), none, kyber, bfq
2476# Single queue schedulers:
2477# deadline(*), cfq, bfq, noop
2478# (*) recommended.
2479# Separate values for multiple disks with spaces. Use the special value 'keep'
2480# to keep the kernel default scheduler for the particular disk.
2481# Notes:
2482# - Multi queue (blk-mq) may need kernel boot option 'scsi_mod.use_blk_mq=1'
2483# and 'modprobe mq-deadline-iosched|kyber|bfq' on kernels < 5.0
2484# - Single queue schedulers are legacy now and were removed together with
2485# the old block layer in kernel 5.0
2486# Default: keep
2487#DISK_IOSCHED="mq-deadline mq-deadline"
2488
2489# AHCI link power management (ALPM) for disk devices:
2490# min_power, med_power_with_dipm(*), medium_power, max_performance.
2491# (*) Kernel >= 4.15 required, then recommended.
2492# Multiple values separated with spaces are tried sequentially until success.
2493# Default: <none>
2494SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
2495SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
2496
2497# Exclude host devices from AHCI link power management.
2498# Separate multiple hosts with spaces.
2499# Default: <none>
2500#SATA_LINKPWR_BLACKLIST="host1"
2501
2502# Runtime Power Management for AHCI host and disks devices:
2503# on=disable, auto=enable.
2504# EXPERIMENTAL ** WARNING: auto may cause system lockups/data loss.
2505# Default: <none>
2506#AHCI_RUNTIME_PM_ON_AC=on
2507#AHCI_RUNTIME_PM_ON_BAT=on
2508
2509# Seconds of inactivity before disk is suspended.
2510# Note: effective only when AHCI_RUNTIME_PM_ON_AC/BAT is activated.
2511# Default: 15
2512AHCI_RUNTIME_PM_TIMEOUT=15
2513
2514# PCI Express Active State Power Management (PCIe ASPM):
2515# default(*), performance, powersave.
2516# (*) keeps BIOS ASPM defaults (recommended)
2517# Default: <none>
2518#PCIE_ASPM_ON_AC=default
2519#PCIE_ASPM_ON_BAT=default
2520
2521# Set the min/max/turbo frequency for the Intel GPU.
2522# Possible values depend on your hardware. For available frequencies see
2523# the output of tlp-stat -g.
2524# Default: <none>
2525#INTEL_GPU_MIN_FREQ_ON_AC=0
2526#INTEL_GPU_MIN_FREQ_ON_BAT=0
2527#INTEL_GPU_MAX_FREQ_ON_AC=0
2528#INTEL_GPU_MAX_FREQ_ON_BAT=0
2529#INTEL_GPU_BOOST_FREQ_ON_AC=0
2530#INTEL_GPU_BOOST_FREQ_ON_BAT=0
2531
2532# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
2533# auto = mid on BAT, high on AC.
2534# Default: default
2535RADEON_POWER_PROFILE_ON_AC=default
2536RADEON_POWER_PROFILE_ON_BAT=default
2537
2538# Radeon dynamic power management method (DPM): battery, performance.
2539# Default: <none>
2540RADEON_DPM_STATE_ON_AC=performance
2541RADEON_DPM_STATE_ON_BAT=battery
2542
2543# Radeon DPM performance level: auto, low, high; auto is recommended.
2544# Note: effective only when RADEON_DPM_STATE_ON_AC/BAT is activated.
2545# Default: auto
2546RADEON_DPM_PERF_LEVEL_ON_AC=auto
2547RADEON_DPM_PERF_LEVEL_ON_BAT=auto
2548
2549# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
2550# Default: <none>
2551WIFI_PWR_ON_AC=off
2552WIFI_PWR_ON_BAT=on
2553
2554# Disable wake on LAN: Y/N.
2555# Default: N
2556WOL_DISABLE=Y
2557
2558# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
2559# A value of 0 disables, >=1 enables power saving (recommended: 1).
2560# Default: <none>
2561SOUND_POWER_SAVE_ON_AC=0
2562SOUND_POWER_SAVE_ON_BAT=0
2563
2564# Disable controller too (HDA only): Y/N.
2565# Note: effective only when SOUND_POWER_SAVE_ON_AC/BAT is activated.
2566# Default: Y
2567SOUND_POWER_SAVE_CONTROLLER=N
2568
2569# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
2570# Drive can be powered on again by releasing (and reinserting) the eject lever
2571# or by pressing the disc eject button on newer models.
2572# Note: an UltraBay/MediaBay hard disk is never powered off.
2573# Default: 0
2574BAY_POWEROFF_ON_AC=0
2575BAY_POWEROFF_ON_BAT=0
2576# Optical drive device to power off
2577# Default: sr0
2578BAY_DEVICE="sr0"
2579
2580# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
2581# Default: <none>
2582RUNTIME_PM_ON_AC=on
2583RUNTIME_PM_ON_BAT=auto
2584
2585# Exclude PCI(e) device adresses the following list from Runtime PM
2586# (separate with spaces). Use lspci to get the adresses (1st column).
2587# Default: <none>
2588#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
2589
2590# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
2591# Default when unconfigured is "amdgpu nouveau nvidia radeon" which
2592# prevents accidential power-on of dGPU in hybrid graphics setups.
2593# Separate multiple drivers with spaces.
2594# Default: "amdgpu mei_me nouveau nvidia pcieport radeon", use "" to disable
2595# completely.
2596#RUNTIME_PM_DRIVER_BLACKLIST="amdgpu mei_me nouveau nvidia pcieport radeon"
2597
2598# Set to 0 to disable, 1 to enable USB autosuspend feature.
2599# Default: 0
2600USB_AUTOSUSPEND=1
2601
2602# Exclude listed devices from USB autosuspend (separate with spaces).
2603# Use lsusb to get the ids.
2604# Note: input devices (usbhid) are excluded automatically
2605# Default: <none>
2606#USB_BLACKLIST="1111:2222 3333:4444"
2607
2608# Bluetooth devices are excluded from USB autosuspend:
2609# 0=do not exclude, 1=exclude.
2610# Default: 0
2611USB_BLACKLIST_BTUSB=0
2612
2613# Phone devices are excluded from USB autosuspend:
2614# 0=do not exclude, 1=exclude (enable charging).
2615# Default: 0
2616USB_BLACKLIST_PHONE=0
2617
2618# Printers are excluded from USB autosuspend:
2619# 0=do not exclude, 1=exclude.
2620# Default: 1
2621USB_BLACKLIST_PRINTER=1
2622
2623# WWAN devices are excluded from USB autosuspend:
2624# 0=do not exclude, 1=exclude.
2625# Default: 0
2626USB_BLACKLIST_WWAN=0
2627
2628# Include listed devices into USB autosuspend even if already excluded
2629# by the blacklists above (separate with spaces). Use lsusb to get the ids.
2630# Default: <none>
2631#USB_WHITELIST="1111:2222 3333:4444"
2632
2633# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
2634# (workaround for USB devices that cause shutdown problems).
2635# Default: 0
2636#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
2637
2638# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
2639# on system startup: 0=disable, 1=enable.
2640# Note: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
2641# are ignored when this is enabled.
2642# Default: 0
2643#RESTORE_DEVICE_STATE_ON_STARTUP=0
2644RESTORE_DEVICE_STATE_ON_STARTUP=1
2645
2646# Radio devices to disable on startup: bluetooth, wifi, wwan.
2647# Separate multiple devices with spaces.
2648# Default: <none>
2649#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
2650
2651# Radio devices to enable on startup: bluetooth, wifi, wwan.
2652# Separate multiple devices with spaces.
2653# Default: <none>
2654#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
2655
2656# Radio devices to disable on shutdown: bluetooth, wifi, wwan.
2657# (workaround for devices that are blocking shutdown).
2658# Default: <none>
2659#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
2660
2661# Radio devices to enable on shutdown: bluetooth, wifi, wwan.
2662# (to prevent other operating systems from missing radios).
2663# Default: <none>
2664#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
2665
2666# Radio devices to enable on AC: bluetooth, wifi, wwan.
2667# Default: <none>
2668#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
2669
2670# Radio devices to disable on battery: bluetooth, wifi, wwan.
2671# Default: <none>
2672#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
2673DEVICES_TO_DISABLE_ON_BAT="bluetooth"
2674
2675# Radio devices to disable on battery when not in use (not connected):
2676# bluetooth, wifi, wwan.
2677# Default: <none>
2678#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
2679
2680# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
2681# required). Charging starts when the remaining capacity falls below the
2682# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
2683# Main / Internal battery (values in %)
2684# Default: <none>
2685#START_CHARGE_THRESH_BAT0=75
2686#STOP_CHARGE_THRESH_BAT0=80
2687# Ultrabay / Slice / Replaceable battery (values in %)
2688# Default: <none>
2689#START_CHARGE_THRESH_BAT1=75
2690#STOP_CHARGE_THRESH_BAT1=80
2691
2692# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
2693# Default: 0
2694#RESTORE_THRESHOLDS_ON_BAT=1
2695
2696# Battery feature drivers: 0=disable, 1=enable
2697# Default: 1 (all)
2698NATACPI_ENABLE=1
2699TPACPI_ENABLE=1
2700TPSMAPI_ENABLE=1
2701
2702# ------------------------------------------------------------------------------
2703# tlp-rdw - Parameters for the radio device wizard
2704# Possible devices: bluetooth, wifi, wwan.
2705
2706# Notes:
2707# - Parameters are disabled by default, remove the leading # to enable them
2708# - Separate multiple radio devices with spaces
2709
2710# Default: <none> (for all parameters below)
2711
2712# Radio devices to disable on connect.
2713#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
2714#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
2715#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
2716
2717# Radio devices to enable on disconnect.
2718#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
2719#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
2720#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
2721
2722# Radio devices to enable/disable when docked.
2723#DEVICES_TO_ENABLE_ON_DOCK=""
2724#DEVICES_TO_DISABLE_ON_DOCK=""
2725
2726# Radio devices to enable/disable when undocked.
2727#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
2728#DEVICES_TO_DISABLE_ON_UNDOCK=""
2729#+end_src
2730
2731*** shemshak
2732
2733#+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "shemshak")) "/sudo::/etc/default/tlp")
2734# ------------------------------------------------------------------------------
2735# tlp - Parameters for power saving
2736# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
2737
2738# Hint: some features are disabled by default, remove the leading # to enable
2739# them.
2740
2741# Set to 0 to disable, 1 to enable TLP.
2742TLP_ENABLE=1
2743
2744# Operation mode when no power supply can be detected: AC, BAT.
2745# Concerns some desktop and embedded hardware only.
2746TLP_DEFAULT_MODE=AC
2747
2748# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
2749# Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
2750TLP_PERSISTENT_DEFAULT=0
2751
2752# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
2753# Non-zero value enables, zero disables laptop mode.
2754DISK_IDLE_SECS_ON_AC=0
2755DISK_IDLE_SECS_ON_BAT=2
2756
2757# Dirty page values (timeouts in secs).
2758MAX_LOST_WORK_SECS_ON_AC=15
2759MAX_LOST_WORK_SECS_ON_BAT=60
2760
2761# Hint: CPU parameters below are disabled by default, remove the leading #
2762# to enable them, otherwise kernel default values are used.
2763
2764# Select a CPU frequency scaling governor.
2765# Intel Core i processor with intel_pstate driver:
2766# powersave(*), performance.
2767# Older hardware with acpi-cpufreq driver:
2768# ondemand(*), powersave, performance, conservative, schedutil.
2769# (*) is recommended.
2770# Hint: use tlp-stat -p to show the active driver and available governors.
2771# Important:
2772# powersave for intel_pstate and ondemand for acpi-cpufreq are power
2773# efficient for *almost all* workloads and therefore kernel and most
2774# distributions have chosen them as defaults. If you still want to change,
2775# you should know what you're doing! You *must* disable your distribution's
2776# governor settings or conflicts will occur.
2777#CPU_SCALING_GOVERNOR_ON_AC=powersave
2778#CPU_SCALING_GOVERNOR_ON_BAT=powersave
2779
2780# Set the min/max frequency available for the scaling governor.
2781# Possible values strongly depend on your CPU. For available frequencies see
2782# the output of tlp-stat -p.
2783#CPU_SCALING_MIN_FREQ_ON_AC=0
2784#CPU_SCALING_MAX_FREQ_ON_AC=0
2785#CPU_SCALING_MIN_FREQ_ON_BAT=0
2786#CPU_SCALING_MAX_FREQ_ON_BAT=0
2787
2788# Set energy performance hints (HWP) for Intel P-state governor:
2789# performance, balance_performance, default, balance_power, power
2790# Values are given in order of increasing power saving.
2791# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
2792CPU_HWP_ON_AC=balance_performance
2793CPU_HWP_ON_BAT=balance_power
2794
2795# Set Intel P-state performance: 0..100 (%).
2796# Limit the max/min P-state to control the power dissipation of the CPU.
2797# Values are stated as a percentage of the available performance.
2798# Requires an Intel Core i processor with intel_pstate driver.
2799#CPU_MIN_PERF_ON_AC=0
2800#CPU_MAX_PERF_ON_AC=100
2801#CPU_MIN_PERF_ON_BAT=0
2802#CPU_MAX_PERF_ON_BAT=30
2803
2804# Set the CPU "turbo boost" feature: 0=disable, 1=allow
2805# Requires an Intel Core i processor.
2806# Important:
2807# - This may conflict with your distribution's governor settings
2808# - A value of 1 does *not* activate boosting, it just allows it
2809#CPU_BOOST_ON_AC=1
2810#CPU_BOOST_ON_BAT=0
2811
2812# Minimize number of used CPU cores/hyper-threads under light load conditions:
2813# 0=disable, 1=enable.
2814SCHED_POWERSAVE_ON_AC=0
2815SCHED_POWERSAVE_ON_BAT=1
2816
2817# Kernel NMI Watchdog:
2818# 0=disable (default, saves power), 1=enable (for kernel debugging only).
2819NMI_WATCHDOG=0
2820
2821# Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
2822# Frequency voltage pairs are written to:
2823# /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
2824# CAUTION: only use this, if you thoroughly understand what you are doing!
2825#PHC_CONTROLS="F:V F:V F:V F:V"
2826
2827# Set CPU performance versus energy savings policy:
2828# performance, balance-performance, default, balance-power, power.
2829# Values are given in order of increasing power saving.
2830# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
2831ENERGY_PERF_POLICY_ON_AC=performance
2832ENERGY_PERF_POLICY_ON_BAT=balance-power
2833
2834# Disk devices; separate multiple devices with spaces (default: sda).
2835# Devices can be specified by disk ID also (lookup with: tlp diskid).
2836DISK_DEVICES="sda sdb"
2837
2838# Disk advanced power management level: 1..254, 255 (max saving, min, off).
2839# Levels 1..127 may spin down the disk; 255 allowable on most drives.
2840# Separate values for multiple disks with spaces. Use the special value 'keep'
2841# to keep the hardware default for the particular disk.
2842DISK_APM_LEVEL_ON_AC="254 254"
2843DISK_APM_LEVEL_ON_BAT="128 128"
2844
2845# Hard disk spin down timeout:
2846# 0: spin down disabled
2847# 1..240: timeouts from 5s to 20min (in units of 5s)
2848# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
2849# See 'man hdparm' for details.
2850# Separate values for multiple disks with spaces. Use the special value 'keep'
2851# to keep the hardware default for the particular disk.
2852#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
2853#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
2854
2855# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
2856# Separate values for multiple disks with spaces. Use the special value 'keep'
2857# to keep the kernel default scheduler for the particular disk.
2858#DISK_IOSCHED="cfq cfq"
2859
2860# AHCI link power management (ALPM) for disk devices:
2861# min_power, med_power_with_dipm(*), medium_power, max_performance.
2862# (*) Kernel >= 4.15 required, then recommended.
2863# Multiple values separated with spaces are tried sequentially until success.
2864SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
2865SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
2866
2867# Exclude host devices from AHCI link power management.
2868# Separate multiple hosts with spaces.
2869#SATA_LINKPWR_BLACKLIST="host1"
2870
2871# Runtime Power Management for AHCI host and disks devices:
2872# on=disable, auto=enable.
2873# EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
2874#AHCI_RUNTIME_PM_ON_AC=on
2875#AHCI_RUNTIME_PM_ON_BAT=on
2876
2877# Seconds of inactivity before disk is suspended.
2878AHCI_RUNTIME_PM_TIMEOUT=15
2879
2880# PCI Express Active State Power Management (PCIe ASPM):
2881# default, performance, powersave.
2882PCIE_ASPM_ON_AC=performance
2883PCIE_ASPM_ON_BAT=powersave
2884
2885# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
2886# auto = mid on BAT, high on AC; default = use hardware defaults.
2887RADEON_POWER_PROFILE_ON_AC=high
2888RADEON_POWER_PROFILE_ON_BAT=low
2889
2890# Radeon dynamic power management method (DPM): battery, performance.
2891RADEON_DPM_STATE_ON_AC=performance
2892RADEON_DPM_STATE_ON_BAT=battery
2893
2894# Radeon DPM performance level: auto, low, high; auto is recommended.
2895RADEON_DPM_PERF_LEVEL_ON_AC=auto
2896RADEON_DPM_PERF_LEVEL_ON_BAT=auto
2897
2898# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
2899WIFI_PWR_ON_AC=off
2900WIFI_PWR_ON_BAT=on
2901
2902# Disable wake on LAN: Y/N.
2903WOL_DISABLE=Y
2904
2905# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
2906# A value of 0 disables, >=1 enables power saving (recommended: 1).
2907SOUND_POWER_SAVE_ON_AC=0
2908SOUND_POWER_SAVE_ON_BAT=0
2909
2910# Disable controller too (HDA only): Y/N.
2911SOUND_POWER_SAVE_CONTROLLER=N
2912
2913# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
2914# Drive can be powered on again by releasing (and reinserting) the eject lever
2915# or by pressing the disc eject button on newer models.
2916# Note: an UltraBay/MediaBay hard disk is never powered off.
2917BAY_POWEROFF_ON_AC=0
2918BAY_POWEROFF_ON_BAT=0
2919# Optical drive device to power off (default sr0).
2920BAY_DEVICE="sr0"
2921
2922# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
2923RUNTIME_PM_ON_AC=on
2924RUNTIME_PM_ON_BAT=auto
2925
2926# Exclude PCI(e) device adresses the following list from Runtime PM
2927# (separate with spaces). Use lspci to get the adresses (1st column).
2928#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
2929RUNTIME_PM_BLACKLIST="01:00.0"
2930
2931# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
2932# Default when unconfigured is "amdgpu nouveau nvidia radeon" which
2933# prevents accidential power-on of dGPU in hybrid graphics setups.
2934# Use "" to disable the feature completely.
2935# Separate multiple drivers with spaces.
2936#RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"
2937
2938# Set to 0 to disable, 1 to enable USB autosuspend feature.
2939USB_AUTOSUSPEND=1
2940
2941# Exclude listed devices from USB autosuspend (separate with spaces).
2942# Use lsusb to get the ids.
2943# Note: input devices (usbhid) are excluded automatically
2944#USB_BLACKLIST="1111:2222 3333:4444"
2945
2946# Bluetooth devices are excluded from USB autosuspend:
2947# 0=do not exclude, 1=exclude.
2948USB_BLACKLIST_BTUSB=0
2949
2950# Phone devices are excluded from USB autosuspend:
2951# 0=do not exclude, 1=exclude (enable charging).
2952USB_BLACKLIST_PHONE=0
2953
2954# Printers are excluded from USB autosuspend:
2955# 0=do not exclude, 1=exclude.
2956USB_BLACKLIST_PRINTER=1
2957
2958# WWAN devices are excluded from USB autosuspend:
2959# 0=do not exclude, 1=exclude.
2960USB_BLACKLIST_WWAN=1
2961
2962# Include listed devices into USB autosuspend even if already excluded
2963# by the blacklists above (separate with spaces).
2964# Use lsusb to get the ids.
2965#USB_WHITELIST="1111:2222 3333:4444"
2966
2967# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
2968# (workaround for USB devices that cause shutdown problems).
2969#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
2970
2971# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
2972# on system startup: 0=disable, 1=enable.
2973# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
2974# are ignored when this is enabled!
2975#RESTORE_DEVICE_STATE_ON_STARTUP=0
2976RESTORE_DEVICE_STATE_ON_STARTUP=1
2977
2978# Radio devices to disable on startup: bluetooth, wifi, wwan.
2979# Separate multiple devices with spaces.
2980#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
2981
2982# Radio devices to enable on startup: bluetooth, wifi, wwan.
2983# Separate multiple devices with spaces.
2984#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
2985
2986# Radio devices to disable on shutdown: bluetooth, wifi, wwan.
2987# (workaround for devices that are blocking shutdown).
2988#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
2989
2990# Radio devices to enable on shutdown: bluetooth, wifi, wwan.
2991# (to prevent other operating systems from missing radios).
2992#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
2993
2994# Radio devices to enable on AC: bluetooth, wifi, wwan.
2995#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
2996
2997# Radio devices to disable on battery: bluetooth, wifi, wwan.
2998#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
2999
3000# Radio devices to disable on battery when not in use (not connected):
3001# bluetooth, wifi, wwan.
3002#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
3003
3004# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
3005# required). Charging starts when the remaining capacity falls below the
3006# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
3007# Main / Internal battery (values in %)
3008#START_CHARGE_THRESH_BAT0=75
3009#STOP_CHARGE_THRESH_BAT0=80
3010# Ultrabay / Slice / Replaceable battery (values in %)
3011#START_CHARGE_THRESH_BAT1=75
3012#STOP_CHARGE_THRESH_BAT1=80
3013
3014# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
3015#RESTORE_THRESHOLDS_ON_BAT=1
3016
3017# ------------------------------------------------------------------------------
3018# tlp-rdw - Parameters for the radio device wizard
3019# Possible devices: bluetooth, wifi, wwan.
3020
3021# Hints:
3022# - Parameters are disabled by default, remove the leading # to enable them
3023# - Separate multiple radio devices with spaces
3024
3025# Radio devices to disable on connect.
3026#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
3027#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
3028#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
3029
3030# Radio devices to enable on disconnect.
3031#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
3032#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
3033#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
3034
3035# Radio devices to enable/disable when docked.
3036#DEVICES_TO_ENABLE_ON_DOCK=""
3037#DEVICES_TO_DISABLE_ON_DOCK=""
3038
3039# Radio devices to enable/disable when undocked.
3040#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
3041#DEVICES_TO_DISABLE_ON_UNDOCK=""
3042#+end_src
3043
3044** X
3045
3046*** xinit
3047:PROPERTIES:
3048:header-args+: :tangle ~/.xinitrc
3049:END:
3050
3051#+begin_src sh
3052[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
3053#+end_src
3054
3055*** X resources
3056
3057#+begin_src conf-xdefaults :tangle (when (eq system-type 'gnu/linux) "~/.Xresources")
3058#include ".Xresources.d/fonts"
3059#include ".Xresources.d/emacs"
3060#include ".Xresources.d/rxvt-unicode"
3061#+end_src
3062
3063**** emacs
3064:PROPERTIES:
3065:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/emacs")
3066:END:
3067
3068#+begin_src conf-xdefaults
3069Emacs.menuBar: off
3070Emacs.toolBar: off
3071Emacs.verticalScrollBars: off
3072Emacs.cursorBlink: off
3073Emacs.FontBackend: xft,x
3074! Emacs.font: Ubuntu Mono-12
3075! Emacs.font: Triplicate T4C-11
3076! Emacs.font: Ubuntu Mono-10.5
3077! Emacs.font: Ubuntu Mono-12
3078! Emacs.font: Iosevka-11
3079
3080! Emacs.font: Fira Mono:size=15
3081! Emacs.font: DejaVu Sans Mono:size=15
3082! Emacs.font: Inconsolata:size=17
3083! Emacs.font: Inconsolata:size=16
3084! Emacs.font: Inconsolata LGC:size=14
3085! Emacs.font: Source Code Pro Medium-10.5
3086Emacs.font: Source Code Pro Medium:size=14
3087! Emacs.font: Ubuntu Mono:size=16
3088! Emacs.font: Iosevka:size=16
3089#+end_src
3090
3091**** fonts
3092:PROPERTIES:
3093:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/fonts")
3094:END:
3095
3096#+begin_src conf-xdefaults
3097Xft.lcdfilter: lcddefault
3098Xft.antialias: true
3099Xft.autohint: 0
3100Xft.hinting: true
3101Xft.hintstyle: hintslight
3102! Xft.hintstyle: hintfull
3103Xft.rgba: rgb
3104Xft.dpi: 96
3105#+end_src
3106
3107**** rxvt-unicode
3108:PROPERTIES:
3109:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/rxvt-unicode")
3110:END:
3111
3112#+begin_src conf-xdefaults
3113! Font
3114URxvt.font: xft:source code pro:pixelsize=14:antialias=true:hinting=true, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true
3115URxvt.boldFont: xft:source code pro:semibold:pixelsize=14:antialias=true:hinting=true:bold, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bold
3116URxvt.italicFont: xft:source code pro:italic:pixelsize=14:antialias=true:hinting=true:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:italic
3117URxvt.bolditalicFont: xft:source code pro:semibold:italic:pixelsize=14:antialias=true:hinting=true:bold:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bolditalic
3118
3119URxvt.xftAntialias: true
3120URxvt.letterSpace: -1
3121
3122!URxvt.depth: 0
3123!URxvt.loginShell: true
3124!URxvt*buffered: false
3125URxvt.saveLines: 100000
3126URxvt.internalBorder: 3
3127URxvt.lineSpace: 0
3128URxvt.scrollBar: false
3129URxvt.scrollStyle: rxvt
3130URxvt*scrollTtyOutput: false
3131URxvt*scrollWithBuffer: true
3132URxvt*scrollTtyKeypress: true
3133URxvt.keysym.Shift-Up: command:\033]720;1\007
3134URxvt.keysym.Shift-Down: command:\033]721;1\007
3135
3136URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
3137URxvt.url-select.launcher: firefox
3138URxvt.url-select.underline: true
3139URxvt.keysym.M-u: perl:url-select:select_next
3140URxvt.keysym.M-Escape: perl:keyboard-select:activate
3141URxvt.keysym.M-s: perl:keyboard-select:search
3142URxvt.url-launcher: /usr/bin/abrowser
3143URxvt.matcher.button: 1
3144! URxvt.iso14755: false
3145! URxvt.iso14755_53: false
3146! URxvt.keysym.M-c: perl:clipboard:copy
3147! URxvt.keysym.M-v: perl:clipboard:paste
3148URxvt.keysym.M-c: eval:selection_to_clipboard
3149URxvt.keysym.M-v: eval:paste_clipboard
3150URxvt.keysym.C-A-V: perl:clipboard:paste_escaped
3151! URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
3152! URxvt.keysym.Shift-Control-V: eval:paste_clipboard
3153URxvt.keysym.C-Up: font-size:increase
3154URxvt.keysym.C-Down: font-size:decrease
3155URxvt.keysym.C-S-Up: font-size:incglobal
3156URxvt.keysym.C-S-Down: font-size:decglobal
3157URxvt.keysym.C-equal: font-size:reset
3158!URxvt.keysym.C-question: font-size:show
3159
3160!URxvt.iconFile: /usr/share/icons/elementary-xfce/apps/48/terminal.png
3161
3162!urxvt*foreground: white
3163!urxvt*background: black
3164
3165!*color0: #2E3436
3166!*color1: #a40000
3167!*color2: #4E9A06
3168!*color3: #C4A000
3169!*color4: #3465A4
3170!*color5: #75507B
3171!*color6: #ce5c00
3172!*color7: #babdb9
3173!*color8: #555753
3174!*color9: #EF2929
3175!*color10: #8AE234
3176!*color11: #FCE94F
3177!*color12: #729FCF
3178!*color13: #AD7FA8
3179!*color14: #fcaf3e
3180!*color15: #EEEEEC
3181
3182!URxvt.foreground: #C8C8C8
3183!URxvt.background: #FFFFFF
3184
3185!! black
3186!*color0: #2E3436
3187!*color8: #555753
3188!! red
3189!*color1: #a40000
3190!*color9: #EF2929
3191!! green
3192!*color2: #4E9A06
3193!*color10: #8AE234
3194!! yellow
3195!*color3: #C4A000
3196!*color11: #FCE94F
3197!! blue
3198!*color4: #3465A4
3199!*color12: #729FCF
3200!! purple
3201!*color5: #75507B
3202!*color13: #AD7FA8
3203!! orange (replaces cyan)
3204!*color6: #ce5c00
3205!*color14: #fcaf3e
3206!! white
3207!*color7: #babdb9
3208!*color15: #EEEEEC
3209
3210
3211! ! Solarized
3212! ! Base16 Solarized Light
3213! ! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized)
3214
3215! #define base00 #fdf6e3
3216! #define base01 #eee8d5
3217! #define base02 #93a1a1
3218! #define base03 #839496
3219! #define base04 #657b83
3220! #define base05 #586e75
3221! #define base06 #073642
3222! #define base07 #002b36
3223! #define base08 #dc322f
3224! #define base09 #cb4b16
3225! #define base0A #b58900
3226! #define base0B #859900
3227! #define base0C #2aa198
3228! #define base0D #268bd2
3229! #define base0E #6c71c4
3230! #define base0F #d33682
3231
3232! *foreground: base05
3233! #ifdef background_opacity
3234! *background: [background_opacity]base00
3235! #else
3236! *background: base00
3237! #endif
3238! *cursorColor: base05
3239
3240! *color0: base00
3241! *color1: base08
3242! *color2: base0B
3243! *color3: base0A
3244! *color4: base0D
3245! *color5: base0E
3246! *color6: base0C
3247! *color7: base05
3248
3249! *color8: base03
3250! *color9: base08
3251! *color10: base0B
3252! *color11: base0A
3253! *color12: base0D
3254! *color13: base0E
3255! *color14: base0C
3256! *color15: base07
3257
3258! ! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
3259! ! use 'shell' template to set these if necessary
3260! *color16: base09
3261! *color17: base0F
3262! *color18: base01
3263! *color19: base02
3264! *color20: base04
3265! *color21: base06
3266
3267
3268! Tango colour theme for rxvt-unicode
3269URxvt.background: #FFFFFF
3270URxvt.foreground: #000000
3271
3272! Black
3273URxvt.color0: #2E3436
3274URxvt.color8: #757773
3275
3276! Red
3277URxvt.color1: #CC0000
3278URxvt.color9: #EF2929
3279
3280! Green
3281URxvt.color2: #4E9A06
3282URxvt.color10: #8AE234
3283
3284! Yellow
3285URxvt.color3: #C4A000
3286URxvt.color11: #FCE94F
3287
3288! Blue
3289URxvt.color4: #3465A4
3290URxvt.color12: #729FCF
3291
3292! Magenta
3293URxvt.color5: #75507B
3294URxvt.color13: #AD7FA8
3295
3296!! Cyan
3297!URxvt.color6: #06989A
3298!URxvt.color14: #34E2E2
3299! orange (replaces cyan)
3300,,*color6: #ce5c00
3301,,*color14: #fcaf3e
3302
3303! White
3304URxvt.color7: #D3D7CF
3305URxvt.color15: #EEEEEC
3306#+end_src
3307
3308*** ~/.xsession
3309:PROPERTIES:
3310:header-args+: :tangle ~/.xsession :tangle-mode (identity #o755)
3311:END:
3312
3313For custom session on Debian. See https://wiki.debian.org/Xsession.
3314
3315#+begin_src sh
3316if [ -f "$HOME/.xinitrc" ]; then
3317 . "$HOME/.xinitrc"
3318fi
3319
3320[ -f "/usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd" ] && /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd &
3321[ -x "$(command -v light-locker)" ] && light-locker --lock-on-suspend &
3322[ -x "$(command -v pasystray)" ] && pasystray -a &
3323[ -x "$(command -v nm-applet)" ] && nm-applet &
3324[ -x "$(command -v compton)" ] && compton &
3325[ -x "$(command -v dunst)" ] && dunst &
3326[ -x "$(command -v emacs)" ] && exec ssh-agent exwm -ib 0
3327#+end_src
3328
3329*** ~/.xsessionrc
3330:PROPERTIES:
3331:header-args+: :tangle ~/.xsessionrc
3332:END:
3333
3334#+begin_src sh
3335if [ -f "$HOME/.profile" ]; then . "$HOME/.profile"; fi
3336#+end_src
3337
3338** XDG
3339:PROPERTIES:
3340:header-args+: :tangle ~/.config/user-dirs.dirs
3341:END:
3342
3343#+begin_src conf
3344XDG_DESKTOP_DIR="$HOME/Desktop"
3345XDG_DOCUMENTS_DIR="$HOME/usr/doc"
3346XDG_DOWNLOAD_DIR="$HOME/usr/dl"
3347XDG_MUSIC_DIR="$HOME/usr/music"
3348XDG_PICTURES_DIR="$HOME/usr/pic"
3349XDG_PUBLICSHARE_DIR="$HOME/usr/pub"
3350XDG_TEMPLATES_DIR="$HOME/usr/temp"
3351XDG_VIDEOS_DIR="$HOME/usr/vid"
3352#+end_src
3353
3354** zathura
3355:PROPERTIES:
3356:header-args+: :tangle ~/.config/zathura/zathurarc
3357:END:
3358
3359#+begin_src conf
3360set smooth-scroll true
3361set selection-clipboard clipboard
3362set zoom-step 05
3363set default-bg "#272727"
3364set statusbar-bg "#272727"
3365set inputbar-bg "#373737"
3366set window-title-basename true
3367set statusbar-home-tilde true
3368
3369map <Return> scroll down
3370map <A-Return> scroll up
3371
3372map H jumplist backward
3373map L jumplist forward
3374
3375map [normal] i toggle_index
3376map [index] i toggle_index
3377map [index] q toggle_index
3378#+end_src
3379
3380* Scripts
3381
3382This section contains various useful scripts including ones used by
3383the programs above. For instance, =toggle-tablet= for switching to
3384and from tablet mode on my X220T, =toggle-presentation-mode= for
3385toggling Xfce's presentation mode which keeps the screen awake, and
3386=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
3387exact brightness value.
3388
3389** battery-percentage-time
3390:PROPERTIES:
3391:header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh"
3392:END:
3393
3394#+begin_src sh :tangle no
3395dbus_send() {
3396 label=$1
3397 dbus-send --print-reply=literal --system \
3398 --dest=org.freedesktop.UPower \
3399 /org/freedesktop/UPower/devices/battery_BAT0 \
3400 org.freedesktop.DBus.Properties.Get \
3401 string:org.freedesktop.UPower.Device \
3402 string:"${label}" | awk '{print $3}'
3403}
3404
3405perc=$(dbus_send 'Percentage')
3406state=$(dbus_send 'State')
3407
3408if [ "$state" -eq 2 ]; then # Discharging
3409 secs=$(dbus_send 'TimeToEmpty')
3410elif [ "$state" -eq 1 ]; then # Charging
3411 secs=$(dbus_send 'TimeToFull')
3412fi
3413
3414printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
3415#+end_src
3416
3417** emcl
3418:PROPERTIES:
3419:header-args+: :tangle ~/.local/bin/emcl :shebang "#!/bin/sh"
3420:END:
3421
3422#+begin_src sh
3423exec emacsclient --alternate-editor="" -c "$@"
3424#+end_src
3425
3426** my-i3status
3427:PROPERTIES:
3428:header-args+: :tangle ~/.local/bin/emcl :shebang "#!/usr/bin/env python2"
3429:END:
3430
3431#+begin_src python
3432# -*- coding: utf-8 -*-
3433
3434# This script is a simple wrapper which prefixes each i3status line with custom
3435# information. It is based on:
3436# https://github.com/i3/i3status/blob/master/contrib/wrapper.py
3437#
3438# In ~/.i3status.conf, add the following line:
3439# output_format = "i3bar"
3440# in the 'general' section.
3441# Then, in ~/.config/i3/config or ~/.config/sway/config add:
3442# status_command i3status | my-i3status.py
3443# in the 'bar' section. Make sure my-i3status.py is in $PATH.
3444#
3445# © 2012 Valentin Haenel <valentin.haenel@gmx.de>
3446# © 2018 Amin Bandali <bandali@gnu.org>
3447#
3448# This program is free software. It comes without any warranty, to the extent
3449# permitted by applicable law. You can redistribute it and/or modify it under
3450# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
3451# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
3452# details.
3453
3454import sys
3455import json
3456import os
3457
3458def get_nosleep():
3459 """ Return true if ~/.nosleep exists. """
3460 return os.path.isfile(os.path.expanduser("~/.nosleep"))
3461
3462def print_line(message):
3463 """ Non-buffered printing to stdout. """
3464 sys.stdout.write(message + '\n')
3465 sys.stdout.flush()
3466
3467def read_line():
3468 """ Interrupted respecting reader for stdin. """
3469 # try reading a line, removing any extra whitespace
3470 try:
3471 line = sys.stdin.readline().strip()
3472 # i3status sends EOF, or an empty line
3473 if not line:
3474 sys.exit(3)
3475 return line
3476 # exit on ctrl-c
3477 except KeyboardInterrupt:
3478 sys.exit()
3479
3480if __name__ == '__main__':
3481 # Skip the first line which contains the version header.
3482 print_line(read_line())
3483
3484 # The second line contains the start of the infinite array.
3485 print_line(read_line())
3486
3487 while True:
3488 line, prefix = read_line(), ''
3489 # ignore comma at start of lines
3490 if line.startswith(','):
3491 line, prefix = line[1:], ','
3492
3493 if get_nosleep():
3494 j = json.loads(line)
3495 # insert information into the start of the json, but could be anywhere
3496 j.insert(0, {'full_text' : '•', 'name' : 'nosleep'})
3497 # and echo back new encoded json
3498 print_line(prefix+json.dumps(j))
3499 else:
3500 print_line(prefix+line)
3501#+end_src
3502
3503** rofi-light
3504:PROPERTIES:
3505:header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/sh"
3506:END:
3507
3508#+begin_src sh
3509cur=$(light -G)
3510val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12)
3511[ -n "$val" ] && light -S "$val"
3512#+end_src
3513
3514** rofi-remmina
3515:PROPERTIES:
3516:header-args+: :tangle ~/.local/bin/rofi-remmina :shebang "#!/usr/bin/env python2"
3517:END:
3518
3519#+begin_src python
3520import ConfigParser
3521import os
3522from subprocess import Popen, PIPE
3523
3524remmina_dir = os.path.expanduser("~/.local/share/remmina")
3525
3526fdict = dict()
3527
3528for f in os.listdir(remmina_dir):
3529 fp = os.path.join(remmina_dir, f)
3530 c = ConfigParser.ConfigParser()
3531 c.read(fp)
3532 n = c.get('remmina', 'name')
3533 fdict[n] = fp
3534
3535lines = max(min(15, len(fdict)), 1);
3536width = len(max(fdict.keys(), key=len))
3537rofi = Popen(["rofi", "-i", "-dmenu", \
3538 "-l", str(lines), "-width", str(width), \
3539 "-p", "connection"], stdout=PIPE, stdin=PIPE)
3540selected = rofi.communicate("\n" \
3541 .join(fdict.keys()) \
3542 .encode("utf-8"))[0] \
3543 .decode("utf-8") \
3544 .strip()
3545rofi.wait()
3546
3547r = Popen(["remmina", "-c", fdict[selected]])
3548r.wait()
3549#+end_src
3550
3551** toggle-presentation-mode
3552:PROPERTIES:
3553:header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/sh"
3554:END:
3555
3556#+begin_src sh
3557xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
3558#+end_src
3559
3560** toggle-tablet
3561:PROPERTIES:
3562:header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/sh"
3563:END:
3564
3565#+begin_src sh
3566# This script toggles between a 'normal' mode and a 'tablet' mode, doing
3567# a few things:
3568
3569# - rotates the screen using =xrandr=, so that rotating the physical
3570# display of my X220t would have the laptop's battery on the right
3571# hand side,
3572# - enables touch screen,
3573# - properly rotates the stylus pen and touch screen pointers, and
3574# - toggles between RGB and Vertical BGR sub-pixel order.
3575
3576case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
3577 0) # Screen is not rotated, we should rotate it right (90°)
3578 xrandr -o 3
3579 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
3580 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
3581 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
3582 xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
3583 ;;
3584 1) # Currently top is rotated right, we should set it normal (0°)
3585 xrandr -o 0
3586 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
3587 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
3588 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
3589 xfconf-query -c xsettings -p /Xft/RGBA -s rgb
3590 ;;
3591 ,*)
3592 echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
3593 exit 1
3594 ;;
3595esac
3596#+end_src
3597
3598** volume-info
3599:PROPERTIES:
3600:header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
3601:END:
3602
3603#+begin_src sh
3604cur_vol=$(pamixer --get-volume)
3605
3606if [ $(pamixer --get-mute) = true ]; then
3607 printf 'mt \n' "$cur_vol"
3608else
3609 printf '%02d \n' "$cur_vol"
3610fi
3611#+end_src
3612
3613** zathura-sync
3614:PROPERTIES:
3615:header-args+: :tangle ~/.local/bin/zathura-sync :shebang "#!/bin/sh"
3616:END:
3617
3618#+begin_src sh
3619pos="$1"
3620pdffile="$2"
3621zathura --synctex-forward "$pos" "$pdffile" || \
3622 (
3623 zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" &
3624 sleep 1; zathura --synctex-forward "$pos" "$pdffile" )
3625#+end_src