* init.el(b/duplicate-line-or-region): Remove unused code.
[~bandali/configs] / rc.org
1 #+title: rc.org
2 #+property: header-args :comments no :mkdirp yes :results silent
3
4 * About
5
6 This org file contains the configuration files of pretty much every
7 program I use. The files are tangled (i.e. exported, or derived) from
8 this file using =org-babel=.
9
10 Note: This file is best viewed inside Emacs with org mode.
11
12 * Configs
13
14 This section contains the configuration files (dotfiles) of various
15 programs I use 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]
70 type = SimplePOP3SSLRetriever
71 server = fencepost.gnu.org
72 username = bandali
73 password_command = ("gpg", "--no-tty", "-q", "-d", "/home/bandali/.passwd/gnu.gpg")
74 port = 995
75 use_apop = True
76
77 [destination]
78 type = Maildir
79 path = ~/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]
87 read_all = false
88 delete_after = 1
89 # delete = true
90 received = false
91 delivered_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
183 TAGS
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
205 default-cache-ttl 43200
206 max-cache-ttl 86400
207
208 default-cache-ttl-ssh 43200
209 max-cache-ttl-ssh 86400
210
211 pinentry-program /home/bandali/.guix-profile/bin/pinentry-emacs
212 allow-emacs-pinentry
213 allow-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
224 gtk-theme-name="Xfce"
225 # gtk-icon-theme-name="elementary Xfce darker"
226 gtk-font-name="Roboto 10"
227 # gtk-font-name="Source Code Variable 10"
228 gtk-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]
239 gtk-icon-theme-name = Adwaita
240 # gtk-theme-name = Adwaita
241
242 gtk-theme-name = Xfce
243 # gtk-theme-name = Arc-Darker
244 # gtk-theme-name = Numix-ArchBlue
245
246 gtk-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
269 To install/update the packages of the default profile, use
270 #+begin_example
271 guix package -m $MY_GUIX_MANIFESTS/main.scm
272 #+end_example
273 and for other profiles, use
274 #+begin_example
275 guix package -m $MY_GUIX_MANIFESTS/name.scm -p $MY_GUIX_PROFILES/name/name
276 #+end_example
277 where =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
549 CopyArrivalDate yes
550 Create Both
551 Expunge Both
552
553 ######
554 IMAPAccount shemshak
555 Host mail.shemshak.org
556 User amin@shemshak.org
557 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak.gpg"
558 SSLType IMAPS
559
560 IMAPStore shemshak-remote
561 Account shemshak
562
563 IMAPAccount shemshak-local
564 Host 127.0.0.1
565 Port 143
566 User amin@shemshak.local
567 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak-local.gpg"
568 SSLType None
569
570 IMAPStore shemshak-local
571 Account shemshak-local
572
573 Channel shemshak
574 Master :shemshak-remote:
575 Slave :shemshak-local:
576 Patterns *
577
578 ######
579 IMAPAccount gnub
580 Host mail.shemshak.org
581 User gnu@bandali.eu.org
582 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub.gpg"
583 SSLType IMAPS
584
585 IMAPStore gnub-remote
586 Account gnub
587
588 IMAPAccount gnub-local
589 Host 127.0.0.1
590 Port 143
591 User bandali@gnu.local
592 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub-local.gpg"
593 SSLType None
594
595 IMAPStore gnub-local
596 Account gnub-local
597
598 Channel gnub
599 Master :gnub-remote:
600 Slave :gnub-local:
601 Patterns *
602
603 ######
604 IMAPAccount uwaterloo
605 Host connect.uwaterloo.ca
606 User abandali
607 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo.gpg"
608 SSLType IMAPS
609
610 IMAPStore uwaterloo-remote
611 Account uwaterloo
612
613 IMAPAccount uwaterloo-local
614 Host 127.0.0.1
615 Port 143
616 User abandali@uw.local
617 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo-local.gpg"
618 SSLType None
619
620 IMAPStore uwaterloo-local
621 Account uwaterloo-local
622
623 Channel uwaterloo
624 Master :uwaterloo-remote:
625 Slave :uwaterloo-local:
626 Patterns *
627
628 ######
629 IMAPAccount csclub
630 Host mail.csclub.uwaterloo.ca
631 User abandali
632 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub.gpg"
633 SSLType IMAPS
634
635 IMAPStore csclub-remote
636 Account csclub
637
638 IMAPAccount csclub-local
639 Host 127.0.0.1
640 Port 143
641 User abandali@csc.uw.local
642 PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub-local.gpg"
643 SSLType None
644
645 IMAPStore csclub-local
646 Account csclub-local
647
648 Channel csclub
649 Master :csclub-remote:
650 Slave :csclub-local:
651 Patterns *
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 #
691 music_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 #
698 playlist_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 #
706 db_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 #
715 log_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 #
721 pid_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 #
728 state_file "~/.mpd/state"
729 #
730 # The location of the sticker database. This is a database which
731 # manages dynamic information attached to songs.
732 #
733 sticker_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
869 input {
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
882 audio_output {
883 type "pulse"
884 name "pulse audio"
885 }
886
887 audio_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.
1095 defaults
1096 port 587
1097 tls on
1098 auth on
1099 #tls_trust_file /etc/ssl/certs/ca-certificates.crt
1100 logfile ~/.msmtp.log
1101
1102 account shemshak
1103 host mail.shemshak.org
1104 # use `msmtp -a shemshak --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1105 tls_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
1106 tls_starttls on
1107 from amin@shemshak.org
1108 user amin@shemshak.org
1109 passwordeval gpg --no-tty -q -d ~/.passwd/shemshak.gpg
1110
1111 account aminb : shemshak
1112 from amin@aminb.org
1113 account bndl : shemshak
1114 from amin@bndl.org
1115
1116 account gnu
1117 host fencepost.gnu.org
1118 # use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1119 tls_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
1120 tls_starttls on
1121 from bandali@gnu.org
1122 user bandali
1123 passwordeval gpg --no-tty -q -d ~/.passwd/gnu.gpg
1124
1125 account gnu-mab : gnu
1126 from mab@gnu.org
1127 account gnu-aminb : gnu
1128 from aminb@gnu.org
1129 account gnu-amin : gnu
1130 from amin@gnu.org
1131
1132 account uwaterloo
1133 host connect.uwaterloo.ca
1134 tls_starttls on
1135 from abandali@uwaterloo.ca
1136 user abandali
1137 passwordeval gpg --no-tty -q -d ~/.passwd/uwaterloo.gpg
1138 tls_trust_file /etc/ssl/certs/ca-certificates.crt
1139
1140 account uwaterloo-friendly : uwaterloo
1141 from bandali@uwaterloo.ca
1142
1143 account csclub
1144 host mail.csclub.uwaterloo.ca
1145 tls_starttls on
1146 from abandali@csclub.uwaterloo.ca
1147 user abandali
1148 passwordeval gpg --no-tty -q -d ~/.passwd/csclub.gpg
1149 tls_trust_file /etc/ssl/certs/ca-certificates.crt
1150
1151 account csclub-friendly : csclub
1152 from bandali@csclub.uwaterloo.ca
1153
1154 # Set a default account
1155 account default : shemshak
1156 #+end_src
1157
1158 ** Readline
1159 :PROPERTIES:
1160 :header-args+: :tangle ~/.config/readline/inputrc
1161 :END:
1162
1163 #+begin_src conf
1164 set enable-bracketed-paste on
1165
1166 set colored-stats on
1167 set colored-completion-prefix on
1168 set completion-ignore-case on
1169 set menu-complete-display-prefix on
1170 set page-completions off
1171 set show-all-if-ambiguous on
1172 set show-all-if-unmodified on
1173 set visible-stats on
1174
1175 TAB: menu-complete
1176 "\e[Z": menu-complete-backward
1177
1178 "\e[A": history-search-backward
1179 "\e[B": history-search-forward
1180 #+end_src
1181
1182 ** rofi
1183 :PROPERTIES:
1184 :header-args+: :tangle ~/.config/rofi/config
1185 :END:
1186
1187 #+begin_src conf
1188 ! rofi.font: Ubuntu Mono 13
1189 ! rofi.font: Inconsolata 16
1190 ! rofi.font: Iosevka 13
1191 ! rofi.font: Source Code Pro 11
1192 rofi.font: Source Code Pro 10.5
1193 rofi.modi: run,window
1194 ! rofi.width: 640
1195 rofi.width: 600
1196 !rofi.location: 2
1197 !rofi.yoffset: 200
1198 rofi.monitor: -1
1199 !rofi.lines: 10
1200
1201 rofi.theme: ~/.guix-profile/share/rofi/themes/gruvbox-light-hard.rasi
1202 #+end_src
1203
1204 ** rofi-pass
1205 :PROPERTIES:
1206 :header-args+: :tangle ~/.config/rofi-pass/config
1207 :END:
1208
1209 #+begin_src conf
1210 # permanently set alternative root dir
1211 # root=/path/to/root
1212
1213 # rofi command. Make sure to have "$@" as last argument
1214 _rofi () {
1215 #rofi -no-auto-select -kb-accept-entry "!Return" -i -no-levenshtein-sort "$@"
1216 rofi -i -no-auto-select -kb-accept-entry "!Return" "$@"
1217 }
1218
1219 # xdotool needs the keyboard layout to be set using setxkbmap
1220 # You can do this in your autostart scripts (e.g. xinitrc)
1221
1222 # If for some reason, you cannot do this, you can set the command here.
1223 # and set fix_layout to true
1224 fix_layout=false
1225
1226 layout_cmd () {
1227 setxkbmap us
1228 }
1229
1230 # fields to be used
1231 URL_field='url'
1232 USERNAME_field='user'
1233 AUTOTYPE_field='autotype'
1234
1235 # delay to be used for :delay keyword
1236 delay=2
1237
1238 ## Programs to be used
1239 # Editor
1240 EDITOR='gvim -f'
1241
1242 # Browser
1243 BROWSER='chromium'
1244
1245 ## Misc settings
1246
1247 default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
1248 auto_enter='false'
1249 notify='false'
1250 default_autotype='user :tab pass'
1251
1252 # color of the help messages
1253 # leave empty for autodetection
1254 help_color="#4872FF"
1255
1256 # Clipboard settings
1257 # Possible options: primary, clipboard, both
1258 clip=primary
1259
1260 # Options for generating new password entries
1261 # default_user is also used for password files that have no user field.
1262 default_user=aminb
1263 default_user2=bandali
1264 password_length=30
1265
1266 # Custom Keybindings
1267 #autotype="Alt+1"
1268 autotype="Alt+m"
1269 type_user="Alt+2"
1270 type_pass="Alt+3"
1271 open_url="Alt+4"
1272 copy_name="Alt+u"
1273 copy_url="Alt+l"
1274 copy_pass="Alt+p"
1275 show="Alt+o"
1276 copy_entry="Alt+2"
1277 type_entry="Alt+1"
1278 copy_menu="Alt+c"
1279 action_menu="Alt+a"
1280 type_menu="Alt+t"
1281 help="Alt+h"
1282 switch="Alt+x"
1283 insert_pass="Alt+n"
1284 #+end_src
1285
1286 ** Screen
1287 :PROPERTIES:
1288 :header-args+: :tangle ~/.config/screen/screenrc
1289 :END:
1290
1291 #+begin_src screen
1292 startup_message off
1293 caption always "%{= kc}GNU Screen $USER@%H (load: %l)%-28=%{= .m}%D %d.%m.%Y %0c"
1294 #+end_src
1295
1296 ** Shell
1297
1298 *** GNU Bash
1299 :PROPERTIES:
1300 :header-args+: :tangle ~/.bashrc
1301 :END:
1302
1303 #+begin_src bash
1304 # Bash initialization for interactive non-login shells and
1305 # for remote shells (info "(bash) Bash Startup Files").
1306
1307 # Export 'SHELL' to child processes. Programs such as 'screen'
1308 # honor it and otherwise use /bin/sh.
1309 export SHELL
1310
1311 if [[ $- != *i* ]]
1312 then
1313 # We are being invoked from a non-interactive shell. If this
1314 # is an SSH session (as in "ssh host command"), source
1315 # /etc/profile so we get PATH and other essential variables.
1316 [[ -n "$SSH_CLIENT" ]] && source /etc/profile
1317
1318 # Don't do anything else.
1319 return
1320 fi
1321
1322 if [ -n "$IS_GUIX_SYSTEM" ]; then
1323 # Source the system-wide file.
1324 source /etc/bashrc
1325 fi
1326
1327 # from https://unix.stackexchange.com/a/55935
1328 b_prompt() {
1329 cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD)
1330 printf $cwd
1331 }
1332
1333 if [ $(id -u) == "0" ]; then
1334 PS1='`printf "\[\e[1;31m\]\$\[\e[00m\]"` '
1335 else
1336 PS1='\$ '
1337 fi
1338 PS1="\u@\h:\w/`[ -n "$GUIX_ENVIRONMENT" ] && printf \" [env]\"`\n$PS1"
1339
1340 # set terminal title
1341 PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: $(b_prompt)\007"'
1342
1343 # i-beam cursor
1344 # echo -e "\033[5 q" # blinking
1345 echo -e "\033[6 q" # non-blinking
1346
1347 # various bash tweaks
1348 # append to the history file, don't overwrite it
1349 shopt -s histappend
1350 shopt -s cmdhist
1351 # check the window size after each command and, if necessary,
1352 # update the values of LINES and COLUMNS.
1353 shopt -s checkwinsize
1354 # If set, the pattern "**" used in a pathname expansion context will
1355 # match all files and zero or more directories and subdirectories.
1356 #shopt -s globstar
1357 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
1358 HISTSIZE=
1359 HISTFILESIZE=
1360 # don't put duplicate lines or lines starting with space in the
1361 # history.
1362 HISTCONTROL=ignoreboth
1363 # ignore a few very common commands and don't add them to history
1364 HISTIGNORE='ls:l:s:g:[bf]g:history'
1365 HISTTIMEFORMAT='%F %T '
1366 stty stop ""
1367
1368 # aliases
1369 alias ls='ls -p --color=auto'
1370 alias l='ls -lh' # long format and human-readable sizes
1371 alias ll='l -A' # long format, all files
1372 alias dir='dir --color=auto'
1373 alias vdir='vdir --color=auto'
1374 alias grep='grep --color=auto'
1375 alias fgrep='fgrep --color=auto'
1376 alias egrep='egrep --color=auto'
1377 alias mpv="mpv --ytdl-format mp4"
1378 alias mv="mv -iv"
1379 alias cp="cp -iv"
1380 alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc'
1381 alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc'
1382 alias m="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub"
1383 alias best="youtube-dl -f best"
1384 alias e="$EDITOR"
1385 alias se="SUDO_EDITOR=\"emacsclient\" sudo -e"
1386
1387 aur() {
1388 cd ~/usr/builds
1389 [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git
1390 cd ${1}
1391 }
1392
1393 function t {
1394 cd $(mktemp -d /tmp/$1.XXXX)
1395 }
1396
1397 # separate alias definitions file, if exists
1398 if [ -f ~/.bash_aliases ]; then
1399 . ~/.bash_aliases
1400 fi
1401
1402 # enable programmable completion features (not needed if already
1403 # enabled in /etc/bash.bashrc and if /etc/profile sources
1404 # /etc/bash.bashrc).
1405 if ! shopt -oq posix; then
1406 if [ -f /usr/share/bash-completion/bash_completion ]; then
1407 . /usr/share/bash-completion/bash_completion
1408 elif [ -f /etc/bash_completion ]; then
1409 . /etc/bash_completion
1410 fi
1411 fi
1412
1413 # source Guix shell config dirs, for vte.sh and bash completions
1414 GUIX_PROFILES=("${HOME}/.guix-profile"
1415 "${HOME}/.config/guix/current")
1416 for profile in "${GUIX_PROFILES[@]}"; do
1417 for dir in "${profile}/etc/bash_completion.d" "${profile}/etc/profile.d"; do
1418 if [ -d "${dir}" ]; then
1419 for f in "${dir}"/*; do
1420 . $f
1421 done
1422 fi
1423 done
1424 done
1425 #+end_src
1426
1427 *** profile
1428 :PROPERTIES:
1429 :header-args+: :tangle ~/.profile
1430 :END:
1431
1432 #+begin_src sh
1433 # ~/.profile: executed by the command interpreter for login shells.
1434 # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
1435 # exists.
1436
1437 # source host-specific profile
1438 if [ -f "$HOME/.config/profiles/$(hostname)" ]; then
1439 . "$HOME/.config/profiles/$(hostname)"
1440 fi
1441
1442 export EDITOR="emacsclient -nw"
1443 export VISUAL="emcl"
1444
1445 PATH="$HOME/usr/local/bin:$HOME/.local/bin:$PATH"
1446 PATH="$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH"
1447 if [ -z "$IS_GUIX_SYSTEM" ]; then
1448 PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH"
1449 INFOPATH="$HOME/.config/guix/current/share/info${INFOPATH:+:}$INFOPATH"
1450 export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale"
1451 fi
1452 export PATH
1453 export INFOPATH
1454
1455 export MY_GUIX_MANIFESTS="$HOME/.config/guix/manifest"
1456 export MY_GUIX_PROFILES="$HOME/.config/guix/profile"
1457
1458 export XDG_CONFIG_HOME="$HOME/.config"
1459 export XDG_DATA_HOME="$HOME/.local/share"
1460
1461 if [ -f "$HOME/.config/user-dirs.dirs" ]; then
1462 set -a
1463 . "$HOME/.config/user-dirs.dirs"
1464 set +a
1465 fi
1466
1467 export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
1468 export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
1469
1470 export MAILDIR="$HOME/mail"
1471 export CVS_RSH="ssh"
1472
1473 if [ -x "$(command -v go)" ]; then
1474 export GOPATH="$HOME/src/go"
1475 export PATH="$GOPATH/bin:$PATH"
1476 fi
1477
1478 # if running bash
1479 if [ -n "$BASH_VERSION" ]; then
1480 # include .bashrc if it exists
1481 if [ -f "$HOME/.bashrc" ]; then
1482 . "$HOME/.bashrc"
1483 fi
1484 fi
1485
1486 if [ -z "$IS_GUIX_SYSTEM" ]; then
1487 # if guix is installed
1488 if [ -x "$(command -v guix)" ]; then
1489 SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs"
1490 if [ -d "$SSL_CERT_DIR" -o -h "$SSL_CERT_DIR" ]; then
1491 export SSL_CERT_DIR
1492 export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt"
1493 else
1494 printf "it seems you forgot to \`guix install nss-certs\'\n"
1495 fi
1496 GUIX_PROFILE="$HOME/.guix-profile"
1497 . "$GUIX_PROFILE/etc/profile"
1498 unset XDG_DATA_DIRS
1499 fi
1500 fi
1501
1502 for p in $MY_GUIX_PROFILES/*; do
1503 profile=$p/$(basename "$p")
1504 if [ -f "$profile"/etc/profile ]; then
1505 GUIX_PROFILE="$profile"
1506 . "$GUIX_PROFILE"/etc/profile
1507 fi
1508 unset profile
1509 done
1510
1511 # start an ssh-agent (with guix's openssh)
1512 if [ -z "$IS_GUIX_SYSTEM" ]; then
1513 if ! pgrep -u "$USER" ssh-agent > /dev/null; then
1514 ssh-agent > ~/.ssh-agent-thing
1515 fi
1516 if [[ ! "$SSH_AUTH_SOCK" ]]; then
1517 eval "$(<~/.ssh-agent-thing)"
1518 fi
1519 fi
1520
1521 # footenote: when on a foreign distro and using Xfce, don't forget to
1522 # disable its auto-start of gpg- and ssh-agent, by issuing
1523 # xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
1524 # xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false
1525 # see https://docs.xfce.org/xfce/xfce4-session/advanced#ssh_and_gpg_agents
1526 # also, MATE does something similar with gnome-keyring-daemon:
1527 # http://william.shallum.net/random-notes/disabling-gnome-keyring-daemon-ssh-agent-on-mate-desktop
1528 #+end_src
1529
1530 *** per-host profiles
1531
1532 Host-specific profiles, sourced from =~/.profile=. Each
1533 =~/.config/profiles/HOST= file will be sourced on the machine with
1534 =hostname= of =HOST=.
1535
1536 **** chaman
1537 :PROPERTIES:
1538 :header-args+: :tangle ~/.config/profiles/chaman
1539 :END:
1540
1541 #+begin_src sh
1542 export IS_GUIX_SYSTEM=true
1543
1544 if [ -x "$(command -v xinput)" ]; then
1545 xinput --set-prop "TPPS/2 IBM TrackPoint" 'libinput Accel Speed' -0.4
1546 fi
1547
1548 setxkbmap \
1549 -layout us,ir \
1550 -option ctrl:nocaps \
1551 -option grp:shifts_toggle
1552
1553 xmodmap -e "keysym Menu = Super_R"
1554
1555 xsetroot -cursor_name left_ptr
1556 xset r rate 200 45
1557 xset b off
1558 #+end_src
1559
1560 **** darrud
1561 :PROPERTIES:
1562 :header-args+: :tangle ~/.config/profiles/darrud
1563 :END:
1564
1565 #+begin_src sh
1566 export INFOPATH="$HOME/usr/local/share/info${INFOPATH:+:}$INFOPATH"
1567 #+end_src
1568
1569 **** langa
1570 :PROPERTIES:
1571 :header-args+: :tangle ~/.config/profiles/langa
1572 :END:
1573
1574 #+begin_src sh
1575 export XDG_DATA_DIRS="/usr/share/mate:/usr/local/share/:/usr/share/"
1576 #+end_src
1577
1578 ** redshift
1579 :PROPERTIES:
1580 :header-args+: :tangle ~/.config/redshift.conf :comments none
1581 :END:
1582
1583 #+begin_src conf
1584 ; Global settings for redshift
1585 [redshift]
1586 ; Set the day and night screen temperatures (Neutral is 6500K)
1587 ;temp-day=5700
1588 ;temp-night=3500
1589
1590 ;temp-day=6500
1591 temp-day=6200
1592 ;temp-night=4800
1593 ;temp-night=5000
1594 ;temp-night=4500
1595 temp-night=4000
1596
1597 ; Enable/Disable a smooth transition between day and night
1598 ; 0 will cause a direct change from day to night screen temperature.
1599 ; 1 will gradually increase or decrease the screen temperature.
1600 transition=1
1601
1602 ; Set the screen brightness. Default is 1.0.
1603 ;brightness=0.9
1604 ; It is also possible to use different settings for day and night
1605 ; since version 1.8.
1606 ;brightness-day=0.7
1607 ;brightness-night=0.4
1608 ; Set the screen gamma (for all colors, or each color channel
1609 ; individually)
1610 ;gamma=0.8
1611 ;gamma=1.0
1612 ;gamma=0.8:0.7:0.8
1613 ; This can also be set individually for day and night since
1614 ; version 1.10.
1615 ;gamma-day=0.8:0.7:0.8
1616 ;gamma-night=0.6
1617
1618 ; Set the location-provider: 'geoclue2' or 'manual'
1619 ; type 'redshift -l list' to see possible values.
1620 ; The location provider settings are in a different section.
1621 ;location-provider=manual
1622 location-provider=geoclue2
1623
1624 ; Set the adjustment-method: 'randr', 'vidmode'
1625 ; type 'redshift -m list' to see all possible values.
1626 ; 'randr' is the preferred method, 'vidmode' is an older API.
1627 ; but works in some cases when 'randr' does not.
1628 ; The adjustment method settings are in a different section.
1629 adjustment-method=randr
1630
1631 ; Configuration of the location-provider:
1632 ; type 'redshift -l PROVIDER:help' to see the settings.
1633 ; ex: 'redshift -l manual:help'
1634 ; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
1635 ; are negative numbers.
1636 ;[manual]
1637 ;lat=48.1
1638 ;lon=11.6
1639
1640 ; Configuration of the adjustment-method
1641 ; type 'redshift -m METHOD:help' to see the settings.
1642 ; ex: 'redshift -m randr:help'
1643 ; In this example, randr is configured to adjust screen 1.
1644 ; Note that the numbering starts from 0, so this is actually the
1645 ; second screen. If this option is not specified, Redshift will try
1646 ; to adjust _all_ screens.
1647 ;[randr]
1648 ;screen=1
1649 #+end_src
1650
1651 ** signature
1652 :PROPERTIES:
1653 :header-args+: :tangle ~/.signature
1654 :END:
1655
1656 My email signature.
1657
1658 #+begin_src
1659 Amin Bandali
1660 Free Software activist | GNU maintainer & webmaster
1661 GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103
1662 https://bandali.eu.org
1663 #+end_src
1664
1665 ** systemd
1666
1667 Keep boot messages on tty1 (see [[https://wiki.archlinux.org/index.php/getty#Have_boot_messages_stay_on_tty1][here]])
1668
1669 #+begin_src conf :tangle /sudo::/etc/systemd/system/getty@tty1.service.d/noclear.conf
1670 [Service]
1671 TTYVTDisallocate=no
1672 #+end_src
1673
1674 ** TLP
1675
1676 *** darrud
1677
1678 #+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "darrud")) "/sudo::/etc/default/tlp")
1679 # ------------------------------------------------------------------------------
1680 # tlp - Parameters for power saving
1681 # See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
1682
1683 # Hint: some features are disabled by default, remove the leading # to enable
1684 # them.
1685
1686 # Set to 0 to disable, 1 to enable TLP.
1687 TLP_ENABLE=1
1688
1689 # Operation mode when no power supply can be detected: AC, BAT.
1690 # Concerns some desktop and embedded hardware only.
1691 TLP_DEFAULT_MODE=AC
1692
1693 # Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
1694 # Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
1695 TLP_PERSISTENT_DEFAULT=0
1696
1697 # Seconds laptop mode has to wait after the disk goes idle before doing a sync.
1698 # Non-zero value enables, zero disables laptop mode.
1699 DISK_IDLE_SECS_ON_AC=0
1700 DISK_IDLE_SECS_ON_BAT=2
1701
1702 # Dirty page values (timeouts in secs).
1703 MAX_LOST_WORK_SECS_ON_AC=15
1704 MAX_LOST_WORK_SECS_ON_BAT=60
1705
1706 # Hint: CPU parameters below are disabled by default, remove the leading #
1707 # to enable them, otherwise kernel default values are used.
1708
1709 # Select a CPU frequency scaling governor.
1710 # Intel Core i processor with intel_pstate driver:
1711 # powersave(*), performance.
1712 # Older hardware with acpi-cpufreq driver:
1713 # ondemand(*), powersave, performance, conservative, schedutil.
1714 # (*) is recommended.
1715 # Hint: use tlp-stat -p to show the active driver and available governors.
1716 # Important:
1717 # powersave for intel_pstate and ondemand for acpi-cpufreq are power
1718 # efficient for *almost all* workloads and therefore kernel and most
1719 # distributions have chosen them as defaults. If you still want to change,
1720 # you should know what you're doing! You *must* disable your distribution's
1721 # governor settings or conflicts will occur.
1722 #CPU_SCALING_GOVERNOR_ON_AC=powersave
1723 #CPU_SCALING_GOVERNOR_ON_BAT=powersave
1724 CPU_SCALING_GOVERNOR_ON_AC=conservative
1725 CPU_SCALING_GOVERNOR_ON_BAT=conservative
1726
1727 # Set the min/max frequency available for the scaling governor.
1728 # Possible values strongly depend on your CPU. For available frequencies see
1729 # the output of tlp-stat -p.
1730 #CPU_SCALING_MIN_FREQ_ON_AC=0
1731 #CPU_SCALING_MAX_FREQ_ON_AC=0
1732 #CPU_SCALING_MIN_FREQ_ON_BAT=0
1733 #CPU_SCALING_MAX_FREQ_ON_BAT=0
1734
1735 # Set energy performance hints (HWP) for Intel P-state governor:
1736 # performance, balance_performance, default, balance_power, power
1737 # Values are given in order of increasing power saving.
1738 # Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
1739 CPU_HWP_ON_AC=balance_performance
1740 CPU_HWP_ON_BAT=balance_power
1741
1742 # Set Intel P-state performance: 0..100 (%).
1743 # Limit the max/min P-state to control the power dissipation of the CPU.
1744 # Values are stated as a percentage of the available performance.
1745 # Requires an Intel Core i processor with intel_pstate driver.
1746 #CPU_MIN_PERF_ON_AC=0
1747 #CPU_MAX_PERF_ON_AC=100
1748 #CPU_MIN_PERF_ON_BAT=0
1749 #CPU_MAX_PERF_ON_BAT=30
1750
1751 # Set the CPU "turbo boost" feature: 0=disable, 1=allow
1752 # Requires an Intel Core i processor.
1753 # Important:
1754 # - This may conflict with your distribution's governor settings
1755 # - A value of 1 does *not* activate boosting, it just allows it
1756 #CPU_BOOST_ON_AC=1
1757 #CPU_BOOST_ON_BAT=0
1758
1759 # Minimize number of used CPU cores/hyper-threads under light load conditions:
1760 # 0=disable, 1=enable.
1761 SCHED_POWERSAVE_ON_AC=0
1762 SCHED_POWERSAVE_ON_BAT=1
1763
1764 # Kernel NMI Watchdog:
1765 # 0=disable (default, saves power), 1=enable (for kernel debugging only).
1766 NMI_WATCHDOG=0
1767
1768 # Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
1769 # Frequency voltage pairs are written to:
1770 # /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
1771 # CAUTION: only use this, if you thoroughly understand what you are doing!
1772 #PHC_CONTROLS="F:V F:V F:V F:V"
1773
1774 # Set CPU performance versus energy savings policy:
1775 # performance, balance-performance, default, balance-power, power.
1776 # Values are given in order of increasing power saving.
1777 # Requires kernel module msr and x86_energy_perf_policy from linux-tools.
1778 ENERGY_PERF_POLICY_ON_AC=performance
1779 ENERGY_PERF_POLICY_ON_BAT=balance-power
1780
1781 # Disk devices; separate multiple devices with spaces (default: sda).
1782 # Devices can be specified by disk ID also (lookup with: tlp diskid).
1783 DISK_DEVICES="sda sdb"
1784
1785 # Disk advanced power management level: 1..254, 255 (max saving, min, off).
1786 # Levels 1..127 may spin down the disk; 255 allowable on most drives.
1787 # Separate values for multiple disks with spaces. Use the special value 'keep'
1788 # to keep the hardware default for the particular disk.
1789 DISK_APM_LEVEL_ON_AC="254 254"
1790 DISK_APM_LEVEL_ON_BAT="128 128"
1791
1792 # Hard disk spin down timeout:
1793 # 0: spin down disabled
1794 # 1..240: timeouts from 5s to 20min (in units of 5s)
1795 # 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
1796 # See 'man hdparm' for details.
1797 # Separate values for multiple disks with spaces. Use the special value 'keep'
1798 # to keep the hardware default for the particular disk.
1799 #DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
1800 #DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
1801
1802 # Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
1803 # Separate values for multiple disks with spaces. Use the special value 'keep'
1804 # to keep the kernel default scheduler for the particular disk.
1805 #DISK_IOSCHED="cfq cfq"
1806
1807 # AHCI link power management (ALPM) for disk devices:
1808 # min_power, med_power_with_dipm(*), medium_power, max_performance.
1809 # (*) Kernel >= 4.15 required, then recommended.
1810 # Multiple values separated with spaces are tried sequentially until success.
1811 SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
1812 SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
1813
1814 # Exclude host devices from AHCI link power management.
1815 # Separate multiple hosts with spaces.
1816 #SATA_LINKPWR_BLACKLIST="host1"
1817
1818 # Runtime Power Management for AHCI host and disks devices:
1819 # on=disable, auto=enable.
1820 # EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
1821 #AHCI_RUNTIME_PM_ON_AC=on
1822 #AHCI_RUNTIME_PM_ON_BAT=on
1823
1824 # Seconds of inactivity before disk is suspended.
1825 AHCI_RUNTIME_PM_TIMEOUT=15
1826
1827 # PCI Express Active State Power Management (PCIe ASPM):
1828 # default, performance, powersave.
1829 PCIE_ASPM_ON_AC=performance
1830 PCIE_ASPM_ON_BAT=powersave
1831
1832 # Radeon graphics clock speed (profile method): low, mid, high, auto, default;
1833 # auto = mid on BAT, high on AC; default = use hardware defaults.
1834 RADEON_POWER_PROFILE_ON_AC=high
1835 RADEON_POWER_PROFILE_ON_BAT=low
1836
1837 # Radeon dynamic power management method (DPM): battery, performance.
1838 RADEON_DPM_STATE_ON_AC=performance
1839 RADEON_DPM_STATE_ON_BAT=battery
1840
1841 # Radeon DPM performance level: auto, low, high; auto is recommended.
1842 RADEON_DPM_PERF_LEVEL_ON_AC=auto
1843 RADEON_DPM_PERF_LEVEL_ON_BAT=auto
1844
1845 # WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
1846 WIFI_PWR_ON_AC=off
1847 WIFI_PWR_ON_BAT=on
1848
1849 # Disable wake on LAN: Y/N.
1850 WOL_DISABLE=Y
1851
1852 # Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
1853 # A value of 0 disables, >=1 enables power saving (recommended: 1).
1854 SOUND_POWER_SAVE_ON_AC=0
1855 SOUND_POWER_SAVE_ON_BAT=0
1856
1857 # Disable controller too (HDA only): Y/N.
1858 SOUND_POWER_SAVE_CONTROLLER=N
1859
1860 # Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
1861 # Drive can be powered on again by releasing (and reinserting) the eject lever
1862 # or by pressing the disc eject button on newer models.
1863 # Note: an UltraBay/MediaBay hard disk is never powered off.
1864 BAY_POWEROFF_ON_AC=0
1865 BAY_POWEROFF_ON_BAT=0
1866 # Optical drive device to power off (default sr0).
1867 BAY_DEVICE="sr0"
1868
1869 # Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
1870 RUNTIME_PM_ON_AC=on
1871 RUNTIME_PM_ON_BAT=auto
1872
1873 # Exclude PCI(e) device adresses the following list from Runtime PM
1874 # (separate with spaces). Use lspci to get the adresses (1st column).
1875 #RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
1876 RUNTIME_PM_BLACKLIST="01:00.0"
1877
1878 # Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
1879 # Default when unconfigured is "amdgpu nouveau nvidia radeon" which
1880 # prevents accidential power-on of dGPU in hybrid graphics setups.
1881 # Use "" to disable the feature completely.
1882 # Separate multiple drivers with spaces.
1883 #RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"
1884
1885 # Set to 0 to disable, 1 to enable USB autosuspend feature.
1886 USB_AUTOSUSPEND=1
1887
1888 # Exclude listed devices from USB autosuspend (separate with spaces).
1889 # Use lsusb to get the ids.
1890 # Note: input devices (usbhid) are excluded automatically
1891 #USB_BLACKLIST="1111:2222 3333:4444"
1892
1893 # Bluetooth devices are excluded from USB autosuspend:
1894 # 0=do not exclude, 1=exclude.
1895 USB_BLACKLIST_BTUSB=0
1896
1897 # Phone devices are excluded from USB autosuspend:
1898 # 0=do not exclude, 1=exclude (enable charging).
1899 USB_BLACKLIST_PHONE=0
1900
1901 # Printers are excluded from USB autosuspend:
1902 # 0=do not exclude, 1=exclude.
1903 USB_BLACKLIST_PRINTER=1
1904
1905 # WWAN devices are excluded from USB autosuspend:
1906 # 0=do not exclude, 1=exclude.
1907 USB_BLACKLIST_WWAN=1
1908
1909 # Include listed devices into USB autosuspend even if already excluded
1910 # by the blacklists above (separate with spaces).
1911 # Use lsusb to get the ids.
1912 #USB_WHITELIST="1111:2222 3333:4444"
1913
1914 # Set to 1 to disable autosuspend before shutdown, 0 to do nothing
1915 # (workaround for USB devices that cause shutdown problems).
1916 #USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
1917
1918 # Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
1919 # on system startup: 0=disable, 1=enable.
1920 # Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
1921 # are ignored when this is enabled!
1922 #RESTORE_DEVICE_STATE_ON_STARTUP=0
1923 RESTORE_DEVICE_STATE_ON_STARTUP=1
1924
1925 # Radio devices to disable on startup: bluetooth, wifi, wwan.
1926 # Separate multiple devices with spaces.
1927 #DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
1928
1929 # Radio devices to enable on startup: bluetooth, wifi, wwan.
1930 # Separate multiple devices with spaces.
1931 #DEVICES_TO_ENABLE_ON_STARTUP="wifi"
1932
1933 # Radio devices to disable on shutdown: bluetooth, wifi, wwan.
1934 # (workaround for devices that are blocking shutdown).
1935 #DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
1936
1937 # Radio devices to enable on shutdown: bluetooth, wifi, wwan.
1938 # (to prevent other operating systems from missing radios).
1939 #DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
1940
1941 # Radio devices to enable on AC: bluetooth, wifi, wwan.
1942 #DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
1943
1944 # Radio devices to disable on battery: bluetooth, wifi, wwan.
1945 #DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
1946
1947 # Radio devices to disable on battery when not in use (not connected):
1948 # bluetooth, wifi, wwan.
1949 #DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
1950
1951 # Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
1952 # required). Charging starts when the remaining capacity falls below the
1953 # START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
1954 # Main / Internal battery (values in %)
1955 #START_CHARGE_THRESH_BAT0=75
1956 #STOP_CHARGE_THRESH_BAT0=80
1957 # Ultrabay / Slice / Replaceable battery (values in %)
1958 #START_CHARGE_THRESH_BAT1=75
1959 #STOP_CHARGE_THRESH_BAT1=80
1960
1961 # Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
1962 #RESTORE_THRESHOLDS_ON_BAT=1
1963
1964 # ------------------------------------------------------------------------------
1965 # tlp-rdw - Parameters for the radio device wizard
1966 # Possible devices: bluetooth, wifi, wwan.
1967
1968 # Hints:
1969 # - Parameters are disabled by default, remove the leading # to enable them
1970 # - Separate multiple radio devices with spaces
1971
1972 # Radio devices to disable on connect.
1973 #DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
1974 #DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
1975 #DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
1976
1977 # Radio devices to enable on disconnect.
1978 #DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
1979 #DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
1980 #DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
1981
1982 # Radio devices to enable/disable when docked.
1983 #DEVICES_TO_ENABLE_ON_DOCK=""
1984 #DEVICES_TO_DISABLE_ON_DOCK=""
1985
1986 # Radio devices to enable/disable when undocked.
1987 #DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
1988 #DEVICES_TO_DISABLE_ON_UNDOCK=""
1989 #+end_src
1990
1991 ** Tridactyl
1992 :PROPERTIES:
1993 :header-args+: :tangle ~/.config/tridactyl/tridactylrc
1994 :END:
1995
1996 #+begin_src conf
1997 bind n scrollline 2
1998 bind p scrollline -2
1999
2000 bind 0 scrollto 0 x
2001 bind - scrollto 100 x
2002
2003 bind P tabprev
2004 bind N tabnext
2005
2006 bind d scrollpage 0.5
2007 bind u scrollpage -0.5
2008 unbind <C-d>
2009 unbind <C-u>
2010
2011 bind x tabclose
2012 bind X undo
2013 bind <C-S> stop
2014
2015 bind gd tabduplicate
2016 bind gw tabdetach
2017
2018 bind O fillcmdline bmarks
2019
2020 bind ;<Space> fillcmdline_notrail
2021
2022 unbind <C-f>
2023
2024 set hintfiltermode vimperator-reflow
2025 set hintnames numeric
2026 set urlparenttrailingslash false
2027
2028 set browser abrowser
2029 " set newtab https://bandali.eu.org
2030
2031 seturl warrior.uwaterloo.ca noiframe true
2032
2033 " autocmd DocStart www.reddit.com js tri.excmds.urlmodify("-t", "www", "old")
2034 #+end_src
2035
2036 ** X
2037
2038 *** xinit
2039 :PROPERTIES:
2040 :header-args+: :tangle ~/.xinitrc
2041 :END:
2042
2043 #+begin_src sh
2044 [ -f ~/.Xresources ] && xrdb -merge ~/.Xresources
2045 #+end_src
2046
2047 *** X resources
2048
2049 #+begin_src conf-xdefaults :tangle (when (eq system-type 'gnu/linux) "~/.Xresources")
2050 #include ".Xresources.d/fonts"
2051 #include ".Xresources.d/emacs"
2052 #include ".Xresources.d/rxvt-unicode"
2053 #+end_src
2054
2055 **** emacs
2056 :PROPERTIES:
2057 :header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/emacs")
2058 :END:
2059
2060 #+begin_src conf-xdefaults
2061 Emacs.menuBar: off
2062 Emacs.toolBar: off
2063 Emacs.verticalScrollBars: off
2064 Emacs.cursorBlink: off
2065 Emacs.FontBackend: ftcrhb,x
2066 ! Emacs.font: Ubuntu Mono-12
2067 ! Emacs.font: Triplicate T4C-11
2068 ! Emacs.font: Ubuntu Mono-10.5
2069 ! Emacs.font: Ubuntu Mono-12
2070 ! Emacs.font: Iosevka-11
2071
2072 ! Emacs.font: Fira Mono:size=15
2073 ! Emacs.font: DejaVu Sans Mono:size=15
2074 ! Emacs.font: Inconsolata:size=17
2075 ! Emacs.font: Inconsolata:size=16
2076 ! Emacs.font: Inconsolata LGC:size=14
2077 ! Emacs.font: Source Code Pro Medium-10.5
2078 Emacs.font: Source Code Pro Medium:size=14
2079 ! Emacs.font: Ubuntu Mono:size=16
2080 ! Emacs.font: Iosevka:size=16
2081 #+end_src
2082
2083 **** fonts
2084 :PROPERTIES:
2085 :header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/fonts")
2086 :END:
2087
2088 #+begin_src conf-xdefaults
2089 Xft.lcdfilter: lcddefault
2090 Xft.antialias: true
2091 Xft.autohint: 0
2092 Xft.hinting: true
2093 Xft.hintstyle: hintslight
2094 ! Xft.hintstyle: hintfull
2095 Xft.rgba: rgb
2096 Xft.dpi: 96
2097 #+end_src
2098
2099 **** rxvt-unicode
2100 :PROPERTIES:
2101 :header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/rxvt-unicode")
2102 :END:
2103
2104 #+begin_src conf-xdefaults
2105 ! Font
2106 URxvt.font: xft:source code pro:pixelsize=14:antialias=true:hinting=true, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true
2107 URxvt.boldFont: xft:source code pro:semibold:pixelsize=14:antialias=true:hinting=true:bold, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bold
2108 URxvt.italicFont: xft:source code pro:italic:pixelsize=14:antialias=true:hinting=true:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:italic
2109 URxvt.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
2110
2111 URxvt.xftAntialias: true
2112 URxvt.letterSpace: -1
2113
2114 !URxvt.depth: 0
2115 !URxvt.loginShell: true
2116 !URxvt*buffered: false
2117 URxvt.saveLines: 100000
2118 URxvt.internalBorder: 3
2119 URxvt.lineSpace: 0
2120 URxvt.scrollBar: false
2121 URxvt.scrollStyle: rxvt
2122 URxvt*scrollTtyOutput: false
2123 URxvt*scrollWithBuffer: true
2124 URxvt*scrollTtyKeypress: true
2125 URxvt.keysym.Shift-Up: command:\033]720;1\007
2126 URxvt.keysym.Shift-Down: command:\033]721;1\007
2127
2128 URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
2129 URxvt.url-select.launcher: firefox
2130 URxvt.url-select.underline: true
2131 URxvt.keysym.M-u: perl:url-select:select_next
2132 URxvt.keysym.M-Escape: perl:keyboard-select:activate
2133 URxvt.keysym.M-s: perl:keyboard-select:search
2134 URxvt.url-launcher: /usr/bin/abrowser
2135 URxvt.matcher.button: 1
2136 ! URxvt.iso14755: false
2137 ! URxvt.iso14755_53: false
2138 ! URxvt.keysym.M-c: perl:clipboard:copy
2139 ! URxvt.keysym.M-v: perl:clipboard:paste
2140 URxvt.keysym.M-c: eval:selection_to_clipboard
2141 URxvt.keysym.M-v: eval:paste_clipboard
2142 URxvt.keysym.C-A-V: perl:clipboard:paste_escaped
2143 ! URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard
2144 ! URxvt.keysym.Shift-Control-V: eval:paste_clipboard
2145 URxvt.keysym.C-Up: font-size:increase
2146 URxvt.keysym.C-Down: font-size:decrease
2147 URxvt.keysym.C-S-Up: font-size:incglobal
2148 URxvt.keysym.C-S-Down: font-size:decglobal
2149 URxvt.keysym.C-equal: font-size:reset
2150 !URxvt.keysym.C-question: font-size:show
2151
2152 !URxvt.iconFile: /usr/share/icons/elementary-xfce/apps/48/terminal.png
2153
2154 !urxvt*foreground: white
2155 !urxvt*background: black
2156
2157 !*color0: #2E3436
2158 !*color1: #a40000
2159 !*color2: #4E9A06
2160 !*color3: #C4A000
2161 !*color4: #3465A4
2162 !*color5: #75507B
2163 !*color6: #ce5c00
2164 !*color7: #babdb9
2165 !*color8: #555753
2166 !*color9: #EF2929
2167 !*color10: #8AE234
2168 !*color11: #FCE94F
2169 !*color12: #729FCF
2170 !*color13: #AD7FA8
2171 !*color14: #fcaf3e
2172 !*color15: #EEEEEC
2173
2174 !URxvt.foreground: #C8C8C8
2175 !URxvt.background: #FFFFFF
2176
2177 !! black
2178 !*color0: #2E3436
2179 !*color8: #555753
2180 !! red
2181 !*color1: #a40000
2182 !*color9: #EF2929
2183 !! green
2184 !*color2: #4E9A06
2185 !*color10: #8AE234
2186 !! yellow
2187 !*color3: #C4A000
2188 !*color11: #FCE94F
2189 !! blue
2190 !*color4: #3465A4
2191 !*color12: #729FCF
2192 !! purple
2193 !*color5: #75507B
2194 !*color13: #AD7FA8
2195 !! orange (replaces cyan)
2196 !*color6: #ce5c00
2197 !*color14: #fcaf3e
2198 !! white
2199 !*color7: #babdb9
2200 !*color15: #EEEEEC
2201
2202
2203 ! ! Solarized
2204 ! ! Base16 Solarized Light
2205 ! ! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized)
2206
2207 ! #define base00 #fdf6e3
2208 ! #define base01 #eee8d5
2209 ! #define base02 #93a1a1
2210 ! #define base03 #839496
2211 ! #define base04 #657b83
2212 ! #define base05 #586e75
2213 ! #define base06 #073642
2214 ! #define base07 #002b36
2215 ! #define base08 #dc322f
2216 ! #define base09 #cb4b16
2217 ! #define base0A #b58900
2218 ! #define base0B #859900
2219 ! #define base0C #2aa198
2220 ! #define base0D #268bd2
2221 ! #define base0E #6c71c4
2222 ! #define base0F #d33682
2223
2224 ! *foreground: base05
2225 ! #ifdef background_opacity
2226 ! *background: [background_opacity]base00
2227 ! #else
2228 ! *background: base00
2229 ! #endif
2230 ! *cursorColor: base05
2231
2232 ! *color0: base00
2233 ! *color1: base08
2234 ! *color2: base0B
2235 ! *color3: base0A
2236 ! *color4: base0D
2237 ! *color5: base0E
2238 ! *color6: base0C
2239 ! *color7: base05
2240
2241 ! *color8: base03
2242 ! *color9: base08
2243 ! *color10: base0B
2244 ! *color11: base0A
2245 ! *color12: base0D
2246 ! *color13: base0E
2247 ! *color14: base0C
2248 ! *color15: base07
2249
2250 ! ! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt),
2251 ! ! use 'shell' template to set these if necessary
2252 ! *color16: base09
2253 ! *color17: base0F
2254 ! *color18: base01
2255 ! *color19: base02
2256 ! *color20: base04
2257 ! *color21: base06
2258
2259
2260 ! Tango colour theme for rxvt-unicode
2261 URxvt.background: #FFFFFF
2262 URxvt.foreground: #000000
2263
2264 ! Black
2265 URxvt.color0: #2E3436
2266 URxvt.color8: #757773
2267
2268 ! Red
2269 URxvt.color1: #CC0000
2270 URxvt.color9: #EF2929
2271
2272 ! Green
2273 URxvt.color2: #4E9A06
2274 URxvt.color10: #8AE234
2275
2276 ! Yellow
2277 URxvt.color3: #C4A000
2278 URxvt.color11: #FCE94F
2279
2280 ! Blue
2281 URxvt.color4: #3465A4
2282 URxvt.color12: #729FCF
2283
2284 ! Magenta
2285 URxvt.color5: #75507B
2286 URxvt.color13: #AD7FA8
2287
2288 !! Cyan
2289 !URxvt.color6: #06989A
2290 !URxvt.color14: #34E2E2
2291 ! orange (replaces cyan)
2292 ,,*color6: #ce5c00
2293 ,,*color14: #fcaf3e
2294
2295 ! White
2296 URxvt.color7: #D3D7CF
2297 URxvt.color15: #EEEEEC
2298 #+end_src
2299
2300 *** ~/.xsession
2301 :PROPERTIES:
2302 :header-args+: :tangle ~/.xsession :tangle-mode (identity #o755)
2303 :END:
2304
2305 For custom session on Debian. See https://wiki.debian.org/Xsession.
2306
2307 #+begin_src sh
2308 if [ -f "$HOME/.xinitrc" ]; then
2309 . "$HOME/.xinitrc"
2310 fi
2311
2312 [ -f "/usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd" ] && /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd &
2313 [ -x "$(command -v light-locker)" ] && light-locker --lock-on-suspend &
2314 [ -x "$(command -v pasystray)" ] && pasystray -a &
2315 [ -x "$(command -v nm-applet)" ] && nm-applet &
2316 [ -x "$(command -v compton)" ] && compton &
2317 [ -x "$(command -v dunst)" ] && dunst &
2318 [ -x "$(command -v emacs)" ] && exec ssh-agent exwm -ib 0
2319 #+end_src
2320
2321 *** ~/.xsessionrc
2322 :PROPERTIES:
2323 :header-args+: :tangle ~/.xsessionrc
2324 :END:
2325
2326 #+begin_src sh
2327 if [ -f "$HOME/.profile" ]; then . "$HOME/.profile"; fi
2328 #+end_src
2329
2330 ** XDG
2331 :PROPERTIES:
2332 :header-args+: :tangle ~/.config/user-dirs.dirs
2333 :END:
2334
2335 #+begin_src conf
2336 XDG_DESKTOP_DIR="$HOME/Desktop"
2337 XDG_DOCUMENTS_DIR="$HOME/usr/doc"
2338 XDG_DOWNLOAD_DIR="$HOME/usr/dl"
2339 XDG_MUSIC_DIR="$HOME/usr/music"
2340 XDG_PICTURES_DIR="$HOME/usr/pic"
2341 XDG_PUBLICSHARE_DIR="$HOME/usr/pub"
2342 XDG_TEMPLATES_DIR="$HOME/usr/temp"
2343 XDG_VIDEOS_DIR="$HOME/usr/vid"
2344 #+end_src
2345
2346 ** zathura
2347 :PROPERTIES:
2348 :header-args+: :tangle ~/.config/zathura/zathurarc
2349 :END:
2350
2351 #+begin_src conf
2352 set smooth-scroll true
2353 set selection-clipboard clipboard
2354 set zoom-step 05
2355 set default-bg "#272727"
2356 set statusbar-bg "#272727"
2357 set inputbar-bg "#373737"
2358 set window-title-basename true
2359 set statusbar-home-tilde true
2360
2361 map <Return> scroll down
2362 map <A-Return> scroll up
2363
2364 map H jumplist backward
2365 map L jumplist forward
2366
2367 map [normal] i toggle_index
2368 map [index] i toggle_index
2369 map [index] q toggle_index
2370 #+end_src
2371
2372 * Scripts
2373
2374 This section contains various useful scripts including ones used by
2375 the programs above. For instance, =toggle-tablet= for switching to
2376 and from tablet mode on my X220T, =toggle-presentation-mode= for
2377 toggling Xfce's presentation mode which keeps the screen awake, and
2378 =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
2379 exact brightness value.
2380
2381 ** battery-percentage-time
2382 :PROPERTIES:
2383 :header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh"
2384 :END:
2385
2386 #+begin_src sh :tangle no
2387 dbus_send() {
2388 label=$1
2389 dbus-send --print-reply=literal --system \
2390 --dest=org.freedesktop.UPower \
2391 /org/freedesktop/UPower/devices/battery_BAT0 \
2392 org.freedesktop.DBus.Properties.Get \
2393 string:org.freedesktop.UPower.Device \
2394 string:"${label}" | awk '{print $3}'
2395 }
2396
2397 perc=$(dbus_send 'Percentage')
2398 state=$(dbus_send 'State')
2399
2400 if [ "$state" -eq 2 ]; then # Discharging
2401 secs=$(dbus_send 'TimeToEmpty')
2402 elif [ "$state" -eq 1 ]; then # Charging
2403 secs=$(dbus_send 'TimeToFull')
2404 fi
2405
2406 printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
2407 #+end_src
2408
2409 ** emcl
2410 :PROPERTIES:
2411 :header-args+: :tangle ~/.local/bin/emcl :shebang "#!/bin/sh"
2412 :END:
2413
2414 #+begin_src sh
2415 exec emacsclient --alternate-editor="" -c "$@"
2416 #+end_src
2417
2418 ** my-i3status
2419 :PROPERTIES:
2420 :header-args+: :tangle ~/.local/bin/my-i3status :shebang "#!/usr/bin/env python2"
2421 :END:
2422
2423 #+begin_src python
2424 # -*- coding: utf-8 -*-
2425
2426 # This script is a simple wrapper which prefixes each i3status line with custom
2427 # information. It is based on:
2428 # https://github.com/i3/i3status/blob/master/contrib/wrapper.py
2429 #
2430 # In ~/.i3status.conf, add the following line:
2431 # output_format = "i3bar"
2432 # in the 'general' section.
2433 # Then, in ~/.config/i3/config or ~/.config/sway/config add:
2434 # status_command i3status | my-i3status.py
2435 # in the 'bar' section. Make sure my-i3status.py is in $PATH.
2436 #
2437 # © 2012 Valentin Haenel <valentin.haenel@gmx.de>
2438 # © 2018 Amin Bandali <bandali@gnu.org>
2439 #
2440 # This program is free software. It comes without any warranty, to the extent
2441 # permitted by applicable law. You can redistribute it and/or modify it under
2442 # the terms of the Do What The Fuck You Want To Public License (WTFPL), Version
2443 # 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more
2444 # details.
2445
2446 import sys
2447 import json
2448 import os
2449
2450 def get_nosleep():
2451 """ Return true if ~/.nosleep exists. """
2452 return os.path.isfile(os.path.expanduser("~/.nosleep"))
2453
2454 def print_line(message):
2455 """ Non-buffered printing to stdout. """
2456 sys.stdout.write(message + '\n')
2457 sys.stdout.flush()
2458
2459 def read_line():
2460 """ Interrupted respecting reader for stdin. """
2461 # try reading a line, removing any extra whitespace
2462 try:
2463 line = sys.stdin.readline().strip()
2464 # i3status sends EOF, or an empty line
2465 if not line:
2466 sys.exit(3)
2467 return line
2468 # exit on ctrl-c
2469 except KeyboardInterrupt:
2470 sys.exit()
2471
2472 if __name__ == '__main__':
2473 # Skip the first line which contains the version header.
2474 print_line(read_line())
2475
2476 # The second line contains the start of the infinite array.
2477 print_line(read_line())
2478
2479 while True:
2480 line, prefix = read_line(), ''
2481 # ignore comma at start of lines
2482 if line.startswith(','):
2483 line, prefix = line[1:], ','
2484
2485 if get_nosleep():
2486 j = json.loads(line)
2487 # insert information into the start of the json, but could be anywhere
2488 j.insert(0, {'full_text' : '•', 'name' : 'nosleep'})
2489 # and echo back new encoded json
2490 print_line(prefix+json.dumps(j))
2491 else:
2492 print_line(prefix+line)
2493 #+end_src
2494
2495 ** rofi-light
2496 :PROPERTIES:
2497 :header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/sh"
2498 :END:
2499
2500 #+begin_src sh
2501 cur=$(light -G)
2502 val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12)
2503 [ -n "$val" ] && light -S "$val"
2504 #+end_src
2505
2506 ** rofi-remmina
2507 :PROPERTIES:
2508 :header-args+: :tangle ~/.local/bin/rofi-remmina :shebang "#!/usr/bin/env python2"
2509 :END:
2510
2511 #+begin_src python
2512 import ConfigParser
2513 import os
2514 from subprocess import Popen, PIPE
2515
2516 remmina_dir = os.path.expanduser("~/.local/share/remmina")
2517
2518 fdict = dict()
2519
2520 for f in os.listdir(remmina_dir):
2521 fp = os.path.join(remmina_dir, f)
2522 c = ConfigParser.ConfigParser()
2523 c.read(fp)
2524 n = c.get('remmina', 'name')
2525 fdict[n] = fp
2526
2527 lines = max(min(15, len(fdict)), 1);
2528 width = len(max(fdict.keys(), key=len))
2529 rofi = Popen(["rofi", "-i", "-dmenu", \
2530 "-l", str(lines), "-width", str(width), \
2531 "-p", "connection"], stdout=PIPE, stdin=PIPE)
2532 selected = rofi.communicate("\n" \
2533 .join(fdict.keys()) \
2534 .encode("utf-8"))[0] \
2535 .decode("utf-8") \
2536 .strip()
2537 rofi.wait()
2538
2539 r = Popen(["remmina", "-c", fdict[selected]])
2540 r.wait()
2541 #+end_src
2542
2543 ** toggle-presentation-mode
2544 :PROPERTIES:
2545 :header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/sh"
2546 :END:
2547
2548 #+begin_src sh
2549 xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
2550 #+end_src
2551
2552 ** toggle-tablet
2553 :PROPERTIES:
2554 :header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/sh"
2555 :END:
2556
2557 #+begin_src sh
2558 # This script toggles between a 'normal' mode and a 'tablet' mode, doing
2559 # a few things:
2560
2561 # - rotates the screen using =xrandr=, so that rotating the physical
2562 # display of my X220t would have the laptop's battery on the right
2563 # hand side,
2564 # - enables touch screen,
2565 # - properly rotates the stylus pen and touch screen pointers, and
2566 # - toggles between RGB and Vertical BGR sub-pixel order.
2567
2568 case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
2569 0) # Screen is not rotated, we should rotate it right (90°)
2570 xrandr -o 3
2571 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
2572 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
2573 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
2574 xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
2575 ;;
2576 1) # Currently top is rotated right, we should set it normal (0°)
2577 xrandr -o 0
2578 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
2579 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
2580 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
2581 xfconf-query -c xsettings -p /Xft/RGBA -s rgb
2582 ;;
2583 ,*)
2584 echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
2585 exit 1
2586 ;;
2587 esac
2588 #+end_src
2589
2590 ** volume-info
2591 :PROPERTIES:
2592 :header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
2593 :END:
2594
2595 #+begin_src sh
2596 cur_vol=$(pamixer --get-volume)
2597
2598 if [ $(pamixer --get-mute) = true ]; then
2599 printf 'mt \n' "$cur_vol"
2600 else
2601 printf '%02d \n' "$cur_vol"
2602 fi
2603 #+end_src
2604
2605 ** zathura-sync
2606 :PROPERTIES:
2607 :header-args+: :tangle ~/.local/bin/zathura-sync :shebang "#!/bin/sh"
2608 :END:
2609
2610 #+begin_src sh
2611 pos="$1"
2612 pdffile="$2"
2613 zathura --synctex-forward "$pos" "$pdffile" || \
2614 (
2615 zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" &
2616 sleep 1; zathura --synctex-forward "$pos" "$pdffile" )
2617 #+end_src