X-Git-Url: https://git.shemshak.org/gitweb.cgi/~bandali/configs/blobdiff_plain/306f0e82fe425b8d47c92d4dbb607bccc83a1493..5d3bd4099ecff7b02454efcb6f6bb355a992aef8:/rc.org?ds=sidebyside diff --git a/rc.org b/rc.org index 85cd0e2..8d770c0 100644 --- a/rc.org +++ b/rc.org @@ -1,5 +1,5 @@ #+title: rc.org -#+property: header-args :comments link :mkdirp yes :results silent +#+property: header-args :comments no :mkdirp yes :results silent * About @@ -12,140 +12,662 @@ Note: This file is best viewed inside Emacs with org mode. * Configs This section contains the configuration files (dotfiles) of various -programs I use. +programs I use besides GNU Emacs. -** dovecot +** Fontconfig :PROPERTIES: -:header-args+: :tangle "/sudo::/etc/dovecot/dovecot.conf" +:header-args+: :tangle ~/.config/fontconfig/fonts.conf +:END: + +#+begin_src xml + + + + + + rgb + + + + + true + + + + + hintslight + + + + + true + + + + + lcddefault + + + ~/.fonts + + + + Helvetica + + Liberation Sans + + + +#+end_src + +** getmail +:PROPERTIES: +:header-args+: :tangle ~/.config/getmail/getmailrc :END: #+begin_src conf -protocols = imap +[retriever] +type = SimplePOP3SSLRetriever +server = fencepost.gnu.org +username = bandali +password_command = ("gpg", "--no-tty", "-q", "-d", "/home/bandali/.passwd/gnu.gpg") +port = 995 +use_apop = True + +[destination] +type = Maildir +path = ~/mail/gnu.local/bandali/mail/ + +# [destination] +# type = MDA_external +# path = /usr/lib/dovecot/deliver +# arguments = ('-e', '-f', '%(sender)', '-d', 'bandali@gnu.local') -listen = 127.0.0.1 -log_path = /var/log/dovecot.log -info_log_path = /var/log/dovecot-info.log +[options] +read_all = false +delete_after = 1 +# delete = true +received = false +delivered_to = false +#+end_src -ssl = no -disable_plaintext_auth = no +** Git -auth_verbose = yes -auth_mechanisms = plain +*** config +:PROPERTIES: +:header-args+: :tangle ~/.config/git/config +:END: -passdb { - driver = passwd-file - args = /etc/dovecot/passwd -} +#+begin_src conf +[user] + name = Amin Bandali + email = bandali@gnu.org + signingkey = BE6273738E616D6D1B3A08E8A21A020248816103 -userdb { - driver = static - args = uid=amin gid=amin home=/home/amin/mail/%d/%n - default_fields = mail=maildir:/home/amin/mail/%d/%n/mail -} +[commit] + gpgsign = true -# mail_home = /home/amin/mail/%d/%n -# mail_location = maildir:/home/amin/mail/%d/%n/mail:LAYOUT=fs:INBOX=/home/amin/mail/%d/%n/mail/Inbox +# [format] +# signoff = true -# namespace { -# inbox = yes -# separator = / -# } +[core] + autocrlf = input # CRLF -> LF on commit + editor = emacsclient -t + pager = "less" + +[mailmap] + file = ~/.config/git/mailmap + +[alias] + git = !exec git # handle nested git calls, e.g. git git status + aliases = config --get-regexp '^alias\\.' + a = add + s = status + sl = status --long + c = checkout + cb = checkout -b + b = branch + r = rebase + p = pull + pr = pull --rebase + ps = push + psf = push --force + nmam = "!f() { notmuch show --format=raw $1 | git am -; }; f" + nmam3 = "!f() { notmuch show --format=raw $1 | git am -3 -; }; f" + +[color] + ui = auto +[color "status"] + added = green bold + changed = red bold + untracked = red bold +[color "branch"] + current = green bold + remote = magenta bold +[color "diff"] + new = green bold + old = red bold + +# [status] +# # showUntrackedFiles = all +# short=true +# branch=true + +[github] + user = notbandali + +[sendemail] + smtpuser = bandali + smtpserver = fencepost.gnu.org + smtpserverport = 587 + smtpencryption = tls + annotate = yes + +[transfer] + fsckObjects = true +#+end_src -mail_plugins = $mail_plugins fts fts_lucene +*** ignore +:PROPERTIES: +:header-args+: :tangle ~/.config/git/ignore +:END: -plugin { - fts = lucene - fts_lucene = whitespace_chars=@. - fts_autoindex = yes -} +#+begin_src conf +*.orig +*.py[co] +*.sublime-workspace +*~ +.DS_Store +*.elc +*-autoloads.el +TAGS +#+end_src + +*** mailmap +:PROPERTIES: +:header-args+: :tangle ~/.config/git/mailmap +:END: + +#+begin_src conf + + + + + #+end_src -** libinput +** GnuPG +:PROPERTIES: +:header-args+: :tangle ~/.gnupg/gpg-agent.conf +:END: -Improve XPS 15 9560's touchpad experience. +#+begin_src conf +default-cache-ttl 43200 +max-cache-ttl 86400 -# begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "plasma")) "/sudo::/etc/X11/xorg.conf.d/30-touchpad.conf") -#+begin_src conf :tangle no -Section "InputClass" - Identifier "libinput touchpad catchall" - Driver "libinput" - MatchIsTouchpad "on" - Option "ClickMethod" "clickfinger" - Option "NaturalScrolling" "true" - Option "Tapping" "on" - Option "TappingButtonMap" "lrm" -EndSection +default-cache-ttl-ssh 43200 +max-cache-ttl-ssh 86400 + +pinentry-program /home/bandali/.guix-profile/bin/pinentry-emacs +allow-emacs-pinentry +allow-loopback-pinentry +#+end_src + +** GTK + +*** GTK+ 2 +:PROPERTIES: +:header-args+: :tangle ~/.gtkrc-2.0 +:END: + +#+begin_src conf +gtk-theme-name="Xfce" +# gtk-icon-theme-name="elementary Xfce darker" +gtk-font-name="Roboto 10" +# gtk-font-name="Source Code Variable 10" +gtk-menu-images=0 +# gtk-key-theme-name = "Emacs" +#+end_src + +*** GTK+ 3 +:PROPERTIES: +:header-args+: :tangle ~/.config/gtk-3.0/settings.ini +:END: + +#+begin_src conf +[Settings] +gtk-icon-theme-name = Adwaita +# gtk-theme-name = Adwaita + +gtk-theme-name = Xfce +# gtk-theme-name = Arc-Darker +# gtk-theme-name = Numix-ArchBlue + +gtk-font-name = Roboto 10 +# gtk-font-name = Source Code Variable Medium 10 +# gtk-key-theme-name = Emacs +#+end_src + +** Guix + +*** Channels +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/channels.scm +:END: + +#+begin_src scheme +(list (channel + (name 'guix) ; https://git.savannah.gnu.org/git/guix.git + (url "file:///home/bandali/src/git/guix")) + (channel + (name 'guix-bandali) ; https://git.sr.ht/~bandali/guix-bandali + (url "file:///home/bandali/src/git/guix-bandali"))) +#+end_src + +*** Profile manifests + +To install/update the packages of the default profile, use +#+begin_example +guix package -m $MY_GUIX_MANIFESTS/main.scm +#+end_example +and for other profiles, use +#+begin_example +guix package -m $MY_GUIX_MANIFESTS/name.scm -p $MY_GUIX_PROFILES/name/name +#+end_example +where =name= is the name of the profile (e.g. =doc=, =media=, ...). + +**** doc +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/manifest/doc.scm +:END: + +#+begin_src scheme +(specifications->manifest + '("libreoffice" + "texlive-amsfonts" + "texlive-base" + "texlive-latex-listings" + ;; "texlive-palatino" + "texlive-xcolor" +)) +#+end_src + +**** main +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/manifest/main.scm +:END: + +#+begin_src scheme +(specifications->manifest + '("alsa-utils" + "bash-completion" + "cpufrequtils" + "cpupower" + "cvs" + "dunst" + "emacs" + "emacs-alert" + "emacs-amx" + "emacs-async" + "emacs-biblio-git" + "emacs-boxquote" + "emacs-company" + "emacs-company-ebdb" + "emacs-crux" + "emacs-dash" + "emacs-debbugs" + "emacs-diff-hl" + "emacs-dmenu" + "emacs-doom-themes" + "emacs-ebdb" + "emacs-emmet-mode" + ;; "emacs-emojify" + "emacs-erc-hl-nicks" + "emacs-erc-scrolltoplace" + "emacs-eshell-up" + "emacs-exec-path-from-shell" + "emacs-expand-region" + "emacs-exwm" + "emacs-exwm-edit" + "emacs-flycheck" + "emacs-geiser" + ;; "emacs-gnus-harvest" + "emacs-guix" + "emacs-helpful" + "emacs-hl-todo" + "emacs-ivy" + "emacs-magit" + "emacs-message-x" + "emacs-minions" + ;; "emacs-multi-term" + "emacs-multiple-cursors" + "emacs-mwim" + ;; "emacs-next" + ;; "emacs-next-delight" + "emacs-no-littering" + "emacs-org" + "emacs-org-contrib" + "emacs-org-ref" + "emacs-orgalist" + "emacs-page-break-lines" + "emacs-pass" + "emacs-pinentry" + "emacs-projectile" + "emacs-shrink-path-git" + "emacs-smart-mode-line" + "emacs-typo" + "emacs-unkillable-scratch" + "emacs-use-package" + "emacs-web-mode" + "emacs-which-key" + "emacs-yasnippet" + "emacs-znc-git" + "font-adobe-source-code-pro" + "font-gnu-freefont-ttf" + "font-google-roboto" + "font-liberation" + "font-linuxlibertine" + "font-sil-gentium" + "font-tex-gyre" + ;; "font-ubuntu" + "font-vazir" + "getmail" + "gettext" + "git" + "git:send-email" + "gnupg" + "guile" + "haunt" + "htop" + "hunspell" + "hunspell-dict-en-ca" + "hunspell-dict-en-us" + "isync" + "light" + "msmtp" + "ncdu" + "notmuch" + "openjdk" + "openssh" + "openssl" + "pass-otp" + "password-store" + "pasystray" + "pinentry-emacs" + "poppler" ; for 'pdffonts' + "rofi" + "rofi-pass" + "rsync" + "rxvt-unicode" + "screen" + "scrot" + "setxkbmap" + "strace" + "thinkfan" + "unzip" + "wget" + "xdg-user-dirs" + ;; "xkbcomp" + "xmodmap" + "xrdb" + "xset" + "xsetroot")) +#+end_src + +**** media +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/manifest/media.scm +:END: + +#+begin_src scheme +(specifications->manifest + '("audacity" + "gimp" + "inkscape" + "mpv" + "youtube-dl")) +#+end_src + +**** web +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/manifest/web.scm +:END: + +#+begin_src scheme +(specifications->manifest + '("icecat" + "rtv")) +#+end_src + +*** Systems + +**** chaman +:PROPERTIES: +:header-args+: :tangle ~/.config/guix/system/chaman.scm +:END: + +#+begin_src scheme +(use-modules (gnu) + (gnu packages certs) ; for nss-certs + (gnu packages emacs-xyz) ; for exwm + (gnu packages linux)) ; for powertop +(use-service-modules admin desktop mail networking pm ssh xorg) + +(operating-system + (host-name "chaman") + (locale "en_CA.utf8") + (timezone "Canada/Eastern") + (keyboard-layout + (keyboard-layout "us" "basic")) + (bootloader + (bootloader-configuration + (bootloader grub-bootloader) + (target "/dev/sda") + (keyboard-layout keyboard-layout))) + (mapped-devices + (list (mapped-device + (source + (uuid "283da85e-2c84-47e6-a8ca-20f4e8efb806")) + (target "groot") + (type luks-device-mapping)) + (mapped-device + (source + (uuid "017ddebc-c2c3-4a0a-bda4-d47ec0bc67f0")) + (target "data") + (type luks-device-mapping)))) + (file-systems + (cons* (file-system + (mount-point "/") + (device "/dev/mapper/groot") + (type "ext4") + (dependencies mapped-devices)) + (file-system + (mount-point "/data") + (device "/dev/mapper/data") + (type "ext4") + (dependencies mapped-devices)) + %base-file-systems)) + (users + (cons* (user-account + (name "bandali") + (group "users") + (home-directory "/home/bandali") + (supplementary-groups + '("wheel" "netdev" "audio" "video"))) + %base-user-accounts)) + (packages + (cons* nss-certs + emacs-exwm + %base-packages)) + (services + (cons* + (service xfce-desktop-service-type) + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout))) + (dovecot-service + #:config + (dovecot-configuration + ;; (log-path "/dev/stderr") + (protocols (list (protocol-configuration + (name "imap")))) + (ssl? "no") + (listen '("127.0.0.1")) + (disable-plaintext-auth? #f) + (auth-mechanisms '("plain")) + (postmaster-address "bandali@gnu.local") + (mail-location "maildir:/home/bandali/mail/%d/%n/mail") + (userdbs (list (userdb-configuration + (driver "static") + (args (list "uid=bandali" "gid=users" "home=/home/bandali/mail/%d/%n"))))) + (passdbs (list (passdb-configuration + (driver "passwd-file") + (args (list "/data/dovecot-passwd"))))))) + (service rottlog-service-type) + (service thermald-service-type) + (service tlp-service-type + (tlp-configuration + (cpu-boost-on-ac? #t) + (sound-power-save-on-bat 0) + (sound-power-save-controller? #f) + ;; (usb-blacklist "0e8f:00a8") ;for some reason doesn't seem to work + (usb-autosuspend? #f))) + (simple-service 'my-powertop-auto-tune activation-service-type + #~(zero? (system* #$(file-append powertop "/sbin/powertop") + "--auto-tune"))) + (simple-service 'light-udev-rules udev-service-type (list light)) + %desktop-services))) #+end_src -** mkinitcpio - -#+begin_src conf :tangle /sudo::/etc/mkinitcpio.conf :comments none -# vim:set ft=sh -# MODULES -# The following modules are loaded before any boot hooks are -# run. Advanced users may wish to specify all system modules -# in this array. For instance: -# MODULES=(piix ide_disk reiserfs) -MODULES=(i915) - -# BINARIES -# This setting includes any additional binaries a given user may -# wish into the CPIO image. This is run last, so it may be used to -# override the actual binaries included by a given hook -# BINARIES are dependency parsed, so you may safely ignore libraries -BINARIES=() - -# FILES -# This setting is similar to BINARIES above, however, files are added -# as-is and are not parsed in any way. This is useful for config files. -FILES=() - -# HOOKS -# This is the most important setting in this file. The HOOKS control the -# modules and scripts added to the image, and what happens at boot time. -# Order is important, and it is recommended that you do not change the -# order in which HOOKS are added. Run 'mkinitcpio -H ' for -# help on a given hook. -# 'base' is _required_ unless you know precisely what you are doing. -# 'udev' is _required_ in order to automatically load modules -# 'filesystems' is _required_ unless you specify your fs modules in MODULES -# Examples: -## This setup specifies all modules in the MODULES setting above. -## No raid, lvm2, or encrypted root is needed. -# HOOKS=(base) -# -## This setup will autodetect all modules for your system and should -## work as a sane default -# HOOKS=(base udev autodetect block filesystems) -# -## This setup will generate a 'full' image which supports most systems. -## No autodetection is done. -# HOOKS=(base udev block filesystems) -# -## This setup assembles a pata mdadm array with an encrypted root FS. -## Note: See 'mkinitcpio -H mdadm' for more information on raid devices. -# HOOKS=(base udev block mdadm encrypt filesystems) -# -## This setup loads an lvm2 volume group on a usb device. -# HOOKS=(base udev block lvm2 filesystems) -# -## NOTE: If you have /usr on a separate partition, you MUST include the -# usr, fsck and shutdown hooks. -HOOKS=(base udev autodetect modconf block keyboard encrypt lvm2 resume filesystems fsck) - -# COMPRESSION -# Use this to compress the initramfs image. By default, gzip compression -# is used. Use 'cat' to create an uncompressed image. -#COMPRESSION="gzip" -#COMPRESSION="bzip2" -#COMPRESSION="lzma" -#COMPRESSION="xz" -#COMPRESSION="lzop" -#COMPRESSION="lz4" - -# COMPRESSION_OPTIONS -# Additional options for the compressor -#COMPRESSION_OPTIONS=() +** isync +:PROPERTIES: +:header-args+: :tangle ~/.config/isync/mbsyncrc +:END: + +#+begin_src conf +# Global defaults +CopyArrivalDate yes +Create Both +Expunge Both + +###### +IMAPAccount shemshak +Host mail.shemshak.org +User amin@shemshak.org +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak.gpg" +SSLType IMAPS + +IMAPStore shemshak-remote +Account shemshak + +IMAPAccount shemshak-local +Host 127.0.0.1 +Port 143 +User amin@shemshak.local +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/shemshak-local.gpg" +SSLType None + +IMAPStore shemshak-local +Account shemshak-local + +Channel shemshak +Master :shemshak-remote: +Slave :shemshak-local: +Patterns * + +###### +IMAPAccount gnub +Host mail.shemshak.org +User gnu@bandali.eu.org +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub.gpg" +SSLType IMAPS + +IMAPStore gnub-remote +Account gnub + +IMAPAccount gnub-local +Host 127.0.0.1 +Port 143 +User bandali@gnu.local +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/gnub-local.gpg" +SSLType None + +IMAPStore gnub-local +Account gnub-local + +Channel gnub +Master :gnub-remote: +Slave :gnub-local: +Patterns * + +###### +IMAPAccount uwaterloo +Host connect.uwaterloo.ca +User abandali +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo.gpg" +SSLType IMAPS + +IMAPStore uwaterloo-remote +Account uwaterloo + +IMAPAccount uwaterloo-local +Host 127.0.0.1 +Port 143 +User abandali@uw.local +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo-local.gpg" +SSLType None + +IMAPStore uwaterloo-local +Account uwaterloo-local + +Channel uwaterloo +Master :uwaterloo-remote: +Slave :uwaterloo-local: +Patterns * + +###### +IMAPAccount csclub +Host mail.csclub.uwaterloo.ca +User abandali +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub.gpg" +SSLType IMAPS + +IMAPStore csclub-remote +Account csclub + +IMAPAccount csclub-local +Host 127.0.0.1 +Port 143 +User abandali@csc.uw.local +PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/csclub-local.gpg" +SSLType None + +IMAPStore csclub-local +Account csclub-local + +Channel csclub +Master :csclub-remote: +Slave :csclub-local: +Patterns * +#+end_src + +** Latexmk +:PROPERTIES: +:header-args+: :tangle ~/.config/latexmk/latexmkrc +:END: + +#+begin_src conf +$pdf_previewer = "start zathura %O %S"; +$clean_ext = "aux out"; + +# $pdf_update_method = 4; +# $pdf_update_command = "zathura %O %S"; + +# Synctex allows one to jump to from the PDF in Zathura to the source in Emacs +# by Ctrl+click in the PDF. +# Tell latexmk to use Zathura as a previewer, and run emacsclient as the Synctex +# editor. +# $pdf_previewer = 'exec zathura --synctex-forward -x \'emacsclient --no-wait +%{line} %{input}\' %O %S'; #+end_src ** mpd @@ -563,6 +1085,76 @@ audio_output { ############################################################################### #+end_src +** msmtp +:PROPERTIES: +:header-args+: :tangle ~/.config/msmtp/config +:END: + +#+begin_src conf +# Set default values for all following accounts. +defaults +port 587 +tls on +auth on +#tls_trust_file /etc/ssl/certs/ca-certificates.crt +logfile ~/.msmtp.log + +account shemshak +host mail.shemshak.org +# use `msmtp -a shemshak --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint +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 +tls_starttls on +from amin@shemshak.org +user amin@shemshak.org +passwordeval gpg --no-tty -q -d ~/.passwd/shemshak.gpg + +account aminb : shemshak +from amin@aminb.org +account bndl : shemshak +from amin@bndl.org + +account gnu +host fencepost.gnu.org +# use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint +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 +tls_starttls on +from bandali@gnu.org +user bandali +passwordeval gpg --no-tty -q -d ~/.passwd/gnu.gpg + +account gnu-mab : gnu +from mab@gnu.org +account gnu-aminb : gnu +from aminb@gnu.org +account gnu-amin : gnu +from amin@gnu.org + +account uwaterloo +host connect.uwaterloo.ca +tls_starttls on +from abandali@uwaterloo.ca +user abandali +passwordeval gpg --no-tty -q -d ~/.passwd/uwaterloo.gpg +tls_trust_file /etc/ssl/certs/ca-certificates.crt + +account uwaterloo-friendly : uwaterloo +from bandali@uwaterloo.ca + +account csclub +host mail.csclub.uwaterloo.ca +tls_starttls on +from abandali@csclub.uwaterloo.ca +user abandali +passwordeval gpg --no-tty -q -d ~/.passwd/csclub.gpg +tls_trust_file /etc/ssl/certs/ca-certificates.crt + +account csclub-friendly : csclub +from bandali@csclub.uwaterloo.ca + +# Set a default account +account default : shemshak +#+end_src + ** ncmpcpp *** config @@ -1140,226 +1732,6 @@ def_key "K" move_sort_order_up #+end_src -** pacman - -*** conf - -#+begin_src conf :tangle /sudo::/etc/pacman.conf :comments none -# -# /etc/pacman.conf -# -# See the pacman.conf(5) manpage for option and repository directives - -# -# GENERAL OPTIONS -# -[options] -# The following paths are commented out with their default values listed. -# If you wish to use different paths, uncomment and update the paths. -#RootDir = / -#DBPath = /var/lib/pacman/ -#CacheDir = /var/cache/pacman/pkg/ -#LogFile = /var/log/pacman.log -#GPGDir = /etc/pacman.d/gnupg/ -#HookDir = /etc/pacman.d/hooks/ -HoldPkg = pacman glibc -#XferCommand = /usr/bin/curl -L -C - -f -o %o %u -#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u -#CleanMethod = KeepInstalled -#UseDelta = 0.7 -Architecture = auto - -# Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup -#IgnorePkg = -#IgnoreGroup = - -#NoUpgrade = -#NoExtract = - -# Misc options -#UseSyslog -Color -TotalDownload -CheckSpace -VerbosePkgLists - -# By default, pacman accepts packages signed by keys that its local keyring -# trusts (see pacman-key and its man page), as well as unsigned packages. -SigLevel = Required DatabaseOptional -LocalFileSigLevel = Optional -#RemoteFileSigLevel = Required - -# NOTE: You must run `pacman-key --init` before first using pacman; the local -# keyring can then be populated with the keys of all Arch/Parabola packagers -# with `pacman-key --populate archlinux` and `pacman-key --populate parabola`. - -# -# REPOSITORIES -# - can be defined here or included from another file -# - pacman will search repositories in the order defined here -# - local/custom mirrors can be added here or in separate files -# - repositories listed first will take precedence when packages -# have identical names, regardless of version number -# - URLs will have $repo replaced by the name of the current repo -# - URLs will have $arch replaced by the name of the architecture -# -# Repository entries are of the format: -# [repo-name] -# Server = ServerName -# Include = IncludePath -# -# The header [repo-name] is crucial - it must be present and -# uncommented to enable the repo. -# - -# The testing repositories are disabled by default. To enable, uncomment the -# repo name header and Include lines. You can add preferred servers immediately -# after the header, and they will be used before the default mirrors. - -# NOTE: Nonprism is a particular repository that aims to provide software built -# and patched without services under global data surveillance programs like PRISM, -# XKeyscore and Tempora. For more info see: https://wiki.parabola.nu/Nonprism - -#[nonprism-testing] -#Include = /etc/pacman.d/mirrorlist - -#[nonprism] -#Include = /etc/pacman.d/mirrorlist - -[libre-testing] -Include = /etc/pacman.d/mirrorlist - -[libre] -Include = /etc/pacman.d/mirrorlist - -#[testing] -#Include = /etc/pacman.d/mirrorlist - -[core] -Include = /etc/pacman.d/mirrorlist - -[extra] -Include = /etc/pacman.d/mirrorlist - -#[community-testing] -#Include = /etc/pacman.d/mirrorlist - -[community] -Include = /etc/pacman.d/mirrorlist - -# The PCR (Parabola Community Repository) contains packages maintained by trusted -# members of the Parabola community. It also contains packages maintained by -# Parabola developers, but that the developer decided didn't belong in core/libre. - -#[pcr-testing] -#Include = /etc/pacman.d/mirrorlist - -[pcr] -Include = /etc/pacman.d/mirrorlist - -# If you want to run 32 bit applications on your x86_64 system, -# enable the libre-multilib, multilib and pcr-multilib repositories as required here. - -#[nonprism-multilib-testing] -#Include = /etc/pacman.d/mirrorlist - -#[nonprism-multilib] -#Include = /etc/pacman.d/mirrorlist - -#[libre-multilib-testing] -#Include = /etc/pacman.d/mirrorlist - -#[libre-multilib] -#Include = /etc/pacman.d/mirrorlist - -#[multilib-testing] -#Include = /etc/pacman.d/mirrorlist - -#[multilib] -#Include = /etc/pacman.d/mirrorlist - -#[pcr-multilib-testing] -#Include = /etc/pacman.d/mirrorlist - -#[pcr-multilib] -#Include = /etc/pacman.d/mirrorlist - -# Parabola also supports another community projects and personal repositories, to -# find them check out this wiki page: https://wiki.parabola.nu/Repositories - -# An example of a custom package repository. See the pacman manpage for -# tips on creating your own repositories. -#[custom] -#SigLevel = Optional TrustAll -#Server = file:///home/custompkgs - -Include = /etc/pacman.d/*.conf -#+end_src - -*** mirrorlist - -#+begin_src conf :tangle /sudo::/etc/pacman.d/mirrorlist :comments none -# Parabola GNU/Linux-libre - Last Updated: Wed Dec 20 02:59:35 GMT 2017 - -Server = http://mirror.fsf.org/parabola/$repo/os/$arch -Server = http://mirror.fsf.org/parabola/$repo/os/$arch -Server = http://mirror.fsf.org/parabola/$repo/os/$arch -Server = http://mirror.fsf.org/parabola/$repo/os/$arch - -# Location: London, UK -# Responsible: Parabola Project -# Note: Not really a mirror, automatically redirects you to an Arch -# mirror when possible. Works best specifying it a few times in a -# row (404s workaround). -# Server = http://redirector.parabola.nu/$repo/os/$arch -Server = https://redirector.parabola.nu/$repo/os/$arch - -# Location: Reykjavík, Iceland -# Responsible: Parabola Project -# Note: Not really a mirror, automatically redirects you to a Parabola -# mirror that has the file you are looking for. -# Server = http://repomirror.parabola.nu/$repo/os/$arch -Server = https://repomirror.parabola.nu/$repo/os/$arch - -# Location: Falkenstein, Germany -# Server = http://mirror.grapentin.org/parabola/$repo/os/$arch -Server = https://mirror.grapentin.org/parabola/$repo/os/$arch - -# Location: Volendam, Netherlands -Server = https://jeweet.net/repo/parabola/$repo/os/$arch - -# Location: Amsterdam, Netherlands -# Note: Not really a mirror, but a high-speed 10GiB cache for -# mirror.yandex.ru/mirrors/parabola -# Server = http://parabola.isacdaavid.info:8080/$repo/os/$arch -Server = https://parabola.isacdaavid.info:8081/$repo/os/$arch - -# Location: Moscow, Russian Federation -# Server = http://mirror.yandex.ru/mirrors/parabola/$repo/os/$arch -Server = https://mirror.yandex.ru/mirrors/parabola/$repo/os/$arch - -# Location: Ho Chi Minh City, Vietnam -# Server = http://mirror.freedif.org/Parabola/$repo/os/$arch -Server = https://mirror.freedif.org/Parabola/$repo/os/$arch - -# Location: Los Angeles, CA, USA -# Note: Also visit http://alfplayer.com/ for its SNAPSHOTS ARCHIVE -Server = http://alfplayer.com/parabola/$repo/os/$arch - -# Location: Boston, MA, USA -Server = http://mirror.fsf.org/parabola/$repo/os/$arch - -# Location: Austin, TX, USA -# Server = http://parabola.serverpit.com/ -Server = https://parabola.serverpit.com/ - -# Location: Reykjavík, Iceland -# Responsible: Parabola Project -# Note: Currently pointing to repomirror.parabola.nu -# Server = http://repo.parabola.nu/$repo/os/$arch -Server = https://repo.parabola.nu/$repo/os/$arch -#+end_src - ** pigeonhole *** amin.sieve :PROPERTIES: @@ -1433,21 +1805,424 @@ if anyof ( } #+end_src -** PowerTOP +** Readline :PROPERTIES: -:header-args+: :tangle "/sudo::/etc/systemd/system/powertop.service" +:header-args+: :tangle ~/.config/readline/inputrc :END: #+begin_src conf -[Unit] -Description=Powertop tunings +set enable-bracketed-paste on + +set colored-stats on +set colored-completion-prefix on +set completion-ignore-case on +set menu-complete-display-prefix on +set page-completions off +set show-all-if-ambiguous on +set show-all-if-unmodified on +set visible-stats on + +TAB: menu-complete +"\e[Z": menu-complete-backward + +"\e[A": history-search-backward +"\e[B": history-search-forward +#+end_src -[Service] -ExecStart=/usr/bin/powertop --auto-tune -RemainAfterExit=true +** rofi +:PROPERTIES: +:header-args+: :tangle ~/.config/rofi/config +:END: + +#+begin_src conf +! rofi.font: Ubuntu Mono 13 +! rofi.font: Inconsolata 16 +! rofi.font: Iosevka 13 +! rofi.font: Source Code Pro 11 +rofi.font: Source Code Pro 10.5 +rofi.modi: run,window +! rofi.width: 640 +rofi.width: 600 +!rofi.location: 2 +!rofi.yoffset: 200 +rofi.monitor: -1 +!rofi.lines: 10 + +rofi.theme: ~/.guix-profile/share/rofi/themes/gruvbox-light-hard.rasi +#+end_src + +** rofi-pass +:PROPERTIES: +:header-args+: :tangle ~/.config/rofi-pass/config +:END: + +#+begin_src conf +# permanently set alternative root dir +# root=/path/to/root + +# rofi command. Make sure to have "$@" as last argument +_rofi () { + #rofi -no-auto-select -kb-accept-entry "!Return" -i -no-levenshtein-sort "$@" + rofi -i -no-auto-select -kb-accept-entry "!Return" "$@" +} + +# xdotool needs the keyboard layout to be set using setxkbmap +# You can do this in your autostart scripts (e.g. xinitrc) + +# If for some reason, you cannot do this, you can set the command here. +# and set fix_layout to true +fix_layout=false + +layout_cmd () { + setxkbmap us +} + +# fields to be used +URL_field='url' +USERNAME_field='user' +AUTOTYPE_field='autotype' + +# delay to be used for :delay keyword +delay=2 + +## Programs to be used +# Editor +EDITOR='gvim -f' + +# Browser +BROWSER='chromium' + +## Misc settings + +default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl +auto_enter='false' +notify='false' +default_autotype='user :tab pass' + +# color of the help messages +# leave empty for autodetection +help_color="#4872FF" + +# Clipboard settings +# Possible options: primary, clipboard, both +clip=primary + +# Options for generating new password entries +# default_user is also used for password files that have no user field. +default_user=aminb +default_user2=bandali +password_length=30 + +# Custom Keybindings +#autotype="Alt+1" +autotype="Alt+m" +type_user="Alt+2" +type_pass="Alt+3" +open_url="Alt+4" +copy_name="Alt+u" +copy_url="Alt+l" +copy_pass="Alt+p" +show="Alt+o" +copy_entry="Alt+2" +type_entry="Alt+1" +copy_menu="Alt+c" +action_menu="Alt+a" +type_menu="Alt+t" +help="Alt+h" +switch="Alt+x" +insert_pass="Alt+n" +#+end_src + +** Screen +:PROPERTIES: +:header-args+: :tangle ~/.config/screen/screenrc +:END: + +#+begin_src screen +startup_message off +caption always "%{= kc}GNU Screen $USER@%H (load: %l)%-28=%{= .m}%D %d.%m.%Y %0c" +#+end_src + +** Shell + +*** GNU Bash +:PROPERTIES: +:header-args+: :tangle ~/.bashrc +:END: -[Install] -WantedBy=multi-user.target +#+begin_src bash +# Bash initialization for interactive non-login shells and +# for remote shells (info "(bash) Bash Startup Files"). + +# Export 'SHELL' to child processes. Programs such as 'screen' +# honor it and otherwise use /bin/sh. +export SHELL + +if [[ $- != *i* ]] +then + # We are being invoked from a non-interactive shell. If this + # is an SSH session (as in "ssh host command"), source + # /etc/profile so we get PATH and other essential variables. + [[ -n "$SSH_CLIENT" ]] && source /etc/profile + + # Don't do anything else. + return +fi + +if [ -n "$IS_GUIX_SYSTEM" ]; then + # Source the system-wide file. + source /etc/bashrc +fi + +# from https://unix.stackexchange.com/a/55935 +b_prompt() { + cwd=$(sed -e "s:$HOME:~:" -e "s:\(\.\?[^/]\)[^/]*/:\1/:g" <<<$PWD) + printf $cwd +} + +if [ $(id -u) == "0" ]; then + PS1='`printf "\[\e[1;31m\]\$\[\e[00m\]"` ' +else + PS1='\$ ' +fi +PS1="\u@\h:\w/`[ -n "$GUIX_ENVIRONMENT" ] && printf \" [env]\"`\n$PS1" + +# set terminal title +PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: $(b_prompt)\007"' + +# i-beam cursor +# echo -e "\033[5 q" # blinking +echo -e "\033[6 q" # non-blinking + +# various bash tweaks +# append to the history file, don't overwrite it +shopt -s histappend +shopt -s cmdhist +# check the window size after each command and, if necessary, +# update the values of LINES and COLUMNS. +shopt -s checkwinsize +# If set, the pattern "**" used in a pathname expansion context will +# match all files and zero or more directories and subdirectories. +#shopt -s globstar +# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) +HISTSIZE= +HISTFILESIZE= +# don't put duplicate lines or lines starting with space in the +# history. +HISTCONTROL=ignoreboth +# ignore a few very common commands and don't add them to history +HISTIGNORE='ls:l:s:g:[bf]g:history' +HISTTIMEFORMAT='%F %T ' +stty stop "" + +# aliases +alias ls='ls -p --color=auto' +alias l='ls -lh' # long format and human-readable sizes +alias ll='l -A' # long format, all files +alias dir='dir --color=auto' +alias vdir='vdir --color=auto' +alias grep='grep --color=auto' +alias fgrep='fgrep --color=auto' +alias egrep='egrep --color=auto' +alias mpv="mpv --ytdl-format mp4" +alias mv="mv -iv" +alias cp="cp -iv" +alias mbsync='mbsync -c "$XDG_CONFIG_HOME"/isync/mbsyncrc' +alias getmail='getmail --getmaildir "$XDG_CONFIG_HOME"/getmail --rcfile getmailrc' +alias m="mbsync csclub; mbsync uwaterloo; mbsync shemshak; mbsync gnub" +alias best="youtube-dl -f best" +alias e="$EDITOR" +alias se="SUDO_EDITOR=\"emacsclient\" sudo -e" + +aur() { + cd ~/usr/builds + [ -d ${1} ] || git clone https://aur.archlinux.org/${1}.git + cd ${1} +} + +function t { + cd $(mktemp -d /tmp/$1.XXXX) +} + +# separate alias definitions file, if exists +if [ -f ~/.bash_aliases ]; then + . ~/.bash_aliases +fi + +# enable programmable completion features (not needed if already +# enabled in /etc/bash.bashrc and if /etc/profile sources +# /etc/bash.bashrc). +if ! shopt -oq posix; then + if [ -f /usr/share/bash-completion/bash_completion ]; then + . /usr/share/bash-completion/bash_completion + elif [ -f /etc/bash_completion ]; then + . /etc/bash_completion + fi +fi + +# source Guix shell config dirs, for vte.sh and bash completions +GUIX_PROFILES=("${HOME}/.guix-profile" + "${HOME}/.config/guix/current") +for profile in "${GUIX_PROFILES[@]}"; do + for dir in "${profile}/etc/bash_completion.d" "${profile}/etc/profile.d"; do + if [ -d "${dir}" ]; then + for f in "${dir}"/*; do + . $f + done + fi + done +done +#+end_src + +*** profile +:PROPERTIES: +:header-args+: :tangle ~/.profile +:END: + +#+begin_src sh +# ~/.profile: executed by the command interpreter for login shells. +# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login +# exists. + +# source host-specific profile +if [ -f "$HOME/.config/profiles/$(hostname)" ]; then + . "$HOME/.config/profiles/$(hostname)" +fi + +export EDITOR="emacsclient -nw" +export VISUAL="emcl" + +PATH="$HOME/usr/local/bin:$HOME/.local/bin:$PATH" +PATH="$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH" +if [ -z "$IS_GUIX_SYSTEM" ]; then + PATH="$HOME/.config/guix/current/bin${PATH:+:}$PATH" + INFOPATH="$HOME/.config/guix/current/share/info${INFOPATH:+:}$INFOPATH" + export GUIX_LOCPATH="$HOME/.guix-profile/lib/locale" +fi +export PATH +export INFOPATH + +export MY_GUIX_MANIFESTS="$HOME/.config/guix/manifest" +export MY_GUIX_PROFILES="$HOME/.config/guix/profile" + +export XDG_CONFIG_HOME="$HOME/.config" +export XDG_DATA_HOME="$HOME/.local/share" + +if [ -f "$HOME/.config/user-dirs.dirs" ]; then + set -a + . "$HOME/.config/user-dirs.dirs" + set +a +fi + +export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc +export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc + +export MAILDIR="$HOME/mail" +export CVS_RSH="ssh" + +if [ -x "$(command -v go)" ]; then + export GOPATH="$HOME/src/go" + export PATH="$GOPATH/bin:$PATH" +fi + +# if running bash +if [ -n "$BASH_VERSION" ]; then + # include .bashrc if it exists + if [ -f "$HOME/.bashrc" ]; then + . "$HOME/.bashrc" + fi +fi + +if [ -z "$IS_GUIX_SYSTEM" ]; then + # if guix is installed + if [ -x "$(command -v guix)" ]; then + SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs" + if [ -d "$SSL_CERT_DIR" -o -h "$SSL_CERT_DIR" ]; then + export SSL_CERT_DIR + export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt" + else + printf "it seems you forgot to \`guix install nss-certs\'\n" + fi + GUIX_PROFILE="$HOME/.guix-profile" + . "$GUIX_PROFILE/etc/profile" + unset XDG_DATA_DIRS + fi +fi + +for p in $MY_GUIX_PROFILES/*; do + profile=$p/$(basename "$p") + if [ -f "$profile"/etc/profile ]; then + GUIX_PROFILE="$profile" + . "$GUIX_PROFILE"/etc/profile + fi + unset profile +done + +# start an ssh-agent (with guix's openssh) +if [ -z "$IS_GUIX_SYSTEM" ]; then + if ! pgrep -u "$USER" ssh-agent > /dev/null; then + ssh-agent > ~/.ssh-agent-thing + fi + if [[ ! "$SSH_AUTH_SOCK" ]]; then + eval "$(<~/.ssh-agent-thing)" + fi +fi + +# footenote: when on a foreign distro and using Xfce, don't forget to +# disable its auto-start of gpg- and ssh-agent, by issuing +# xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false +# xfconf-query -c xfce4-session -p /startup/gpg-agent/enabled -n -t bool -s false +# see https://docs.xfce.org/xfce/xfce4-session/advanced#ssh_and_gpg_agents +# also, MATE does something similar with gnome-keyring-daemon: +# http://william.shallum.net/random-notes/disabling-gnome-keyring-daemon-ssh-agent-on-mate-desktop +#+end_src + +*** per-host profiles + +Host-specific profiles, sourced from =~/.profile=. Each +=~/.config/profiles/HOST= file will be sourced on the machine with +=hostname= of =HOST=. + +**** chaman +:PROPERTIES: +:header-args+: :tangle ~/.config/profiles/chaman +:END: + +#+begin_src sh +export IS_GUIX_SYSTEM=true + +if [ -x "$(command -v xinput)" ]; then + xinput --set-prop "TPPS/2 IBM TrackPoint" 'libinput Accel Speed' -0.4 +fi + +setxkbmap \ + -layout us,ir \ + -option ctrl:nocaps \ + -option grp:shifts_toggle + +xmodmap -e "keysym Menu = Super_R" + +xsetroot -cursor_name left_ptr +xset r rate 200 45 +xset b off +#+end_src + +**** darrud +:PROPERTIES: +:header-args+: :tangle ~/.config/profiles/darrud +:END: + +#+begin_src sh +export INFOPATH="$HOME/usr/local/share/info${INFOPATH:+:}$INFOPATH" +#+end_src + +**** langa +:PROPERTIES: +:header-args+: :tangle ~/.config/profiles/langa +:END: + +#+begin_src sh +export XDG_DATA_DIRS="/usr/share/mate:/usr/local/share/:/usr/share/" #+end_src ** redshift @@ -1523,6 +2298,20 @@ adjustment-method=randr ;screen=1 #+end_src +** signature +:PROPERTIES: +:header-args+: :tangle ~/.signature +:END: + +My email signature. + +#+begin_src +Amin Bandali +Free Software activist | GNU maintainer & webmaster +GPG: BE62 7373 8E61 6D6D 1B3A 08E8 A21A 0202 4881 6103 +https://bandali.eu.org +#+end_src + ** systemd Keep boot messages on tty1 (see [[https://wiki.archlinux.org/index.php/getty#Have_boot_messages_stay_on_tty1][here]]) @@ -2254,58 +3043,583 @@ RESTORE_DEVICE_STATE_ON_STARTUP=1 ** X -*** xprofile +*** xinit :PROPERTIES: -:header-args+: :tangle ~/.xprofile +:header-args+: :tangle ~/.xinitrc :END: -=~/.xprofile= is similar in style to =~/.xinitrc=, but on the -contrary, it's automatically sourced by LightDM, my display manager of -choice. +#+begin_src sh +[ -f ~/.Xresources ] && xrdb -merge ~/.Xresources +#+end_src -#+begin_src sh :tangle no -xset -b # disable bell -xset r rate 200 45 # repeat delay (ms) and rate (repeats/sec) +*** X resources -# setxkbmap -option compose:ralt +#+begin_src conf-xdefaults :tangle (when (eq system-type 'gnu/linux) "~/.Xresources") +#include ".Xresources.d/fonts" +#include ".Xresources.d/emacs" +#include ".Xresources.d/rxvt-unicode" +#+end_src -setxkbmap -option ctrl:nocaps # turn capslock into control -setxkbmap -option altwin:swap_alt_win # swap alt and super +**** emacs +:PROPERTIES: +:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/emacs") +:END: -if [ $(hostname) = "plasma" ] -then - setxkbmap -option ctrl:rctrl_ralt # turn right control into right alt -fi +#+begin_src conf-xdefaults +Emacs.menuBar: off +Emacs.toolBar: off +Emacs.verticalScrollBars: off +Emacs.cursorBlink: off +Emacs.FontBackend: xft,x +! Emacs.font: Ubuntu Mono-12 +! Emacs.font: Triplicate T4C-11 +! Emacs.font: Ubuntu Mono-10.5 +! Emacs.font: Ubuntu Mono-12 +! Emacs.font: Iosevka-11 + +! Emacs.font: Fira Mono:size=15 +! Emacs.font: DejaVu Sans Mono:size=15 +! Emacs.font: Inconsolata:size=17 +! Emacs.font: Inconsolata:size=16 +! Emacs.font: Inconsolata LGC:size=14 +! Emacs.font: Source Code Pro Medium-10.5 +Emacs.font: Source Code Pro Medium:size=14 +! Emacs.font: Ubuntu Mono:size=16 +! Emacs.font: Iosevka:size=16 +#+end_src -if [ $(hostname) = "enigma" ] -then - xmodmap -e "keycode 135 = Alt_R" # remap menu key to alt +**** fonts +:PROPERTIES: +:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/fonts") +:END: + +#+begin_src conf-xdefaults +Xft.lcdfilter: lcddefault +Xft.antialias: true +Xft.autohint: 0 +Xft.hinting: true +Xft.hintstyle: hintslight +! Xft.hintstyle: hintfull +Xft.rgba: rgb +Xft.dpi: 96 +#+end_src + +**** rxvt-unicode +:PROPERTIES: +:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/rxvt-unicode") +:END: + +#+begin_src conf-xdefaults +! Font +URxvt.font: xft:source code pro:pixelsize=14:antialias=true:hinting=true, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true +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 +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 +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 + +URxvt.xftAntialias: true +URxvt.letterSpace: -1 + +!URxvt.depth: 0 +!URxvt.loginShell: true +!URxvt*buffered: false +URxvt.saveLines: 100000 +URxvt.internalBorder: 3 +URxvt.lineSpace: 0 +URxvt.scrollBar: false +URxvt.scrollStyle: rxvt +URxvt*scrollTtyOutput: false +URxvt*scrollWithBuffer: true +URxvt*scrollTtyKeypress: true +URxvt.keysym.Shift-Up: command:\033]720;1\007 +URxvt.keysym.Shift-Down: command:\033]721;1\007 + +URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select +URxvt.url-select.launcher: firefox +URxvt.url-select.underline: true +URxvt.keysym.M-u: perl:url-select:select_next +URxvt.keysym.M-Escape: perl:keyboard-select:activate +URxvt.keysym.M-s: perl:keyboard-select:search +URxvt.url-launcher: /usr/bin/abrowser +URxvt.matcher.button: 1 +! URxvt.iso14755: false +! URxvt.iso14755_53: false +! URxvt.keysym.M-c: perl:clipboard:copy +! URxvt.keysym.M-v: perl:clipboard:paste +URxvt.keysym.M-c: eval:selection_to_clipboard +URxvt.keysym.M-v: eval:paste_clipboard +URxvt.keysym.C-A-V: perl:clipboard:paste_escaped +! URxvt.keysym.Shift-Control-C: eval:selection_to_clipboard +! URxvt.keysym.Shift-Control-V: eval:paste_clipboard +URxvt.keysym.C-Up: font-size:increase +URxvt.keysym.C-Down: font-size:decrease +URxvt.keysym.C-S-Up: font-size:incglobal +URxvt.keysym.C-S-Down: font-size:decglobal +URxvt.keysym.C-equal: font-size:reset +!URxvt.keysym.C-question: font-size:show + +!URxvt.iconFile: /usr/share/icons/elementary-xfce/apps/48/terminal.png + +!urxvt*foreground: white +!urxvt*background: black + +!*color0: #2E3436 +!*color1: #a40000 +!*color2: #4E9A06 +!*color3: #C4A000 +!*color4: #3465A4 +!*color5: #75507B +!*color6: #ce5c00 +!*color7: #babdb9 +!*color8: #555753 +!*color9: #EF2929 +!*color10: #8AE234 +!*color11: #FCE94F +!*color12: #729FCF +!*color13: #AD7FA8 +!*color14: #fcaf3e +!*color15: #EEEEEC + +!URxvt.foreground: #C8C8C8 +!URxvt.background: #FFFFFF + +!! black +!*color0: #2E3436 +!*color8: #555753 +!! red +!*color1: #a40000 +!*color9: #EF2929 +!! green +!*color2: #4E9A06 +!*color10: #8AE234 +!! yellow +!*color3: #C4A000 +!*color11: #FCE94F +!! blue +!*color4: #3465A4 +!*color12: #729FCF +!! purple +!*color5: #75507B +!*color13: #AD7FA8 +!! orange (replaces cyan) +!*color6: #ce5c00 +!*color14: #fcaf3e +!! white +!*color7: #babdb9 +!*color15: #EEEEEC + + +! ! Solarized +! ! Base16 Solarized Light +! ! Scheme: Ethan Schoonover (http://ethanschoonover.com/solarized) + +! #define base00 #fdf6e3 +! #define base01 #eee8d5 +! #define base02 #93a1a1 +! #define base03 #839496 +! #define base04 #657b83 +! #define base05 #586e75 +! #define base06 #073642 +! #define base07 #002b36 +! #define base08 #dc322f +! #define base09 #cb4b16 +! #define base0A #b58900 +! #define base0B #859900 +! #define base0C #2aa198 +! #define base0D #268bd2 +! #define base0E #6c71c4 +! #define base0F #d33682 + +! *foreground: base05 +! #ifdef background_opacity +! *background: [background_opacity]base00 +! #else +! *background: base00 +! #endif +! *cursorColor: base05 + +! *color0: base00 +! *color1: base08 +! *color2: base0B +! *color3: base0A +! *color4: base0D +! *color5: base0E +! *color6: base0C +! *color7: base05 + +! *color8: base03 +! *color9: base08 +! *color10: base0B +! *color11: base0A +! *color12: base0D +! *color13: base0E +! *color14: base0C +! *color15: base07 + +! ! Note: colors beyond 15 might not be loaded (e.g., xterm, urxvt), +! ! use 'shell' template to set these if necessary +! *color16: base09 +! *color17: base0F +! *color18: base01 +! *color19: base02 +! *color20: base04 +! *color21: base06 + + +! Tango colour theme for rxvt-unicode +URxvt.background: #FFFFFF +URxvt.foreground: #000000 + +! Black +URxvt.color0: #2E3436 +URxvt.color8: #757773 + +! Red +URxvt.color1: #CC0000 +URxvt.color9: #EF2929 + +! Green +URxvt.color2: #4E9A06 +URxvt.color10: #8AE234 + +! Yellow +URxvt.color3: #C4A000 +URxvt.color11: #FCE94F + +! Blue +URxvt.color4: #3465A4 +URxvt.color12: #729FCF + +! Magenta +URxvt.color5: #75507B +URxvt.color13: #AD7FA8 + +!! Cyan +!URxvt.color6: #06989A +!URxvt.color14: #34E2E2 +! orange (replaces cyan) +,,*color6: #ce5c00 +,,*color14: #fcaf3e + +! White +URxvt.color7: #D3D7CF +URxvt.color15: #EEEEEC +#+end_src + +*** ~/.xsession +:PROPERTIES: +:header-args+: :tangle ~/.xsession :tangle-mode (identity #o755) +:END: + +For custom session on Debian. See https://wiki.debian.org/Xsession. + +#+begin_src sh +if [ -f "$HOME/.xinitrc" ]; then + . "$HOME/.xinitrc" fi -light -Scrs "intel_backlight" 2 +[ -f "/usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd" ] && /usr/lib/x86_64-linux-gnu/xfce4/notifyd/xfce4-notifyd & +[ -x "$(command -v light-locker)" ] && light-locker --lock-on-suspend & +[ -x "$(command -v pasystray)" ] && pasystray -a & +[ -x "$(command -v nm-applet)" ] && nm-applet & +[ -x "$(command -v compton)" ] && compton & +[ -x "$(command -v dunst)" ] && dunst & +[ -x "$(command -v emacs)" ] && exec ssh-agent exwm -ib 0 +#+end_src + +*** ~/.xsessionrc +:PROPERTIES: +:header-args+: :tangle ~/.xsessionrc +:END: + +#+begin_src sh +if [ -f "$HOME/.profile" ]; then . "$HOME/.profile"; fi +#+end_src + +** XDG +:PROPERTIES: +:header-args+: :tangle ~/.config/user-dirs.dirs +:END: -source $HOME/.zprofile +#+begin_src conf +XDG_DESKTOP_DIR="$HOME/Desktop" +XDG_DOCUMENTS_DIR="$HOME/usr/doc" +XDG_DOWNLOAD_DIR="$HOME/usr/dl" +XDG_MUSIC_DIR="$HOME/usr/music" +XDG_PICTURES_DIR="$HOME/usr/pic" +XDG_PUBLICSHARE_DIR="$HOME/usr/pub" +XDG_TEMPLATES_DIR="$HOME/usr/temp" +XDG_VIDEOS_DIR="$HOME/usr/vid" +#+end_src -export _JAVA_AWT_WM_NONREPARENTING=1 -export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true' +** zathura +:PROPERTIES: +:header-args+: :tangle ~/.config/zathura/zathurarc +:END: -if [ $(hostname) = "plasma" ] -then - unlock-def-gk.py & +#+begin_src conf +set smooth-scroll true +set selection-clipboard clipboard +set zoom-step 05 +set default-bg "#272727" +set statusbar-bg "#272727" +set inputbar-bg "#373737" +set window-title-basename true +set statusbar-home-tilde true + +map scroll down +map scroll up + +map H jumplist backward +map L jumplist forward + +map [normal] i toggle_index +map [index] i toggle_index +map [index] q toggle_index +#+end_src + +* Scripts + +This section contains various useful scripts including ones used by +the programs above. For instance, =toggle-tablet= for switching to +and from tablet mode on my X220T, =toggle-presentation-mode= for +toggling Xfce's presentation mode which keeps the screen awake, and +=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 +exact brightness value. + +** battery-percentage-time +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh" +:END: + +#+begin_src sh :tangle no +dbus_send() { + label=$1 + dbus-send --print-reply=literal --system \ + --dest=org.freedesktop.UPower \ + /org/freedesktop/UPower/devices/battery_BAT0 \ + org.freedesktop.DBus.Properties.Get \ + string:org.freedesktop.UPower.Device \ + string:"${label}" | awk '{print $3}' +} + +perc=$(dbus_send 'Percentage') +state=$(dbus_send 'State') + +if [ "$state" -eq 2 ]; then # Discharging + secs=$(dbus_send 'TimeToEmpty') +elif [ "$state" -eq 1 ]; then # Charging + secs=$(dbus_send 'TimeToFull') fi -bspwm & +printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60)) +#+end_src + +** emcl +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/emcl :shebang "#!/bin/sh" +:END: + +#+begin_src sh +exec emacsclient --alternate-editor="" -c "$@" +#+end_src + +** my-i3status +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/emcl :shebang "#!/usr/bin/env python2" +:END: + +#+begin_src python +# -*- coding: utf-8 -*- + +# This script is a simple wrapper which prefixes each i3status line with custom +# information. It is based on: +# https://github.com/i3/i3status/blob/master/contrib/wrapper.py +# +# In ~/.i3status.conf, add the following line: +# output_format = "i3bar" +# in the 'general' section. +# Then, in ~/.config/i3/config or ~/.config/sway/config add: +# status_command i3status | my-i3status.py +# in the 'bar' section. Make sure my-i3status.py is in $PATH. +# +# © 2012 Valentin Haenel +# © 2018 Amin Bandali +# +# This program is free software. It comes without any warranty, to the extent +# permitted by applicable law. You can redistribute it and/or modify it under +# the terms of the Do What The Fuck You Want To Public License (WTFPL), Version +# 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more +# details. + +import sys +import json +import os + +def get_nosleep(): + """ Return true if ~/.nosleep exists. """ + return os.path.isfile(os.path.expanduser("~/.nosleep")) + +def print_line(message): + """ Non-buffered printing to stdout. """ + sys.stdout.write(message + '\n') + sys.stdout.flush() + +def read_line(): + """ Interrupted respecting reader for stdin. """ + # try reading a line, removing any extra whitespace + try: + line = sys.stdin.readline().strip() + # i3status sends EOF, or an empty line + if not line: + sys.exit(3) + return line + # exit on ctrl-c + except KeyboardInterrupt: + sys.exit() + +if __name__ == '__main__': + # Skip the first line which contains the version header. + print_line(read_line()) + + # The second line contains the start of the infinite array. + print_line(read_line()) + + while True: + line, prefix = read_line(), '' + # ignore comma at start of lines + if line.startswith(','): + line, prefix = line[1:], ',' + + if get_nosleep(): + j = json.loads(line) + # insert information into the start of the json, but could be anywhere + j.insert(0, {'full_text' : '•', 'name' : 'nosleep'}) + # and echo back new encoded json + print_line(prefix+json.dumps(j)) + else: + print_line(prefix+line) #+end_src -*** xkb us_ab keyboard layout +** rofi-light +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/sh" +:END: + +#+begin_src sh +cur=$(light -G) +val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12) +[ -n "$val" ] && light -S "$val" +#+end_src -#+begin_src conf :tangle "/sudo::/usr/share/X11/xkb/symbols/us_ab" :comments none -default partial alphanumeric_keys -xkb_symbols "us_ab" { - include "us(basic)" - name[Group1]= "English (US)(aminb)"; +** rofi-remmina +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/rofi-remmina :shebang "#!/usr/bin/env python2" +:END: - key { [ Alt_R ] }; -}; +#+begin_src python +import ConfigParser +import os +from subprocess import Popen, PIPE + +remmina_dir = os.path.expanduser("~/.local/share/remmina") + +fdict = dict() + +for f in os.listdir(remmina_dir): + fp = os.path.join(remmina_dir, f) + c = ConfigParser.ConfigParser() + c.read(fp) + n = c.get('remmina', 'name') + fdict[n] = fp + +lines = max(min(15, len(fdict)), 1); +width = len(max(fdict.keys(), key=len)) +rofi = Popen(["rofi", "-i", "-dmenu", \ + "-l", str(lines), "-width", str(width), \ + "-p", "connection"], stdout=PIPE, stdin=PIPE) +selected = rofi.communicate("\n" \ + .join(fdict.keys()) \ + .encode("utf-8"))[0] \ + .decode("utf-8") \ + .strip() +rofi.wait() + +r = Popen(["remmina", "-c", fdict[selected]]) +r.wait() #+end_src +** toggle-presentation-mode +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/sh" +:END: + +#+begin_src sh +xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T +#+end_src + +** toggle-tablet +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/sh" +:END: + +#+begin_src sh +# This script toggles between a 'normal' mode and a 'tablet' mode, doing +# a few things: + +# - rotates the screen using =xrandr=, so that rotating the physical +# display of my X220t would have the laptop's battery on the right +# hand side, +# - enables touch screen, +# - properly rotates the stylus pen and touch screen pointers, and +# - toggles between RGB and Vertical BGR sub-pixel order. + +case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in + 0) # Screen is not rotated, we should rotate it right (90°) + xrandr -o 3 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1 + xfconf-query -c xsettings -p /Xft/RGBA -s vbgr + ;; + 1) # Currently top is rotated right, we should set it normal (0°) + xrandr -o 0 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0 + xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0 + xfconf-query -c xsettings -p /Xft/RGBA -s rgb + ;; + ,*) + echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2 + exit 1 + ;; +esac +#+end_src + +** volume-info +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh" +:END: + +#+begin_src sh +cur_vol=$(pamixer --get-volume) + +if [ $(pamixer --get-mute) = true ]; then + printf 'mt \n' "$cur_vol" +else + printf '%02d \n' "$cur_vol" +fi +#+end_src + +** zathura-sync +:PROPERTIES: +:header-args+: :tangle ~/.local/bin/zathura-sync :shebang "#!/bin/sh" +:END: + +#+begin_src sh +pos="$1" +pdffile="$2" +zathura --synctex-forward "$pos" "$pdffile" || \ + ( + zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" & + sleep 1; zathura --synctex-forward "$pos" "$pdffile" ) +#+end_src