[emacs] switch back to evil
[~bandali/configs] / rc.org
... / ...
CommitLineData
1#+title: rc.org
2#+property: header-args :comments link :mkdirp yes :results silent
3
4* About
5
6This org file contains the configuration files of pretty much every
7program I use. The files are tangled (i.e. exported, or derived) from
8this file using =org-babel=.
9
10Note: This file is best viewed inside Emacs with org mode.
11
12* Configs
13
14This section contains the configuration files (dotfiles) of various
15programs I use.
16
17** bspwm
18
19*** bspwmrc
20:PROPERTIES:
21:header-args+: :tangle ~/.config/bspwm/bspwmrc :shebang "#!/bin/sh"
22:END:
23
24#+begin_src sh :tangle no
25sxhkd &
26sh ~/.fehbg &
27xfce4-panel -d &
28compton &
29sleep 0.5 && pasystray --notify=all &
30
31bspc monitor -d I II III IV V VI VII VIII IX X
32#bspc monitor eDP-1 -d I II III IV V
33#bspc monitor HDMI-1 -d VI VII VIII IX X
34
35#bspc config border_width 2
36#bspc config window_gap 8
37bspc config window_gap 0
38
39bspc config bottom_padding 26
40
41bspc config split_ratio 0.52
42bspc config borderless_monocle true
43bspc config gapless_monocle true
44bspc config click_to_focus button1
45bspc config directional_focus_tightness low
46
47#bspc rule -a Firefox desktop='^1' follow=on
48bspc rule -a Nightly desktop='^1' follow=on
49bspc rule -a Emacs desktop='^2' state=tiled follow=on
50#bspc rule -a Chromium desktop='^4' follow=on
51bspc rule -a URxvt state=floating
52bspc rule -a URxvt:tiled state=tiled
53bspc rule -a Connman-gtk state=floating
54bspc rule -a Xfce4-panel state=floating
55bspc rule -a TelegramDesktop state=floating
56bspc rule -a Ec state=floating
57bspc rule -a Pavucontrol state=floating
58bspc rule -a Eog state=floating
59bspc rule -a Seahorse state=floating
60bspc rule -a mpv state=floating
61bspc rule -a Evince state=floating
62bspc rule -a Meld state=floating
63bspc rule -a Autokey-gtk state=floating
64bspc rule -a Mousepad state=floating
65bspc rule -a Wrapper-1.0 state=floating
66bspc rule -a File-roller state=floating
67bspc rule -a Gnome-disks state=floating
68bspc rule -a Termite state=floating
69bspc rule -a Termite:tiled state=tiled
70bspc rule -a Thunderbird:Calendar state=floating
71bspc rule -a Audacity state=floating
72bspc rule -a Proof state=floating # pvs x-show-proof
73bspc rule -a Nm-connection-editor state=floating
74bspc rule -a Wire state=floating
75bspc rule -a discord state=floating
76bspc rule -a X2goclient state=floating
77bspc rule -a SimpleScreenRecorder state=floating
78bspc rule -a Gimp state=floating
79bspc rule -a Wrapper-2.0 state=floating
80bspc rule -a Zathura state=tiled
81#+end_src
82
83*** sxhkdrc
84:PROPERTIES:
85:header-args+: :tangle ~/.config/sxhkd/sxhkdrc
86:END:
87
88#+begin_src conf :tangle no
89#
90# wm independent hotkeys
91#
92
93# terminal emulator
94super + {_,shift} + Return
95 urxvt{_, -name tiled}
96
97#super + {_,shift} + Return
98# termite{_, --name=tiled}
99
100# program launcher
101super + space
102 rofi -show run -display-run '> ' -display-window ' 🗔 '
103
104super + alt + space
105 xfce4-popup-whiskermenu
106
107# window finder
108super + backslash
109 rofi -show window -display-run '> ' -display-window ' 🗔 '
110
111# password manager
112alt + space
113 rofi-pass
114
115# firefox
116#super + r
117# firefox
118
119# chromium
120#super + c
121# chromium -incognito
122
123# emacs
124super + e
125 emacs
126
127# make sxhkd reload its configuration files:
128super + Escape
129 pkill -USR1 -x sxhkd
130
131# volume {up,down}
132XF86Audio{Raise,Lower}Volume
133 pamixer --allow-boost --{in,de}crease 5
134
135# mute
136XF86AudioMute
137 pamixer --toggle-mute
138
139XF86AudioMicMute
140 pactl set-source-mute 1 toggle
141
142# playback control
143XF86Audio{Play,Prev,Next}
144 mpc {toggle,prev,next}
145
146# lock the screen
147super + shift + q
148 light-locker-command -l
149
150# Toggle keyboard layout
151super + F7
152 toggle-layout
153
154# Toggle Xfce presentation mode
155XF86LaunchB
156 toggle-presentation-mode
157
158# monitor brightness
159XF86MonBrightness{Up,Down}
160 light -{A,U} 5
161
162super + apostrophe
163 rofi-light
164
165# keyboard brightness
166#XF86KbdBrightness{Up,Down}
167# kbdlight {up,down}
168
169XF86RotateWindows
170 toggle-tablet
171
172#
173# bspwm hotkeys
174#
175
176# quit bspwm normally
177super + alt + Escape
178 bspc quit
179
180# close and kill
181super + {w,q}
182 bspc node -{c,k}
183
184# alternate between the tiled and monocle layout
185super + m
186 bspc desktop -l next
187
188# send the newest marked node to the newest preselected node
189super + y
190 bspc node newest.marked.local -n newest.!automatic.local
191
192# swap the current node and the biggest node
193super + g
194 bspc node -s biggest
195
196#
197# state/flags
198#
199
200# set the window state
201super + {t,shift + t,s,f}
202 bspc node -t {tiled,pseudo_tiled,floating,fullscreen}
203
204# set the node flags
205super + ctrl + {m,x,y,z}
206 bspc node -g {marked,locked,sticky,private}
207
208#
209# focus/swap
210#
211
212# focus the node in the given direction
213super + {_,shift + }{h,j,k,l}
214 bspc node -{f,s} {west,south,north,east}
215
216# focus the node for the given path jump
217super + {p,b,comma,period}
218 bspc node -f @{parent,brother,first,second}
219
220# focus the next/previous node in the current desktop
221super + {_,shift + }c
222 bspc node -f {next,prev}.local
223
224# focus the next/previous desktop in the current monitor
225super + bracket{left,right}
226 bspc desktop -f {prev,next}.local
227
228# send to next/prev desktop
229super + shift + bracket{left,right}
230 bspc node -d {prev,next} --follow
231
232# focus the last node/desktop
233super + {grave,Tab}
234 bspc {node,desktop} -f last
235
236# focus the older or newer node in the focus history
237super + {o,i}
238 bspc wm -h off; \
239 bspc node {older,newer} -f; \
240 bspc wm -h on
241
242# focus or send to the given desktop
243super + {_,shift + }{1-9,0}
244 bspc {desktop -f,node -d} '^{1-9,10}'
245
246#
247# preselect
248#
249
250# preselect the direction
251super + ctrl + {h,j,k,l}
252 bspc node -p {west,south,north,east}
253
254# preselect the ratio
255super + ctrl + {1-9}
256 bspc node -o 0.{1-9}
257
258# cancel the preselection for the focused node
259super + ctrl + space
260 bspc node -p cancel
261
262# cancel the preselection for the focused desktop
263super + ctrl + shift + space
264 bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel
265
266#
267# move/resize
268#
269
270# expand a window by moving one of its side outward
271super + alt + {h,j,k,l}
272 bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}
273
274# contract a window by moving one of its side inward
275super + alt + shift + {h,j,k,l}
276 bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}
277
278# move a floating window
279super + {Left,Down,Up,Right}
280 bspc node -v {-20 0,0 20,0 -20,20 0}
281
282#alt + bracket{left,right}
283# xdotool key --clearmodifiers ctrl+Page_{Up,Down}
284#+end_src
285
286** compton
287:PROPERTIES:
288:header-args+: :tangle ~/.config/compton.conf
289:END:
290
291#+begin_src conf :tangle no
292# Shadow
293shadow = false; # Enabled client-side shadows on windows.
294no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
295no-dnd-shadow = true; # Don't draw shadows on DND windows.
296clear-shadow = true; # Zero the part of the shadow's mask behind the
297 # window. Fix some weirdness with ARGB windows.
298shadow-radius = 5; # The blur radius for shadows. (default 12)
299shadow-offset-x = -5; # The left offset for shadows. (default -15)
300shadow-offset-y = -5; # The top offset for shadows. (default -15)
301# shadow-opacity = 0.7; # The translucency for shadows. (default .75)
302# shadow-red = 0.0; # Red color value of shadow. (0.0 - 1.0, defaults to 0)
303# shadow-green = 0.0; # Green color value of shadow. (0.0 - 1.0, defaults to 0)
304# shadow-blue = 0.0; # Blue color value of shadow. (0.0 - 1.0, defaults to 0)
305shadow-exclude = [ "n:e:Notification", "class_g = 'Chromium'", "class_g = 'Dmenu'", "class_g = 'Firefox' && argb" ]; # Exclude conditions for shadows.
306# shadow-exclude = "n:e:Notification";
307#shadow-exclude = [ "_GTK_FRAME_EXTENTS@:c" ] # Fix dual shadow on some gtk3 powered applications
308shadow-ignore-shaped = true; # Avoid drawing shadow on all shaped windows
309 # (see also: --detect-rounded-corners)
310
311# Opacity
312menu-opacity = 1.0; # The opacity for menus. (default 1.0)
313#inactive-opacity = 0.9; # Default opacity of inactive windows. (0.0 - 1.0)
314# active-opacity = 0.8; # Default opacity for active windows. (0.0 - 1.0)
315frame-opacity = 1.0; # Opacity of window titlebars and borders. (0.1 - 1.0)
316# inactive-opacity-override = true; # Let inactive opacity set by 'inactive-opacity' overrides
317 # value of _NET_WM_OPACITY. Bad choice.
318alpha-step = 0.06; # XRender backend: Step size for alpha pictures. Increasing
319 # it may result in less X resource usage,
320 # Yet fading may look bad.
321#inactive-dim = 0.5; # Dim inactive windows. (0.0 - 1.0)
322#inactive-dim-fixed = true; # Do not let dimness adjust based on window opacity.
323# blur-background = true; # Blur background of transparent windows.
324 # Bad performance with X Render backend.
325 # GLX backend is preferred.
326# blur-background-frame = true; # Blur background of opaque windows with transparent
327 # frames as well.
328blur-background-fixed = true; # Do not let blur radius adjust based on window opacity.
329blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];
330 # Exclude conditions for background blur.
331
332# Fading
333fading = false; # Fade windows during opacity changes.
334fade-delta = 3; # The time between steps in a fade in milliseconds. (default 10).
335fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
336fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
337# no-fading-openclose = true; # Avoid fade windows in/out when opening/closing.
338fade-exclude = [ ]; # Exclude conditions for fading.
339
340# Other
341backend = "glx" # Backend to use: "xrender" or "glx". GLX backend is typically
342 # much faster but depends on a sane driver.
343mark-wmwin-focused = true; # Try to detect WM windows and mark them as active.
344mark-ovredir-focused = true; # Mark all non-WM but override-redirect windows active (e.g. menus).
345use-ewmh-active-win = true; # Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused
346 # instead of using FocusIn/Out events. Usually more reliable but
347 # depends on a EWMH-compliant WM.
348detect-rounded-corners = false; # Detect rounded corners and treat them as rectangular when --shadow-ignore- shaped is on.
349detect-client-opacity = true; # Detect _NET_WM_OPACITY on client windows, useful for window
350 # managers not passing _NET_WM_OPACITY of client windows to frame
351 # windows.
352refresh-rate = 0; # For --sw-opti: Specify refresh rate of the screen. 0 for auto.
353vsync = "drm"; # "none", "drm", "opengl", "opengl-oml", "opengl-swc", "opengl-mswc"
354 # See man page for more details.
355dbe = false; # Enable DBE painting mode. Rarely needed.
356paint-on-overlay = true; # Painting on X Composite overlay window. Recommended.
357sw-opti = false; # Limit compton to repaint at most once every 1 / refresh_rate.
358 # Incompatible with certain VSync methods.
359unredir-if-possible = false; # Unredirect all windows if a full-screen opaque window is
360 # detected, to maximize performance for full-screen windows.
361focus-exclude = [ ]; # A list of conditions of windows that should always be considered
362 # focused.
363detect-transient = true; # Use WM_TRANSIENT_FOR to group windows, and consider windows in
364 # the same group focused at the same time.
365detect-client-leader = true; # Use WM_CLIENT_LEADER to group windows.
366invert-color-include = [ ]; # Conditions for windows to be painted with inverted color.
367
368# GLX backend # GLX backend fine-tune options. See man page for more info.
369glx-no-stencil = true; # Recommended.
370glx-copy-from-front = false; # Useful with --glx-swap-method,
371# glx-use-copysubbuffermesa = true; # Recommended if it works. Breaks VSync.
372# glx-no-rebind-pixmap = true; # Recommended if it works.
373glx-no-rebind-pixmap = true; # Recommended if it works.
374#glx-swap-method = "4"; # See man page.
375glx-swap-method = "4"; # See man page.
376
377# Window type settings
378wintypes:
379{
380 tooltip = { fade = true; shadow = false; opacity = 1; focus = true; };
381 menu = { shadow = false; };
382 dropdown_menu = { shadow = false; };
383 popup_menu = { shadow = false; };
384 utility = { shadow = false; };
385 # fade: Fade the particular type of windows.
386 # shadow: Give those windows shadow
387 # opacity: Default opacity for the type of windows.
388 # focus: Whether to always consider windows of this type focused.
389};
390#+end_src
391
392** Dunst
393:PROPERTIES:
394:header-args+: :tangle ~/.config/dunst/dunstrc
395:END:
396
397#+begin_src conf
398[global]
399#font = Ubuntu Mono 10.5
400font = Inconsolata 11
401
402# Path to default icons.
403icon_folders = /usr/share/icons/Moka/16x16/status/:/usr/share/icons/Moka/16x16/devices/:/usr/share/icons/Faba-Mono/16x16/status/:/usr/share/icons/Faba-Mono/16x16/devices/:/usr/share/icons/Moka/16x16/actions/:/usr/share/icons/Moka/16x16/categories/:/usr/share/icons/Moka/16x16/mimetypes/:/usr/share/icons/Moka/16x16/apps/:/usr/share/icons/Moka/16x16/places/:/usr/share/icons/Paper/16x16/status/
404
405icon_position = left
406# <b>bold</b>
407# <i>italic</i>
408# <s>strikethrough<s/>
409# <u>underline</u>
410markup = full
411# The format of the message. Possible variables are:
412# %a appname
413# %s summary
414# %b body
415# %i iconname (including its path)
416# %I iconname (without its path)
417# %p progress value if set ([ 0%] to [100%]) or nothing
418# Markup is allowed
419format = "<b>%s</b>\n%b"
420# Sort messages by urgency
421sort = yes
422# Show how many messages are currently hidden (because of geometry)
423indicate_hiddenl= no
424# Alignment of message text.
425# Possible values are "left", "center" and "right"
426alignment = center
427# The frequency with wich text that is longer than the notification
428# window allows bounces back and forth.
429# This option conflicts with 'word_wrap'.
430# Set to 0 to disable
431bounce_freq = 3
432# show age of message if message is older than show_age_threshold seconds.
433# set to -1 to disable
434show_age_threshold = -1
435# split notifications into multiple lines if they don't fit into geometry
436word_wrap = yes
437# ignore newlines '\n' in notifications
438ignore_newline = no
439# The geometry of the message window.
440# geometry [{width}]x{height}][+/-{x}+/-{y}]
441# The height is measured in number of notifications everything else in pixels. If the width
442# is omitted but the height is given ("-geometry x2"), the message window
443# expands over the whole screen (dmenu-like). If width is 0,
444# the window expands to the longest message displayed.
445# A positive x is measured from the left, a negative from the
446# right side of the screen. Y is measured from the top and down respectevly.
447# The width can be negative. In this case the actual width is the
448# screen width minus the width defined in within the geometry option.
449#geometry = "410x12-12+12"
450#geometry = "0x0-30-30"
451geometry = "260x12-30-30"
452# The transparency of the window. range: [0; 100]
453# This option will only work if a compositing windowmanager is present (e.g. xcompmgr, compiz, etc..)
454transparency = 0
455# Don't remove messages, if the user is idle (no mouse or keyboard input)
456# for longer than idle_threshold seconds.
457# Set to 0 to disable.
458idle_threshold = 120
459# Which monitor should the notifications be displayed on.
460monitor = 0
461# Display notification on focused monitor. Possible modes are:
462# mouse: follow mouse pointer
463# keyboard: follow window with keyboard focus
464# none: don't follow anything
465#
466# "keyboard" needs a windowmanager that exports the _NET_ACTIVE_WINDOW property.
467# This should be the case for almost all modern windowmanagers.
468#
469# If this option is set to mouse or keyboard, the monitor option will be
470# ignored.
471follow = keyboard
472# should a notification popped up from history be sticky or
473# timeout as if it would normally do.
474sticky_history = yes
475# The height of a single line. If the height is smaller than the font height,
476# it will get raised to the font height.
477# This adds empty space above and under the text.
478line_height = 0
479
480show_indicators = yes
481
482# Draw a line of 'separatpr_height' pixel height between two notifications.
483# Set to 0 to disable
484separator_height = 3
485# padding between text and separator
486padding = 8
487# horizontal padding
488horizontal_padding = 8
489# Define a color for the separator.
490# possible values are:
491# * auto: dunst tries to find a color fitting to the background
492# * foreground: use the same color as the foreground
493# * frame: use the same color as the frame.
494# * anything else will be interpreted as a X color
495separator_color = foreground
496# print a notification on startup
497# This is mainly for error detection, since dbus (re-)starts dunst
498# automatically after a crash.
499startup_notification = false
500# dmenu path
501#dmenu = /usr/bin/dmenu -p dunst:
502dmenu = /usr/bin/rofi -dmenu -p dunst:
503# browser for opening urls in context menu
504browser = /usr/bin/firefox -new-tab
505[frame]
506width = 0
507color = "#377222"
508[shortcuts]
509# shortcuts are specified as [modifier+][modifier+]...key
510# available modifiers are 'ctrl', 'mod1' (the alt-key), 'mod2', 'mod3'
511# and 'mod4' (windows-key)
512# xev might be helpful to find names for keys
513# close notification
514close = ctrl+space
515# close all notifications
516close_all = ctrl+shift+space
517# redisplay last message(s)
518# On the US keyboard layout 'grave' is normally above TAB and left of '1'.
519history = ctrl+shift+h
520# context menu
521context = ctrl+shift+period
522[urgency_low]
523# IMPORTANT: colors have to be defined in quotation marks.
524# Otherwise the '#' and following would be interpreted as a comment.
525background = "#1d2a30"
526foreground = "#71c2af"
527timeout = 3
528[urgency_normal]
529background = "#1d2a30"
530foreground = "#71c2af"
531timeout = 0
532[urgency_critical]
533background = "#1d2a30"
534foreground = "#ff9982"
535timeout = 0
536
537# Every section that isn't one of the above is interpreted as a rules
538# to override settings for certain messages.
539# Messages can be matched by 'appname', 'summary', 'body' or 'icon'
540# and you can override the 'timeout', 'urgency', 'foreground', 'background'
541# and 'format'.
542# Shell-like globbing will get expanded.
543#
544# SCRIPTING
545# you can specify a script that gets run when the rule matches by setting
546# the 'script' option.
547# The script will be called as follows:
548# script appname summary body icon urgency
549# where urgency can be "LOW", "NORMAL" or "CRITICAL".
550#
551# NOTE: if you don't want a notification to be displayed, set the format to ""
552# NOTE: It might be helpful to run dunst -print in a terminal in order to find
553# fitting options for rules.
554#[espeak]
555# summary = "*"
556# script = dunst_espeak.sh
557#[script-test]
558# summary = "*script*"
559# script = dunst_test.sh
560#[ignore]
561## This notification will not be displayed
562# summary = "foobar"
563# format = ""
564#[signed_on]
565# appname = Pidgin
566# summary = "*signed on*"
567# urgency = low
568#
569#[signed_off]
570# appname = Pidgin
571# summary = *signed off*
572# urgency = low
573#
574#[says]
575# appname = Pidgin
576# summary = *says*
577# urgency = critical
578#
579#[twitter]
580# appname = Pidgin
581# summary = *twitter.com*
582# urgency = normal
583#
584[xfpm-backlight]
585 summary = *Brightness*
586 urgency = low
587#+end_src
588
589** Fontconfig
590:PROPERTIES:
591:header-args+: :tangle ~/.config/fontconfig/fonts.conf :comments none
592:END:
593
594#+begin_src xml
595<?xml version="1.0"?>
596<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
597<fontconfig>
598 <match target="font">
599 <edit mode="assign" name="rgba">
600 <const>rgb</const>
601 </edit>
602 </match>
603 <match target="font">
604 <edit mode="assign" name="hinting">
605 <bool>true</bool>
606 </edit>
607 </match>
608 <match target="font">
609 <edit mode="assign" name="hintstyle">
610 <const>hintslight</const>
611 </edit>
612 </match>
613 <match target="font">
614 <edit mode="assign" name="antialias">
615 <bool>true</bool>
616 </edit>
617 </match>
618 <match target="font">
619 <edit mode="assign" name="lcdfilter">
620 <const>lcddefault</const>
621 </edit>
622 </match>
623 <dir>~/.fonts</dir>
624
625 <!-- Use Liberation Sans for Helvetica (instead of Nimbus Sans) -->
626 <alias binding="same">
627 <family>Helvetica</family>
628 <accept>
629 <family>Liberation Sans</family>
630 </accept>
631</alias>
632</fontconfig>
633#+end_src
634
635** getmail
636
637*** getmailrc
638:PROPERTIES:
639:header-args+: :tangle ~/.getmail/getmailrc
640:END:
641
642#+begin_src conf
643[retriever]
644type = SimplePOP3SSLRetriever
645server = fencepost.gnu.org
646username = aminb
647password_command = ("gpg2", "--no-tty", "-q", "-d", "/home/amin/.passwd/gnu.gpg")
648port = 995
649use_apop = True
650
651[destination]
652type = Maildir
653path = ~/mail/gnu/Inbox/
654
655[options]
656delete = True
657#+end_src
658
659*** getmail.service
660:PROPERTIES:
661:header-args+: :tangle ~/.config/systemd/user/getmail.service
662:END:
663
664#+begin_src conf :tangle no
665[Unit]
666Description=getmail service
667
668[Service]
669Type=oneshot
670ExecStart=/usr/bin/getmail
671StandardOutput=syslog
672StandardError=syslog
673#+end_src
674
675*** getmail.timer
676:PROPERTIES:
677:header-args+: :tangle ~/.config/systemd/user/getmail.timer
678:END:
679
680#+begin_src conf :tangle no
681[Unit]
682Description=getmail timer
683
684[Timer]
685OnCalendar=*:0/30
686Persistent=true
687Unit=getmail.service
688
689[Install]
690WantedBy=timers.target
691#+end_src
692
693** Git
694
695*** gitconfig
696:PROPERTIES:
697:header-args+: :tangle ~/.gitconfig
698:END:
699
700**** user
701#+begin_src conf
702[user]
703 name = Amin Bandali
704 email = amin@gnu.org
705 signingkey = CDDE75F903538E71813CDA27D1FBA36627D65876
706#+end_src
707
708**** signing
709#+begin_src conf
710[commit]
711 gpgsign = true
712# [format]
713# signoff = true
714#+end_src
715
716**** core
717#+begin_src conf
718[core]
719 autocrlf = input # CRLF -> LF on commit
720 editor = emacsclient -t
721 excludesfile = ~/.gitignore_global
722 pager = "less"
723#+end_src
724
725**** gpg
726#+begin_src conf
727[gpg]
728 program = gpg2
729#+end_src
730
731**** alias
732#+begin_src conf
733[alias]
734 git = !exec git # handle nested git calls, e.g. git git status
735 aliases = config --get-regexp '^alias\\.'
736 a = add
737 s = status
738 sl = status --long
739 c = checkout
740 cb = checkout -b
741 b = branch
742 r = rebase
743 p = pull
744 pr = pull --rebase
745 ps = push
746 psf = push --force
747 nmam = "!f() { notmuch show --format=raw $1 | git am -; }; f"
748 nmam3 = "!f() { notmuch show --format=raw $1 | git am -3 -; }; f"
749#+end_src
750
751**** color
752#+begin_src conf
753[color]
754 ui = auto
755[color "status"]
756 added = green bold
757 changed = red bold
758 untracked = red bold
759[color "branch"]
760 current = green bold
761 remote = magenta bold
762[color "diff"]
763 new = green bold
764 old = red bold
765#+end_src
766
767**** status
768#+begin_src conf
769[status]
770 # showUntrackedFiles = all
771 short=true
772 branch=true
773#+end_src
774
775**** github
776#+begin_src conf
777[github]
778 user = aminb
779#+end_src
780
781**** send-email
782#+begin_src conf
783[sendemail]
784 smtpuser = aminb
785 smtpserver = fencepost.gnu.org
786 smtpserverport = 587
787 smtpencryption = tls
788 annotate = yes
789#+end_src
790
791*** gitignore
792:PROPERTIES:
793:header-args+: :tangle ~/.gitignore_global
794:END:
795
796#+begin_src conf
797*.orig
798*.py[co]
799*.sublime-workspace
800*~
801.DS_Store
802*.elc
803*-autoloads.el
804#+end_src
805
806** GnuPG
807:PROPERTIES:
808:header-args+: :tangle ~/.gnupg/gpg-agent.conf
809:END:
810
811#+begin_src conf
812default-cache-ttl 43200
813max-cache-ttl 43200
814
815default-cache-ttl-ssh 10800
816max-cache-ttl-ssh 10800
817
818# pinentry-program /usr/bin/pinentry-qt
819#+end_src
820
821** GTK
822
823*** gtk-2.0
824:PROPERTIES:
825:header-args+: :tangle ~/.gtkrc-2.0
826:END:
827
828#+begin_src conf
829gtk-theme-name="Greybird"
830gtk-icon-theme-name="Paper"
831gtk-font-name="Ubuntu 10"
832gtk-menu-images=0
833# gtk-key-theme-name = "Emacs"
834#+end_src
835
836*** gtk-3.0
837:PROPERTIES:
838:header-args+: :tangle ~/.config/gtk-3.0/settings.ini
839:END:
840
841#+begin_src conf :tangle no
842[Settings]
843gtk-icon-theme-name = Paper
844# gtk-theme-name = Adwaita
845
846gtk-theme-name = Greybird
847# gtk-theme-name = Arc-Darker
848# gtk-theme-name = Numix-ArchBlue
849
850gtk-font-name = Ubuntu 10
851# gtk-key-theme-name = Emacs
852#+end_src
853
854** [[https://github.com/Leinnan/i3gs][i3gs]]
855:PROPERTIES:
856:header-args+: :tangle ~/.config/i3gs/config
857:END:
858
859#+begin_src conf :comments none :tangle no
860borders_width=0 0 2 0
861separator_width=10
862
863#[mpd]
864#preset=MPD
865#title=<span weight='heavy' fgcolor='#7FDBFF'> </span>
866#borders_color=#7FDBFF
867
868[ram]
869preset=RAM
870title=<span weight='heavy' fgcolor='#3D9970'> </span>
871borders_color=#3D9970
872
873#[cpu]
874#preset=CPU
875#title=<span weight='heavy' fgcolor='#2ECC40'> </span>
876#borders_color=#2ECC40
877
878#[hdd]
879#preset=HDD
880#title=<span weight='heavy' fgcolor='#01FF70'> </span>
881#borders_color=#01FF70
882
883[volume]
884command=volume-info
885title=<span weight='heavy' fgcolor='#7FDBFF'></span>
886borders_color=#7FDBFF
887
888[battery]
889preset=BAT
890command=battery-percentage-time
891title=<span weight='heavy' fgcolor='#39CCCC'> </span>
892borders_color=#39CCCC
893
894[wifi]
895preset=WIFI
896title=<span weight='heavy' fgcolor='#01FF70'> </span>
897borders_color=#01FF70
898
899[date]
900preset=DATE
901command=date '+%-I:%M, %a %b %d '
902title=<span weight='heavy' fgcolor='#FFDC00'> </span>
903borders_color=#FFDC00
904separator_width=0
905#+end_src
906
907** i3status
908:PROPERTIES:
909:header-args+: :tangle ~/.config/i3status/config
910:END:
911
912#+begin_src conf :comments none
913# i3status configuration file.
914# see "man i3status" for documentation.
915
916# It is important that this file is edited as UTF-8.
917# The following line should contain a sharp s:
918# ß
919# If the above line is not correctly displayed, fix your editor first!
920
921general {
922 colors = true
923 interval = 5
924}
925
926# order += "ipv6"
927order += "disk /"
928order += "disk /data"
929order += "wireless _first_"
930# order += "ethernet _first_"
931order += "battery 0"
932order += "volume master"
933order += "load"
934order += "tztime local"
935
936wireless _first_ {
937 format_up = "W:%quality %essid %ip"
938 format_down = "W: down"
939}
940
941# ethernet _first_ {
942# # if you use %speed, i3status requires root privileges
943# format_up = "E: %ip (%speed)"
944# format_down = "E: down"
945# }
946
947battery 0 {
948 format = "%status %percentage %remaining (%consumption)"
949 path = "/sys/class/power_supply/BAT%d/uevent"
950 low_threshold = "10"
951 threshold_type = "percentage"
952 last_full_capacity = true
953 integer_battery_capacity = true
954 hide_seconds = true
955}
956
957tztime local {
958 format = "%-I:%M%P %a %b %d"
959}
960
961volume master {
962 format = "♪ %volume"
963 format_muted = "🔇 %volume"
964 device = "pulse"
965}
966
967load {
968 format = "%1min"
969}
970
971disk "/" {
972 format = "/ %avail"
973}
974
975disk "/data" {
976 format = "/data %avail"
977}
978#+end_src
979
980** isync
981
982*** mbsyncrc
983:PROPERTIES:
984:header-args+: :tangle ~/.mbsyncrc
985:END:
986
987#+begin_src conf
988# Global defaults
989CopyArrivalDate yes
990
991######
992IMAPAccount amin
993Host nix.aminb.org
994User amin@aminb.org
995PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/amin.gpg"
996SSLType IMAPS
997
998IMAPStore amin-remote
999Account amin
1000
1001MaildirStore amin-local
1002Path ~/mail/amin/
1003Inbox ~/mail/amin/Inbox
1004SubFolders Verbatim
1005
1006Channel amin
1007Master :amin-remote:
1008Slave :amin-local:
1009Patterns * !dovecot*
1010Create Both
1011SyncState *
1012
1013######
1014IMAPAccount uwaterloo
1015Host connect.uwaterloo.ca
1016User abandali
1017PassCmd "gpg -q --for-your-eyes-only --no-tty -d ~/.passwd/uwaterloo.gpg"
1018SSLType IMAPS
1019
1020IMAPStore uwaterloo-remote
1021Account uwaterloo
1022
1023MaildirStore uwaterloo-local
1024Path ~/mail/uwaterloo/
1025Inbox ~/mail/uwaterloo/Inbox
1026SubFolders Verbatim
1027
1028Channel uwaterloo
1029Master :uwaterloo-remote:
1030Slave :uwaterloo-local:
1031Patterns * !dovecot*
1032Create Both
1033SyncState *
1034#+end_src
1035
1036*** mbsync.service
1037:PROPERTIES:
1038:header-args+: :tangle ~/.config/systemd/user/mbsync.service
1039:END:
1040
1041#+begin_src conf :tangle no
1042[Unit]
1043Description=mbsync service
1044
1045[Service]
1046Type=oneshot
1047ExecStart=/usr/bin/mbsync -Va
1048StandardOutput=syslog
1049StandardError=syslog
1050#+end_src
1051
1052*** mbsync.timer
1053:PROPERTIES:
1054:header-args+: :tangle ~/.config/systemd/user/mbsync.timer
1055:END:
1056
1057#+begin_src conf :tangle no
1058[Unit]
1059Description=mbsync timer
1060
1061[Timer]
1062OnCalendar=*:0/15
1063Persistent=true
1064Unit=mbsync.service
1065
1066[Install]
1067WantedBy=timers.target
1068#+end_src
1069
1070** Latexmk
1071:PROPERTIES:
1072:header-args+: :tangle ~/.latexmkrc
1073:END:
1074
1075#+begin_src conf
1076$pdf_previewer = "start zathura %O %S";
1077$clean_ext = "aux out";
1078
1079# $pdf_update_method = 4;
1080# $pdf_update_command = "zathura %O %S";
1081
1082# Synctex allows one to jump to from the PDF in Zathura to the source in Emacs
1083# by Ctrl+click in the PDF.
1084# Tell latexmk to use Zathura as a previewer, and run emacsclient as the Synctex
1085# editor.
1086# $pdf_previewer = 'exec zathura --synctex-forward -x \'emacsclient --no-wait +%{line} %{input}\' %O %S';
1087#+end_src
1088
1089** libinput
1090
1091Improve XPS 15 9560's touchpad experience.
1092
1093# begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "plasma")) "/sudo::/etc/X11/xorg.conf.d/30-touchpad.conf")
1094#+begin_src conf :tangle no
1095Section "InputClass"
1096 Identifier "libinput touchpad catchall"
1097 Driver "libinput"
1098 MatchIsTouchpad "on"
1099 Option "ClickMethod" "clickfinger"
1100 Option "NaturalScrolling" "true"
1101 Option "Tapping" "on"
1102 Option "TappingButtonMap" "lrm"
1103EndSection
1104#+end_src
1105
1106** mpd
1107:PROPERTIES:
1108:header-args+: :tangle ~/.config/mpd/mpd.conf
1109:END:
1110
1111#+begin_src conf
1112# An example configuration file for MPD.
1113# Read the user manual for documentation: http://www.musicpd.org/doc/user/
1114
1115
1116# Files and directories #######################################################
1117#
1118# This setting controls the top directory which MPD will search to discover the
1119# available audio files and add them to the daemon's online database. This
1120# setting defaults to the XDG directory, otherwise the music directory will be
1121# be disabled and audio files will only be accepted over ipc socket (using
1122# file:// protocol) or streaming files over an accepted protocol.
1123#
1124music_directory "~/usr/music"
1125#
1126# This setting sets the MPD internal playlist directory. The purpose of this
1127# directory is storage for playlists created by MPD. The server will use
1128# playlist files not created by the server but only if they are in the MPD
1129# format. This setting defaults to playlist saving being disabled.
1130#
1131playlist_directory "~/.mpd/playlists"
1132#
1133# This setting sets the location of the MPD database. This file is used to
1134# load the database at server start up and store the database while the
1135# server is not up. This setting defaults to disabled which will allow
1136# MPD to accept files over ipc socket (using file:// protocol) or streaming
1137# files over an accepted protocol.
1138#
1139db_file "~/.mpd/database"
1140#
1141# These settings are the locations for the daemon log files for the daemon.
1142# These logs are great for troubleshooting, depending on your log_level
1143# settings.
1144#
1145# The special value "syslog" makes MPD use the local syslog daemon. This
1146# setting defaults to logging to syslog, otherwise logging is disabled.
1147#
1148log_file "~/.mpd/log"
1149#
1150# This setting sets the location of the file which stores the process ID
1151# for use of mpd --kill and some init scripts. This setting is disabled by
1152# default and the pid file will not be stored.
1153#
1154pid_file "~/.mpd/pid"
1155#
1156# This setting sets the location of the file which contains information about
1157# most variables to get MPD back into the same general shape it was in before
1158# it was brought down. This setting is disabled by default and the server
1159# state will be reset on server start up.
1160#
1161state_file "~/.mpd/state"
1162#
1163# The location of the sticker database. This is a database which
1164# manages dynamic information attached to songs.
1165#
1166sticker_file "~/.mpd/sticker.sql"
1167#
1168###############################################################################
1169
1170
1171# General music daemon options ################################################
1172#
1173# This setting specifies the user that MPD will run as. MPD should never run as
1174# root and you may use this setting to make MPD change its user ID after
1175# initialization. This setting is disabled by default and MPD is run as the
1176# current user.
1177#
1178#user "nobody"
1179#
1180# This setting specifies the group that MPD will run as. If not specified
1181# primary group of user specified with "user" setting will be used (if set).
1182# This is useful if MPD needs to be a member of group such as "audio" to
1183# have permission to use sound card.
1184#
1185#group "nogroup"
1186#
1187# This setting sets the address for the daemon to listen on. Careful attention
1188# should be paid if this is assigned to anything other then the default, any.
1189# This setting can deny access to control of the daemon. Not effective if
1190# systemd socket activiation is in use.
1191#
1192# For network
1193#bind_to_address "any"
1194#
1195# And for Unix Socket
1196#bind_to_address "~/.mpd/socket"
1197#
1198# This setting is the TCP port that is desired for the daemon to get assigned
1199# to.
1200#
1201#port "6600"
1202#
1203# This setting controls the type of information which is logged. Available
1204# setting arguments are "default", "secure" or "verbose". The "verbose" setting
1205# argument is recommended for troubleshooting, though can quickly stretch
1206# available resources on limited hardware storage.
1207#
1208#log_level "default"
1209#
1210# If you have a problem with your MP3s ending abruptly it is recommended that
1211# you set this argument to "no" to attempt to fix the problem. If this solves
1212# the problem, it is highly recommended to fix the MP3 files with vbrfix
1213# (available from <http://www.willwap.co.uk/Programs/vbrfix.php>), at which
1214# point gapless MP3 playback can be enabled.
1215#
1216#gapless_mp3_playback "yes"
1217#
1218# Setting "restore_paused" to "yes" puts MPD into pause mode instead
1219# of starting playback after startup.
1220#
1221#restore_paused "no"
1222#
1223# This setting enables MPD to create playlists in a format usable by other
1224# music players.
1225#
1226#save_absolute_paths_in_playlists "no"
1227#
1228# This setting defines a list of tag types that will be extracted during the
1229# audio file discovery process. The complete list of possible values can be
1230# found in the user manual.
1231#metadata_to_use "artist,album,title,track,name,genre,date,composer,performer,disc"
1232#
1233# This setting enables automatic update of MPD's database when files in
1234# music_directory are changed.
1235#
1236#auto_update "yes"
1237#
1238# Limit the depth of the directories being watched, 0 means only watch
1239# the music directory itself. There is no limit by default.
1240#
1241#auto_update_depth "3"
1242#
1243###############################################################################
1244
1245
1246# Symbolic link behavior ######################################################
1247#
1248# If this setting is set to "yes", MPD will discover audio files by following
1249# symbolic links outside of the configured music_directory.
1250#
1251#follow_outside_symlinks "yes"
1252#
1253# If this setting is set to "yes", MPD will discover audio files by following
1254# symbolic links inside of the configured music_directory.
1255#
1256#follow_inside_symlinks "yes"
1257#
1258###############################################################################
1259
1260
1261# Zeroconf / Avahi Service Discovery ##########################################
1262#
1263# If this setting is set to "yes", service information will be published with
1264# Zeroconf / Avahi.
1265#
1266#zeroconf_enabled "yes"
1267#
1268# The argument to this setting will be the Zeroconf / Avahi unique name for
1269# this MPD server on the network.
1270#
1271#zeroconf_name "Music Player"
1272#
1273###############################################################################
1274
1275
1276# Permissions #################################################################
1277#
1278# If this setting is set, MPD will require password authorization. The password
1279# setting can be specified multiple times for different password profiles.
1280#
1281#password "password@read,add,control,admin"
1282#
1283# This setting specifies the permissions a user has who has not yet logged in.
1284#
1285#default_permissions "read,add,control,admin"
1286#
1287###############################################################################
1288
1289
1290# Database #######################################################################
1291#
1292
1293#database {
1294# plugin "proxy"
1295# host "other.mpd.host"
1296# port "6600"
1297#}
1298
1299# Input #######################################################################
1300#
1301
1302input {
1303 plugin "curl"
1304# proxy "proxy.isp.com:8080"
1305# proxy_user "user"
1306# proxy_password "password"
1307}
1308
1309#
1310###############################################################################
1311
1312# Audio Output ################################################################
1313#
1314
1315audio_output {
1316 type "pulse"
1317 name "pulse audio"
1318}
1319
1320audio_output {
1321 type "fifo"
1322 name "my_fifo"
1323 path "/tmp/mpd.fifo"
1324 format "44100:16:2"
1325}
1326
1327# MPD supports various audio output types, as well as playing through multiple
1328# audio outputs at the same time, through multiple audio_output settings
1329# blocks. Setting this block is optional, though the server will only attempt
1330# autodetection for one sound card.
1331#
1332# An example of an ALSA output:
1333#
1334#audio_output {
1335# type "alsa"
1336# name "My ALSA Device"
1337## device "hw:0,0" # optional
1338## mixer_type "hardware" # optional
1339## mixer_device "default" # optional
1340## mixer_control "PCM" # optional
1341## mixer_index "0" # optional
1342#}
1343#
1344# An example of an OSS output:
1345#
1346#audio_output {
1347# type "oss"
1348# name "My OSS Device"
1349## device "/dev/dsp" # optional
1350## mixer_type "hardware" # optional
1351## mixer_device "/dev/mixer" # optional
1352## mixer_control "PCM" # optional
1353#}
1354#
1355# An example of a shout output (for streaming to Icecast):
1356#
1357#audio_output {
1358# type "shout"
1359# encoder "vorbis" # optional
1360# name "My Shout Stream"
1361# host "localhost"
1362# port "8000"
1363# mount "/mpd.ogg"
1364# password "hackme"
1365# quality "5.0"
1366# bitrate "128"
1367# format "44100:16:1"
1368## protocol "icecast2" # optional
1369## user "source" # optional
1370## description "My Stream Description" # optional
1371## url "http://example.com" # optional
1372## genre "jazz" # optional
1373## public "no" # optional
1374## timeout "2" # optional
1375## mixer_type "software" # optional
1376#}
1377#
1378# An example of a recorder output:
1379#
1380#audio_output {
1381# type "recorder"
1382# name "My recorder"
1383# encoder "vorbis" # optional, vorbis or lame
1384# path "/var/lib/mpd/recorder/mpd.ogg"
1385## quality "5.0" # do not define if bitrate is defined
1386# bitrate "128" # do not define if quality is defined
1387# format "44100:16:1"
1388#}
1389#
1390# An example of a httpd output (built-in HTTP streaming server):
1391#
1392#audio_output {
1393# type "httpd"
1394# name "My HTTP Stream"
1395# encoder "vorbis" # optional, vorbis or lame
1396# port "8000"
1397# bind_to_address "0.0.0.0" # optional, IPv4 or IPv6
1398## quality "5.0" # do not define if bitrate is defined
1399# bitrate "128" # do not define if quality is defined
1400# format "44100:16:1"
1401# max_clients "0" # optional 0=no limit
1402#}
1403#
1404# An example of a pulseaudio output (streaming to a remote pulseaudio server)
1405#
1406#audio_output {
1407# type "pulse"
1408# name "My Pulse Output"
1409## server "remote_server" # optional
1410## sink "remote_server_sink" # optional
1411#}
1412#
1413# An example of a winmm output (Windows multimedia API).
1414#
1415#audio_output {
1416# type "winmm"
1417# name "My WinMM output"
1418## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
1419# or
1420## device "0" # optional
1421## mixer_type "hardware" # optional
1422#}
1423#
1424# An example of an openal output.
1425#
1426#audio_output {
1427# type "openal"
1428# name "My OpenAL output"
1429## device "Digital Audio (S/PDIF) (High Definition Audio Device)" # optional
1430#}
1431#
1432# An example of an sndio output.
1433#
1434#audio_output {
1435# type "sndio"
1436# name "sndio output"
1437# mixer_type "software"
1438#}
1439#
1440# An example of an OS X output:
1441#
1442#audio_output {
1443# type "osx"
1444# name "My OS X Device"
1445## device "Built-in Output" # optional
1446## channel_map "-1,-1,0,1" # optional
1447#}
1448#
1449## Example "pipe" output:
1450#
1451#audio_output {
1452# type "pipe"
1453# name "my pipe"
1454# command "aplay -f cd 2>/dev/null"
1455## Or if you're want to use AudioCompress
1456# command "AudioCompress -m | aplay -f cd 2>/dev/null"
1457## Or to send raw PCM stream through PCM:
1458# command "nc example.org 8765"
1459# format "44100:16:2"
1460#}
1461#
1462## An example of a null output (for no audio output):
1463#
1464#audio_output {
1465# type "null"
1466# name "My Null Output"
1467# mixer_type "none" # optional
1468#}
1469#
1470###############################################################################
1471
1472
1473# Normalization automatic volume adjustments ##################################
1474#
1475# This setting specifies the type of ReplayGain to use. This setting can have
1476# the argument "off", "album", "track" or "auto". "auto" is a special mode that
1477# chooses between "track" and "album" depending on the current state of
1478# random playback. If random playback is enabled then "track" mode is used.
1479# See <http://www.replaygain.org> for more details about ReplayGain.
1480# This setting is off by default.
1481#
1482#replaygain "album"
1483#
1484# This setting sets the pre-amp used for files that have ReplayGain tags. By
1485# default this setting is disabled.
1486#
1487#replaygain_preamp "0"
1488#
1489# This setting sets the pre-amp used for files that do NOT have ReplayGain tags.
1490# By default this setting is disabled.
1491#
1492#replaygain_missing_preamp "0"
1493#
1494# This setting enables or disables ReplayGain limiting.
1495# MPD calculates actual amplification based on the ReplayGain tags
1496# and replaygain_preamp / replaygain_missing_preamp setting.
1497# If replaygain_limit is enabled MPD will never amplify audio signal
1498# above its original level. If replaygain_limit is disabled such amplification
1499# might occur. By default this setting is enabled.
1500#
1501#replaygain_limit "yes"
1502#
1503# This setting enables on-the-fly normalization volume adjustment. This will
1504# result in the volume of all playing audio to be adjusted so the output has
1505# equal "loudness". This setting is disabled by default.
1506#
1507#volume_normalization "no"
1508#
1509###############################################################################
1510
1511# Character Encoding ##########################################################
1512#
1513# If file or directory names do not display correctly for your locale then you
1514# may need to modify this setting.
1515#
1516#filesystem_charset "UTF-8"
1517#
1518###############################################################################
1519#+end_src
1520
1521** msmtp
1522:PROPERTIES:
1523:header-args+: :tangle ~/.msmtprc
1524:END:
1525
1526#+begin_src conf
1527# Set default values for all following accounts.
1528defaults
1529port 587
1530tls on
1531auth on
1532#tls_trust_file /etc/ssl/certs/ca-certificates.crt
1533logfile ~/.msmtp.log
1534
1535# aminb
1536account aminb
1537host nix.aminb.org
1538# use `msmtp -a aminb --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1539tls_fingerprint 98:C7:F0:02:7F:2B:D8:B6:D3:BF:E8:C1:D4:07:6B:B5:6C:B1:C7:5D:97:20:70:88:AB:9E:B5:09:5D:2C:DC:8E
1540tls_starttls on
1541from amin@aminb.org
1542user amin@aminb.org
1543passwordeval gpg2 --no-tty -q -d ~/.passwd/amin.gpg
1544
1545# gnu
1546account gnu
1547host fencepost.gnu.org
1548# use `msmtp -a gnu --serverinfo --tls --tls-certcheck=off --tls-fingerprint=` to get the current fingerprint
1549tls_fingerprint 28:70:42:76:1C:EC:91:5F:D1:B3:27:A1:CD:3B:32:A4:8B:0B:DC:3A:CD:CA:F6:6F:E4:61:BA:69:D7:4D:0D:0B
1550tls_starttls on
1551from aminb@gnu.org
1552user aminb
1553passwordeval gpg2 --no-tty -q -d ~/.passwd/gnu.gpg
1554
1555# gnu (amin)
1556account gnu-amin : gnu
1557from amin@gnu.org
1558
1559# gnu (mab)
1560account gnu-mab : gnu
1561from mab@gnu.org
1562
1563# uwaterloo
1564account uwaterloo
1565host connect.uwaterloo.ca
1566tls_starttls on
1567from abandali@uwaterloo.ca
1568user abandali
1569passwordeval gpg2 --no-tty -q -d ~/.passwd/uwaterloo.gpg
1570tls_trust_file /etc/ssl/certs/ca-certificates.crt
1571
1572# Set a default account
1573account default : aminb
1574#+end_src
1575
1576** ncmpcpp
1577
1578*** config
1579:PROPERTIES:
1580:header-args+: :tangle ~/.ncmpcpp/config
1581:END:
1582
1583#+begin_src conf :tangle no
1584##############################################################
1585## This is the example configuration file. Copy it to ##
1586## $HOME/.ncmpcpp/config or $XDG_CONFIG_HOME/ncmpcpp/config ##
1587## and set up your preferences. ##
1588##############################################################
1589#
1590##### directories ######
1591##
1592## Directory for storing ncmpcpp related files.
1593## Changing it is useful if you want to store
1594## everything somewhere else and provide command
1595## line setting for alternative location to config
1596## file which defines that while launching ncmpcpp.
1597##
1598#
1599ncmpcpp_directory = ~/.ncmpcpp
1600#
1601##
1602## Directory for storing downloaded lyrics. It
1603## defaults to ~/.lyrics since other MPD clients
1604## (eg. ncmpc) also use that location.
1605##
1606#
1607#lyrics_directory = ~/.lyrics
1608#
1609##### connection settings #####
1610#
1611#mpd_host = localhost
1612#
1613#mpd_port = 6600
1614#
1615#mpd_connection_timeout = 5
1616#
1617## Needed for tag editor and file operations to work.
1618##
1619mpd_music_dir = ~/usr/music
1620#
1621#mpd_crossfade_time = 5
1622#
1623##### music visualizer #####
1624##
1625## Note: In order to make music visualizer work you'll
1626## need to use mpd fifo output, whose format parameter
1627## has to be set to 44100:16:1 for mono visualization
1628## or 44100:16:2 for stereo visualization. Example
1629## configuration (it has to be put into mpd.conf):
1630##
1631## audio_output {
1632## type "fifo"
1633## name "Visualizer feed"
1634## path "/tmp/mpd.fifo"
1635## format "44100:16:2"
1636## }
1637##
1638#
1639visualizer_fifo_path = /tmp/mpd.fifo
1640#
1641##
1642## Note: Below parameter is needed for ncmpcpp
1643## to determine which output provides data for
1644## visualizer and thus allow syncing between
1645## visualization and sound as currently there
1646## are some problems with it.
1647##
1648#
1649visualizer_output_name = my fifo
1650#
1651##
1652## If you set format to 44100:16:2, make it 'yes'.
1653##
1654visualizer_in_stereo = yes
1655#
1656##
1657## Multiply received samples by given value. Very
1658## useful for proper visualization of quiet music.
1659##
1660#visualizer_sample_multiplier = 1
1661#
1662##
1663## Note: Below parameter defines how often ncmpcpp
1664## has to "synchronize" visualizer and audio outputs.
1665## 30 seconds is optimal value, but if you experience
1666## synchronization problems, set it to lower value.
1667## Keep in mind that sane values start with >=10.
1668##
1669#
1670visualizer_sync_interval = 30
1671#
1672##
1673## Note: To enable spectrum frequency visualization
1674## you need to compile ncmpcpp with fftw3 support.
1675##
1676#
1677## Available values: spectrum, wave, wave_filled, ellipse.
1678##
1679visualizer_type = spectrum
1680#
1681#visualizer_look = ●▮
1682visualizer_look = "●•"
1683#
1684#visualizer_color = blue, cyan, green, yellow, magenta, red
1685#
1686## Alternative subset of 256 colors for terminals that support it.
1687##
1688#visualizer_color = 41, 83, 119, 155, 185, 215, 209, 203, 197, 161
1689#
1690##### system encoding #####
1691##
1692## ncmpcpp should detect your charset encoding
1693## but if it failed to do so, you can specify
1694## charset encoding you are using here.
1695##
1696## Note: You can see whether your ncmpcpp build
1697## supports charset detection by checking output
1698## of `ncmpcpp --version`.
1699##
1700## Note: Since MPD uses UTF-8 by default, setting
1701## this option makes sense only if your encoding
1702## is different.
1703##
1704#
1705#system_encoding = ""
1706#
1707##### delays #####
1708#
1709## Time of inactivity (in seconds) after playlist
1710## highlighting will be disabled (0 = always on).
1711##
1712#playlist_disable_highlight_delay = 5
1713#
1714## Defines how long messages are supposed to be visible.
1715##
1716#message_delay_time = 5
1717#
1718##### song format #####
1719##
1720## For a song format you can use:
1721##
1722## %l - length
1723## %f - filename
1724## %D - directory
1725## %a - artist
1726## %A - album artist
1727## %t - title
1728## %b - album
1729## %y - date
1730## %n - track number (01/12 -> 01)
1731## %N - full track info (01/12 -> 01/12)
1732## %g - genre
1733## %c - composer
1734## %p - performer
1735## %d - disc
1736## %C - comment
1737## %P - priority
1738## $R - begin right alignment
1739##
1740## If you want to make sure that a part of the format is displayed
1741## only when certain tags are present, you can archieve it by
1742## grouping them with brackets, e.g. '{%a - %t}' will be evaluated
1743## to 'ARTIST - TITLE' if both tags are present or '' otherwise.
1744## It is also possible to define a list of alternatives by providing
1745## several groups and separating them with '|', e.g. '{%t}|{%f}'
1746## will be evaluated to 'TITLE' or 'FILENAME' if the former is not
1747## present.
1748##
1749## Note: If you want to set limit on maximal length of a tag, just
1750## put the appropriate number between % and character that defines
1751## tag type, e.g. to make album take max. 20 terminal cells, use '%20b'.
1752##
1753## In addition, formats support markers used for text attributes.
1754## They are followed by character '$'. After that you can put:
1755##
1756## - 0 - default window color (discards all other colors)
1757## - 1 - black
1758## - 2 - red
1759## - 3 - green
1760## - 4 - yellow
1761## - 5 - blue
1762## - 6 - magenta
1763## - 7 - cyan
1764## - 8 - white
1765## - 9 - end of current color
1766## - b - bold text
1767## - u - underline text
1768## - r - reverse colors
1769## - a - use alternative character set
1770##
1771## If you don't want to use a non-color attribute anymore, just put it
1772## again, but this time insert character '/' between '$' and attribute
1773## character, e.g. {$b%t$/b}|{$r%f$/r} will display bolded title tag
1774## or filename with reversed colors.
1775##
1776## If you want to use 256 colors and/or background colors in formats
1777## (the naming scheme is described below in section about color
1778## definitions), it can be done with the syntax $(COLOR), e.g. to set
1779## the artist tag to one of the non-standard colors and make it have
1780## yellow background, you need to write $(197_yellow)%a$(end). Note
1781## that for standard colors this is interchangable with attributes
1782## listed above.
1783##
1784## Note: colors can be nested.
1785##
1786#
1787#song_list_format = {%a - }{%t}|{$8%f$9}$R{$3(%l)$9}
1788#
1789#song_status_format = {{%a{ "%b"{ (%y)}} - }{%t}}|{%f}
1790#
1791#song_library_format = {%n - }{%t}|{%f}
1792#
1793#
1794#alternative_header_first_line_format = $b$1$aqqu$/a$9 {%t}|{%f} $1$atqq$/a$9$/b
1795#
1796#alternative_header_second_line_format = {{$4$b%a$/b$9}{ - $7%b$9}{ ($4%y$9)}}|{%D}
1797#
1798#now_playing_prefix = $b
1799#
1800#now_playing_suffix = $/b
1801#
1802#browser_playlist_prefix = "$2playlist$9 "
1803#
1804#selected_item_prefix = $6
1805#
1806#selected_item_suffix = $9
1807#
1808#modified_item_prefix = $3> $9
1809#
1810##
1811## Note: attributes are not supported for the following variables.
1812##
1813#song_window_title_format = {%a - }{%t}|{%f}
1814##
1815## Note: Below variables are used for sorting songs in browser.
1816## The sort mode determines how songs are sorted, and can be used
1817## in combination with a sort format to specify a custom sorting format.
1818## Available values for browser_sort_mode are "name", "mtime", "format"
1819## and "noop".
1820##
1821#
1822#browser_sort_mode = name
1823#
1824#browser_sort_format = {%a - }{%t}|{%f} {(%l)}
1825#
1826##### columns settings #####
1827##
1828## syntax of song columns list format is "column column etc."
1829##
1830## - syntax for each column is:
1831##
1832## (width of the column)[color of the column]{displayed tag}
1833##
1834## Note: Width is by default in %, if you want a column to
1835## have fixed size, add 'f' after the value, e.g. (10)[white]{a}
1836## will be the column that take 10% of screen (so the real width
1837## will depend on actual screen size), whereas (10f)[white]{a}
1838## will take 10 terminal cells, no matter how wide the screen is.
1839##
1840## - color is optional (if you want the default one,
1841## leave the field empty).
1842##
1843## Note: You can give a column additional attributes by putting appropriate
1844## character after displayed tag character. Available attributes are:
1845##
1846## - r - column will be right aligned
1847## - E - if tag is empty, empty tag marker won't be displayed
1848##
1849## You can also:
1850##
1851## - give a column custom name by putting it after attributes,
1852## separated with character ':', e.g. {lr:Length} gives you
1853## right aligned column of lengths named "Length".
1854##
1855## - define sequence of tags, that have to be displayed in case
1856## predecessor is empty in a way similar to the one in classic
1857## song format, i.e. using '|' character, e.g. {a|c|p:Owner}
1858## creates column named "Owner" that tries to display artist
1859## tag and then composer and performer if previous ones are
1860## not available.
1861##
1862#
1863#song_columns_list_format = (20)[]{a} (6f)[green]{NE} (50)[white]{t|f:Title} (20)[cyan]{b} (7f)[magenta]{l}
1864#
1865##### various settings #####
1866#
1867##
1868## Note: Custom command that will be executed each
1869## time song changes. Useful for notifications etc.
1870##
1871#execute_on_song_change = ""
1872#
1873#playlist_show_mpd_host = no
1874#
1875#playlist_show_remaining_time = no
1876#
1877#playlist_shorten_total_times = no
1878#
1879#playlist_separate_albums = no
1880#
1881##
1882## Note: Possible display modes: classic, columns.
1883##
1884#playlist_display_mode = columns
1885#
1886#browser_display_mode = classic
1887#
1888#search_engine_display_mode = classic
1889#
1890#playlist_editor_display_mode = classic
1891#
1892#discard_colors_if_item_is_selected = yes
1893#
1894#incremental_seeking = yes
1895#
1896#seek_time = 1
1897#
1898#volume_change_step = 2
1899#
1900#autocenter_mode = no
1901#
1902#centered_cursor = no
1903#
1904##
1905## Note: You can specify third character which will
1906## be used to build 'empty' part of progressbar.
1907##
1908#progressbar_look = =>
1909progressbar_look = "─╼╶"
1910#progressbar_look = "─⊙╶"
1911#
1912#progressbar_boldness = yes
1913#
1914## Available values: database, playlist.
1915##
1916#default_place_to_search_in = database
1917#
1918## Available values: classic, alternative.
1919##
1920#user_interface = classic
1921#
1922#data_fetching_delay = yes
1923#
1924## Available values: artist, album_artist, date, genre, composer, performer.
1925##
1926#media_library_primary_tag = artist
1927#
1928## Available values: wrapped, normal.
1929##
1930#default_find_mode = wrapped
1931#
1932#default_tag_editor_pattern = %n - %t
1933#
1934#header_visibility = yes
1935#
1936#statusbar_visibility = yes
1937#
1938#titles_visibility = yes
1939#
1940#header_text_scrolling = yes
1941#
1942#cyclic_scrolling = no
1943#
1944#lines_scrolled = 2
1945#
1946#follow_now_playing_lyrics = no
1947#
1948#fetch_lyrics_for_current_song_in_background = no
1949#
1950#store_lyrics_in_song_dir = no
1951#
1952#generate_win32_compatible_filenames = yes
1953#
1954#allow_for_physical_item_deletion = no
1955#
1956##
1957## Note: If you set this variable, ncmpcpp will try to
1958## get info from last.fm in language you set and if it
1959## fails, it will fall back to english. Otherwise it will
1960## use english the first time.
1961##
1962## Note: Language has to be expressed as an ISO 639 alpha-2 code.
1963##
1964#lastfm_preferred_language = en
1965#
1966#show_hidden_files_in_local_browser = no
1967#
1968##
1969## How shall screen switcher work?
1970##
1971## - "previous" - switch between the current and previous screen.
1972## - "screen1,...,screenN" - switch between given sequence of screens.
1973##
1974## Screens available for use: help, playlist, browser, search_engine,
1975## media_library, playlist_editor, tag_editor, outputs, visualizer, clock.
1976##
1977#screen_switcher_mode = playlist, browser
1978#
1979##
1980## Note: You can define startup screen
1981## by choosing screen from the list above.
1982##
1983#startup_screen = playlist
1984#
1985##
1986## Note: You can define startup slave screen
1987## by choosing screen from the list above or
1988## an empty value for no slave screen.
1989##
1990#startup_slave_screen = ""
1991#
1992#startup_slave_screen_focus = no
1993#
1994##
1995## Default width of locked screen (in %).
1996## Acceptable values are from 20 to 80.
1997##
1998#
1999#locked_screen_width_part = 50
2000#
2001#ask_for_locked_screen_width_part = yes
2002#
2003#jump_to_now_playing_song_at_start = yes
2004#
2005#ask_before_clearing_playlists = yes
2006#
2007#clock_display_seconds = no
2008#
2009#display_volume_level = yes
2010#
2011#display_bitrate = no
2012#
2013#display_remaining_time = no
2014#
2015## Available values: none, basic, extended, perl.
2016##
2017#regular_expressions = perl
2018#
2019##
2020## Note: If below is enabled, ncmpcpp will ignore leading
2021## "The" word while sorting items in browser, tags in
2022## media library, etc.
2023##
2024#ignore_leading_the = no
2025#
2026#block_search_constraints_change_if_items_found = yes
2027#
2028#mouse_support = yes
2029#
2030#mouse_list_scroll_whole_page = yes
2031#
2032#empty_tag_marker = <empty>
2033#
2034#tags_separator = " | "
2035#
2036#tag_editor_extended_numeration = no
2037#
2038#media_library_sort_by_mtime = no
2039#
2040#enable_window_title = yes
2041#
2042##
2043## Note: You can choose default search mode for search
2044## engine. Available modes are:
2045##
2046## - 1 - use mpd built-in searching (no regexes, pattern matching)
2047## - 2 - use ncmpcpp searching (pattern matching with support for regexes,
2048## but if your mpd is on a remote machine, downloading big database
2049## to process it can take a while
2050## - 3 - match only exact values (this mode uses mpd function for searching
2051## in database and local one for searching in current playlist)
2052##
2053#
2054#search_engine_default_search_mode = 1
2055#
2056#external_editor = nano
2057#
2058## Note: set to yes if external editor is a console application.
2059##
2060#use_console_editor = yes
2061#
2062##### colors definitions #####
2063##
2064## It is possible to set a background color by setting a color
2065## value "<foreground>_<background>", e.g. red_black will set
2066## foregound color to red and background color to black.
2067##
2068## In addition, for terminals that support 256 colors it
2069## is possible to set one of them by using a number in range
2070## [1, 256] instead of color name, e.g. numerical value
2071## corresponding to red_black is 2_1. To find out if the
2072## terminal supports 256 colors, run ncmpcpp and check out
2073## the bottom of the help screen for list of available colors
2074## and their numerical values.
2075##
2076## Note: due to technical limitations of ncurses, if 256 colors
2077## are used, it is possible to either use only the colors with
2078## default background color, or all pairs from 1_1 up to 254_127,
2079## depending on the ncurses version used.
2080##
2081#
2082#colors_enabled = yes
2083#
2084#empty_tag_color = cyan
2085#
2086#header_window_color = default
2087#
2088#volume_color = default
2089#
2090#state_line_color = default
2091#
2092#state_flags_color = default
2093#
2094#main_window_color = yellow
2095#
2096#color1 = white
2097#
2098#color2 = green
2099#
2100#main_window_highlight_color = yellow
2101#
2102#progressbar_color = black
2103#
2104#progressbar_elapsed_color = green
2105#
2106#statusbar_color = default
2107#
2108#alternative_ui_separator_color = black
2109#
2110#active_column_color = red
2111#
2112#window_border_color = green
2113#
2114#active_window_border = red
2115#
2116#+end_src
2117
2118*** bindings
2119:PROPERTIES:
2120:header-args+: :tangle ~/.ncmpcpp/bindings
2121:END:
2122
2123#+begin_src conf :tangle no
2124def_key "j"
2125 scroll_down
2126def_key "k"
2127 scroll_up
2128
2129def_key "ctrl-u"
2130 page_up
2131def_key "ctrl-d"
2132 page_down
2133
2134def_key "h"
2135 previous_column
2136def_key "l"
2137 next_column
2138
2139def_key "."
2140 show_lyrics
2141
2142def_key "n"
2143 next_found_item
2144def_key "N"
2145 previous_found_item
2146
2147def_key "J"
2148 move_sort_order_down
2149def_key "K"
2150 move_sort_order_up
2151#+end_src
2152
2153** notmuch
2154
2155*** notmuch-config
2156:PROPERTIES:
2157:header-args+: :tangle ~/.notmuch-config
2158:END:
2159
2160#+begin_src conf
2161# .notmuch-config - Configuration file for the notmuch mail system
2162#
2163# For more information about notmuch, see https://notmuchmail.org
2164
2165# Database configuration
2166#
2167# The only value supported here is 'path' which should be the top-level
2168# directory where your mail currently exists and to where mail will be
2169# delivered in the future. Files should be individual email messages.
2170# Notmuch will store its database within a sub-directory of the path
2171# configured here named ".notmuch".
2172#
2173[database]
2174path=/home/amin/mail
2175
2176# User configuration
2177#
2178# Here is where you can let notmuch know how you would like to be
2179# addressed. Valid settings are
2180#
2181# name Your full name.
2182# primary_email Your primary email address.
2183# other_email A list (separated by ';') of other email addresses
2184# at which you receive email.
2185#
2186# Notmuch will use the various email addresses configured here when
2187# formatting replies. It will avoid including your own addresses in the
2188# recipient list of replies, and will set the From address based on the
2189# address to which the original email was addressed.
2190#
2191[user]
2192name=Amin Bandali
2193primary_email=amin@aminb.org
2194other_email=amin@gnu.org;abandali@uwaterloo.ca;mab@gnu.org;aminb@gnu.org;
2195
2196# Configuration for "notmuch new"
2197#
2198# The following options are supported here:
2199#
2200# tags A list (separated by ';') of the tags that will be
2201# added to all messages incorporated by "notmuch new".
2202#
2203# ignore A list (separated by ';') of file and directory names
2204# that will not be searched for messages by "notmuch new".
2205#
2206# NOTE: *Every* file/directory that goes by one of those
2207# names will be ignored, independent of its depth/location
2208# in the mail store.
2209#
2210[new]
2211tags=new;
2212#tags=unread;inbox;
2213ignore=.uidvalidity;.mbsyncstate;/.*/dovecot*/
2214
2215# Search configuration
2216#
2217# The following option is supported here:
2218#
2219# exclude_tags
2220# A ;-separated list of tags that will be excluded from
2221# search results by default. Using an excluded tag in a
2222# query will override that exclusion.
2223#
2224[search]
2225exclude_tags=deleted;spam;
2226
2227# Maildir compatibility configuration
2228#
2229# The following option is supported here:
2230#
2231# synchronize_flags Valid values are true and false.
2232#
2233# If true, then the following maildir flags (in message filenames)
2234# will be synchronized with the corresponding notmuch tags:
2235#
2236# Flag Tag
2237# ---- -------
2238# D draft
2239# F flagged
2240# P passed
2241# R replied
2242# S unread (added when 'S' flag is not present)
2243#
2244# The "notmuch new" command will notice flag changes in filenames
2245# and update tags, while the "notmuch tag" and "notmuch restore"
2246# commands will notice tag changes and update flags in filenames
2247#
2248[maildir]
2249synchronize_flags=true
2250
2251# Cryptography related configuration
2252#
2253# The following option is supported here:
2254#
2255# gpg_path
2256# binary name or full path to invoke gpg.
2257#
2258[crypto]
2259gpg_path=gpg
2260#+end_src
2261
2262*** pre-new hook
2263:PROPERTIES:
2264:header-args+: :tangle ~/mail/.notmuch/hooks/pre-new :shebang "#!/bin/sh"
2265:END:
2266
2267#+begin_src sh
2268touch /tmp/gnusieve.log
2269sieve-filter -eW -o postmaster_address=postmaster@aminb.org \
2270 -o mail_location=maildir:$MAILDIR/gnu:LAYOUT=fs:INBOX=$MAILDIR/gnu/Inbox ~/sieve/gnu.sieve INBOX delete &>>/tmp/gnusieve.log
2271#+end_src
2272
2273*** post-new hook
2274:PROPERTIES:
2275:header-args+: :tangle ~/mail/.notmuch/hooks/post-new :shebang "#!/bin/sh"
2276:END:
2277
2278#+begin_src sh
2279# apply sent tag to messages sent by me
2280notmuch tag -new +sent -- from:amin@aminb.org or from:amin@gnu.org or from:mab@gnu.org or from:aminb@gnu.org or from:abandali@uwaterloo.ca
2281
2282# initial tagging
2283notmuch tag -latest -- tag:latest
2284notmuch tag +inbox +unread +latest -new -- tag:new
2285
2286
2287# apply tags to lists
2288
2289# <aminb>
2290notmuch tag -inbox +lists/hackernewsletter -- folder:amin/lists/hackernewsletter
2291notmuch tag -inbox +lists/haskell-weekly -- folder:amin/lists/haskell-weekly
2292
2293notmuch tag -inbox +pay -- folder:amin/pay
2294notmuch tag -inbox +banking -- folder:amin/banking
2295# </aminb>
2296
2297# <uw>
2298notmuch tag -inbox +uw/cs136 -- folder:uwaterloo/lists/cs136
2299notmuch tag -inbox +uw/se463 -- folder:uwaterloo/lists/se463
2300
2301notmuch tag -inbox +lists/clvsingle -- folder:uwaterloo/lists/Clvsingle
2302notmuch tag -inbox +lists/gsa -- folder:uwaterloo/lists/GSA
2303notmuch tag -inbox +lists/math-grad -- folder:uwaterloo/lists/Math-grad
2304notmuch tag -inbox +lists/scs-grads -- folder:uwaterloo/lists/scs-grads
2305notmuch tag -inbox +lists/watform-students -- folder:uwaterloo/lists/Watform-students
2306# </uw>
2307
2308# <gnu>
2309notmuch tag -inbox +l/emacs-devel -- folder:gnu/l/emacs-devel
2310notmuch tag -inbox +l/emacs-orgmode -- folder:gnu/l/emacs-orgmode
2311notmuch tag -inbox +l/emacsconf-discuss -- folder:gnu/l/emacsconf-discuss
2312notmuch tag -inbox +l/fencepost-users -- folder:gnu/l/fencepost-users
2313notmuch tag -inbox +l/guix-devel -- folder:gnu/l/guix-devel
2314notmuch tag -inbox +l/guile-devel -- folder:gnu/l/guile-devel
2315notmuch tag -inbox +l/help-gnu-emacs -- folder:gnu/l/help-gnu-emacs
2316notmuch tag -inbox +l/info-gnu-emacs -- folder:gnu/l/info-gnu-emacs
2317notmuch tag -inbox +l/www-commits -- folder:gnu/l/www-commits
2318notmuch tag -inbox +l/www-discuss -- folder:gnu/l/www-discuss
2319notmuch tag -inbox +webmasters -- folder:gnu/webmasters
2320
2321notmuch tag -inbox +l/deepspec -- folder:gnu/l/deepspec
2322notmuch tag -inbox +l/haskell-cafe -- folder:gnu/l/haskell-cafe
2323notmuch tag -inbox +l/haskell-art -- folder:gnu/l/haskell-art
2324notmuch tag -inbox +l/notmuch -- folder:gnu/l/notmuch
2325
2326notmuch tag -inbox +l/~aminb/test-priv -- folder:gnu/l/~aminb/test-priv
2327notmuch tag -inbox +l/~sircmpwn/sr.ht-admins -- folder:gnu/l/~sircmpwn/sr.ht-admins
2328notmuch tag -inbox +l/~sircmpwn/sr.ht-announce -- folder:gnu/l/~sircmpwn/sr.ht-announce
2329notmuch tag -inbox +l/~sircmpwn/sr.ht-dev -- folder:gnu/l/~sircmpwn/sr.ht-dev
2330notmuch tag -inbox +l/~sircmpwn/sr.ht-discuss -- folder:gnu/l/~sircmpwn/sr.ht-discuss
2331# </gnu>
2332
2333notmuch tag -inbox -unread +archive/notmuch -- path:archive/notmuch/**
2334notmuch tag -inbox -unread +archive/emacs-devel -- path:archive/emacs-devel/**
2335#+end_src
2336
2337*** notmuch.service
2338:PROPERTIES:
2339:header-args+: :tangle ~/.config/systemd/user/notmuch.service
2340:END:
2341
2342#+begin_src conf :tangle no
2343[Unit]
2344Description=notmuch service
2345
2346[Service]
2347Type=oneshot
2348ExecStart=/usr/bin/notmuch new
2349StandardOutput=syslog
2350StandardError=syslog
2351#+end_src
2352
2353*** notmuch.timer
2354:PROPERTIES:
2355:header-args+: :tangle ~/.config/systemd/user/notmuch.timer
2356:END:
2357
2358#+begin_src conf :tangle no
2359[Unit]
2360Description=notmuch timer
2361
2362[Timer]
2363OnCalendar=*:0/5
2364Persistent=true
2365Unit=notmuch.service
2366
2367[Install]
2368WantedBy=timers.target
2369#+end_src
2370
2371** offlineimap
2372
2373*** offlineimaprc
2374:PROPERTIES:
2375:header-args+: :tangle ~/.offlineimaprc
2376:END:
2377
2378#+begin_src conf :tangle no
2379[general]
2380pythonfile = ~/.offlineimap.py
2381accounts = Gmail, aminb
2382maxsyncaccounts = 3
2383
2384[Account Gmail]
2385localrepository = GmailL
2386remoterepository = GmailR
2387
2388[Account aminb]
2389localrepository = aminbL
2390remoterepository = aminbR
2391
2392[Repository GmailL]
2393type = Maildir
2394localfolders = ~/Maildir/Gmail
2395
2396[Repository GmailR]
2397type = IMAP
2398remotehost = imap.gmail.com
2399remoteusereval = mailuser("gmail")
2400remotepasseval = mailpasswd("gmail")
2401sslcacertfile = /etc/ssl/certs/ca-certificates.crt
2402ssl = yes
2403folderfilter = lambda foldername: foldername not in '[Gmail]/All Mail'
2404maxconnections = 1
2405realdelete = no
2406
2407[Repository aminbL]
2408type = Maildir
2409localfolders = ~/Maildir/aminb
2410
2411[Repository aminbR]
2412type = IMAP
2413remotehost = mail.aminb.org
2414remoteusereval = mailuser("aminb")
2415remotepasseval = mailpasswd("aminb")
2416sslcacertfile = /etc/ssl/certs/ca-certificates.crt
2417ssl = yes
2418folderfilter = lambda foldername: foldername not in 'dovecot.sieve'
2419maxconnections = 1
2420realdelete = no
2421#+end_src
2422
2423*** offlineimap.py
2424:PROPERTIES:
2425:header-args+: :tangle ~/.offlineimap.py
2426:END:
2427
2428#+begin_src python :tangle no
2429import os
2430import subprocess
2431
2432def mailpasswd(acct):
2433 acct = os.path.basename(acct)
2434 path = "/home/amin/.passwd/%s.gpg" % acct
2435 args = ["gpg", "--use-agent", "--quiet", "--batch", "-d", path]
2436 try:
2437 return subprocess.check_output(args).strip()
2438 except subprocess.CalledProcessError:
2439 return ""
2440
2441def mailuser(acct):
2442 acct = os.path.basename(acct)
2443 path = "/home/amin/.passwd/%s" % acct
2444 args = ["cat", path]
2445 try:
2446 return subprocess.check_output(args).strip()
2447 except subprocess.CalledProcessError:
2448 return ""
2449
2450def prime_gpg_agent():
2451 ret = False
2452 i = 1
2453 while not ret:
2454 ret = (mailpasswd("prime") == "prime")
2455 if i > 2:
2456 from offlineimap.ui import getglobalui
2457 sys.stderr.write("Error reading in passwords. Terminating.\n")
2458 getglobalui().terminate()
2459 i += 1
2460 return ret
2461
2462prime_gpg_agent()
2463#+end_src
2464
2465** pigeonhole
2466*** gnu.sieve
2467:PROPERTIES:
2468:header-args+: :tangle ~/sieve/gnu.sieve :comments none
2469:END:
2470
2471#+begin_src conf
2472require [ "regex", "variables", "fileinto", "envelope", "mailbox", "imap4flags", "include" ];
2473
2474if anyof (
2475 address :is "from" "webmasters@gnu.org",
2476 address :is "from" "webmasters-comment@gnu.org") {
2477 fileinto :create "webmasters";
2478 stop;
2479}
2480
2481include :personal "lists";
2482#+end_src
2483
2484*** lists.sieve
2485:PROPERTIES:
2486:header-args+: :tangle ~/sieve/lists.sieve :comments none
2487:END:
2488
2489#+begin_src conf
2490require [ "regex", "variables", "fileinto", "envelope", "mailbox", "imap4flags",
2491 "include" ];
2492
2493if anyof (
2494 header :contains "list-id" "<emacs-devel.gnu.org>",
2495 header :contains "list-id" "<emacs-orgmode.gnu.org>",
2496 header :contains "list-id" "<emacsconf-discuss.gnu.org>",
2497 header :contains "list-id" "<fencepost-users.gnu.org>",
2498 header :contains "list-id" "<guix-devel.gnu.org>",
2499 header :contains "list-id" "<guile-devel.gnu.org>",
2500 header :contains "list-id" "<help-gnu-emacs.gnu.org>",
2501 header :contains "list-id" "<info-gnu-emacs.gnu.org>",
2502 header :contains "list-id" "<www-commits.gnu.org>",
2503 header :contains "list-id" "<www-discuss.gnu.org>",
2504 header :contains "list-id" "<deepspec.lists.cs.princeton.edu>",
2505 header :contains "list-id" "<haskell-cafe.haskell.org>",
2506 header :contains "list-id" "<haskell-art.we.lurk.org>",
2507 header :contains "list-id" "<notmuch.notmuchmail.org>") {
2508 if header :regex "list-id" "<([a-z_0-9-]+)[.@]" {
2509 set :lower "listname" "${1}";
2510 fileinto :create "l/${listname}";
2511 }
2512}
2513
2514if anyof (
2515 header :contains "list-id" "<~aminb/test-priv@lists.sr.ht>",
2516 header :contains "list-id" "<~sircmpwn/sr.ht-admins@lists.sr.ht>",
2517 header :contains "list-id" "<~sircmpwn/sr.ht-announce@lists.sr.ht>",
2518 header :contains "list-id" "<~sircmpwn/sr.ht-dev@lists.sr.ht>",
2519 header :contains "list-id" "<~sircmpwn/sr.ht-discuss@lists.sr.ht>") {
2520 if header :regex "list-id" "(~[a-z_0-9-]+)/([a-z_0-9.-]+)@" {
2521 set :lower "username" "${1}";
2522 set :lower "listname" "${2}";
2523 fileinto :create "l/${username}/${listname}";
2524 }
2525}
2526#+end_src
2527
2528** polybar
2529
2530*** config
2531:PROPERTIES:
2532:header-args+: :tangle ~/.config/polybar/config
2533:END:
2534
2535#+begin_src conf :tangle no
2536;=====================================================
2537;
2538; To learn more about how to configure Polybar
2539; go to https://github.com/jaagr/polybar
2540;
2541; The README contains alot of information
2542;
2543;=====================================================
2544
2545[colors]
2546;background = ${xrdb:color0:#222}
2547background = #222
2548background-alt = #444
2549;foreground = ${xrdb:color7:#222}
2550foreground = #eee
2551foreground-alt = #888
2552primary = #ffb52a
2553secondary = #e60053
2554alert = #bd2c40
2555
2556[bar/main]
2557;monitor = ${env:MONITOR:HDMI-1}
2558width = 100%
2559height = 27
2560;offset-x = 1%
2561;offset-y = 1%
2562radius = 3.0
2563fixed-center = true
2564
2565background = ${colors.background}
2566foreground = ${colors.foreground}
2567
2568line-size = 3
2569line-color = #f00
2570
2571border-size = 4
2572border-color = #00000000
2573
2574padding-left = 0
2575padding-right = 2
2576
2577module-margin-left = 2
2578module-margin-right = 2
2579
2580font-0 = Ubuntu:fontformat=truetype:antialias=true:pixelsize=9;1
2581font-1 = unifont:fontformat=truetype:size=8:antialias=false;0
2582font-2 = Wuncon Siji:pixelsize=10;1
2583font-3 = FontAwesome:pixelsize=10;1
2584
2585modules-left = bspwm xwindow
2586modules-center =
2587modules-right = volume filesystem mail xkeyboard memory cpu temperature date powermenu
2588
2589tray-position = right
2590tray-padding = 1
2591;tray-transparent = true
2592;tray-background = #0063ff
2593tray-maxsize = 18
2594
2595wm-restack = bspwm
2596
2597;override-redirect = true
2598
2599scroll-up = bspwm-desknext
2600scroll-down = bspwm-deskprev
2601
2602[module/xwindow]
2603type = internal/xwindow
2604label = %title:0:50:...%
2605
2606[module/xkeyboard]
2607type = internal/xkeyboard
2608blacklist-0 = num lock
2609
2610format-prefix = " "
2611format-prefix-foreground = ${colors.foreground-alt}
2612format-prefix-underline = ${colors.secondary}
2613
2614label-layout = %layout%
2615label-layout-underline = ${colors.secondary}
2616
2617label-indicator-padding = 2
2618label-indicator-margin = 1
2619label-indicator-background = ${colors.secondary}
2620label-indicator-underline = ${colors.secondary}
2621
2622[module/filesystem]
2623type = internal/fs
2624interval = 25
2625
2626mount-0 = /
2627
2628label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%%
2629label-unmounted = %mountpoint% not mounted
2630label-unmounted-foreground = ${colors.foreground-alt}
2631
2632[module/bspwm]
2633type = internal/bspwm
2634
2635label-focused = %index%
2636label-focused-background = ${colors.background-alt}
2637label-focused-underline= ${colors.primary}
2638label-focused-padding = 2
2639
2640label-occupied = %index%
2641label-occupied-padding = 2
2642
2643label-urgent = %index%!
2644label-urgent-background = ${colors.alert}
2645label-urgent-padding = 2
2646
2647label-empty = %index%
2648label-empty-foreground = ${colors.foreground-alt}
2649label-empty-padding = 2
2650
2651[module/i3]
2652type = internal/i3
2653format = <label-state> <label-mode>
2654index-sort = true
2655wrapping-scroll = false
2656
2657; Only show workspaces on the same output as the bar
2658;pin-workspaces = true
2659
2660label-mode-padding = 2
2661label-mode-foreground = #000
2662label-mode-background = ${colors.primary}
2663
2664; focused = Active workspace on focused monitor
2665label-focused = %index%
2666label-focused-background = ${module/bspwm.label-focused-background}
2667label-focused-underline = ${module/bspwm.label-focused-underline}
2668label-focused-padding = ${module/bspwm.label-focused-padding}
2669
2670; unfocused = Inactive workspace on any monitor
2671label-unfocused = %index%
2672label-unfocused-padding = ${module/bspwm.label-occupied-padding}
2673
2674; visible = Active workspace on unfocused monitor
2675label-visible = %index%
2676label-visible-background = ${self.label-focused-background}
2677label-visible-underline = ${self.label-focused-underline}
2678label-visible-padding = ${self.label-focused-padding}
2679
2680; urgent = Workspace with urgency hint set
2681label-urgent = %index%
2682label-urgent-background = ${module/bspwm.label-urgent-background}
2683label-urgent-padding = ${module/bspwm.label-urgent-padding}
2684
2685[module/mpd]
2686type = internal/mpd
2687format-online = <label-song> <icon-prev> <icon-stop> <toggle> <icon-next>
2688
2689icon-prev = 
2690icon-stop = 
2691icon-play = 
2692icon-pause = 
2693icon-next = 
2694
2695label-song-maxlen = 25
2696label-song-ellipsis = true
2697
2698[module/xbacklight]
2699type = internal/xbacklight
2700
2701format = <label> <bar>
2702label = BL
2703
2704bar-width = 10
2705bar-indicator = |
2706bar-indicator-foreground = #ff
2707bar-indicator-font = 2
2708bar-fill = ─
2709bar-fill-font = 2
2710bar-fill-foreground = #9f78e1
2711bar-empty = ─
2712bar-empty-font = 2
2713bar-empty-foreground = ${colors.foreground-alt}
2714
2715[module/backlight-acpi]
2716inherit = module/xbacklight
2717type = internal/backlight
2718;card = intel_backlight
2719card = mba6x_backlight
2720
2721[module/cpu]
2722type = internal/cpu
2723interval = 2
2724format-prefix = " "
2725format-prefix-foreground = ${colors.foreground-alt}
2726format-underline = #f90000
2727label = %percentage%%
2728
2729[module/memory]
2730type = internal/memory
2731interval = 2
2732format-prefix = " "
2733format-prefix-foreground = ${colors.foreground-alt}
2734format-underline = #4bffdc
2735label = %percentage_used%%
2736
2737[module/wlan]
2738type = internal/network
2739interface =
2740interval = 3.0
2741
2742format-connected = <ramp-signal> <label-connected>
2743format-connected-underline = #9f78e1
2744label-connected = %essid%
2745
2746format-disconnected =
2747;format-disconnected = <label-disconnected>
2748;format-disconnected-underline = ${self.format-connected-underline}
2749;label-disconnected = %ifname% disconnected
2750;label-disconnected-foreground = ${colors.foreground-alt}
2751
2752ramp-signal-0 = 
2753ramp-signal-1 = 
2754ramp-signal-2 = 
2755ramp-signal-3 = 
2756ramp-signal-4 = 
2757ramp-signal-foreground = ${colors.foreground-alt}
2758
2759[module/eth]
2760type = internal/network
2761interface =
2762interval = 3.0
2763
2764format-connected-underline = #55aa55
2765format-connected-prefix = " "
2766format-connected-prefix-foreground = ${colors.foreground-alt}
2767label-connected = %local_ip%
2768
2769format-disconnected =
2770;format-disconnected = <label-disconnected>
2771;format-disconnected-underline = ${self.format-connected-underline}
2772;label-disconnected = %ifname% disconnected
2773;label-disconnected-foreground = ${colors.foreground-alt}
2774
2775[module/date]
2776type = internal/date
2777interval = 5
2778
2779date =
2780date-alt = " %Y-%m-%d"
2781
2782time = %H:%M
2783time-alt = %H:%M:%S
2784
2785format-prefix = 
2786format-prefix-foreground = ${colors.foreground-alt}
2787format-underline = #0a6cf5
2788
2789label = %date% %time%
2790
2791[module/volume]
2792type = internal/volume
2793
2794format-volume = <label-volume> <bar-volume>
2795label-volume = vol
2796label-volume-foreground = ${root.foreground}
2797
2798format-muted-prefix = " "
2799format-muted-foreground = ${colors.foreground-alt}
2800label-muted = mute
2801
2802bar-volume-width = 10
2803bar-volume-foreground-0 = #55aa55
2804bar-volume-foreground-1 = #55aa55
2805bar-volume-foreground-2 = #55aa55
2806bar-volume-foreground-3 = #55aa55
2807bar-volume-foreground-4 = #55aa55
2808bar-volume-foreground-5 = #f5a70a
2809bar-volume-foreground-6 = #ff5555
2810bar-volume-gradient = false
2811bar-volume-indicator = |
2812bar-volume-indicator-font = 2
2813bar-volume-fill = ─
2814bar-volume-fill-font = 2
2815bar-volume-empty = ─
2816bar-volume-empty-font = 2
2817bar-volume-empty-foreground = ${colors.foreground-alt}
2818
2819[module/battery]
2820type = internal/battery
2821battery = BAT0
2822adapter = ADP1
2823full-at = 64
2824
2825format-charging = <animation-charging> <label-charging>
2826format-charging-underline = #ffb52a
2827
2828format-discharging = <ramp-capacity> <label-discharging>
2829format-discharging-underline = ${self.format-charging-underline}
2830
2831format-full-prefix = " "
2832format-full-prefix-foreground = ${colors.foreground-alt}
2833format-full-underline = ${self.format-charging-underline}
2834
2835ramp-capacity-0 = 
2836ramp-capacity-1 = 
2837ramp-capacity-2 = 
2838ramp-capacity-foreground = ${colors.foreground-alt}
2839
2840animation-charging-0 = 
2841animation-charging-1 = 
2842animation-charging-2 = 
2843animation-charging-foreground = ${colors.foreground-alt}
2844animation-charging-framerate = 750
2845
2846[module/temperature]
2847type = internal/temperature
2848thermal-zone = 1
2849warn-temperature = 66
2850
2851format = <ramp> <label>
2852format-underline = #f50a4d
2853format-warn = <ramp> <label-warn>
2854format-warn-underline = ${self.format-underline}
2855
2856label = %temperature%
2857label-warn = %temperature%
2858label-warn-foreground = ${colors.secondary}
2859
2860ramp-0 = 
2861ramp-1 = 
2862ramp-2 = 
2863ramp-foreground = ${colors.foreground-alt}
2864
2865[module/powermenu]
2866type = custom/menu
2867
2868format-spacing = 1
2869
2870label-open = 
2871label-open-foreground = ${colors.secondary}
2872label-close =  cancel
2873label-close-foreground = ${colors.secondary}
2874label-separator = |
2875label-separator-foreground = ${colors.foreground-alt}
2876
2877menu-0-0 = reboot
2878menu-0-0-exec = menu-open-1
2879menu-0-1 = power off
2880menu-0-1-exec = menu-open-2
2881
2882menu-1-0 = cancel
2883menu-1-0-exec = menu-open-0
2884menu-1-1 = reboot
2885menu-1-1-exec = sudo reboot
2886
2887menu-2-0 = power off
2888menu-2-0-exec = sudo poweroff
2889menu-2-1 = cancel
2890menu-2-1-exec = menu-open-0
2891
2892[module/mail]
2893type = custom/script
2894interval = 60
2895format = <label>
2896format-prefix = " "
2897format-prefix-foreground = ${colors.foreground-alt}
2898format-underline = #0a6cf5
2899exec = notmuch count tag:unread
2900
2901[settings]
2902screenchange-reload = true
2903;compositing-background = xor
2904;compositing-background = screen
2905;compositing-foreground = source
2906;compositing-border = over
2907
2908[global/wm]
2909margin-top = 0
2910margin-bottom = 0
2911
2912; vim:ft=dosini
2913#+end_src
2914
2915*** polybar-launch
2916:PROPERTIES:
2917:header-args+: :tangle ~/.local/bin/polybar-launch :shebang "#!/usr/bin/env sh"
2918:END:
2919
2920#+begin_src sh :tangle no
2921# Terminate already running bar instances
2922killall -q polybar
2923
2924# Wait until the processes have been shut down
2925while pgrep -x polybar >/dev/null; do sleep 1; done
2926
2927# Launch main bar
2928polybar main &
2929
2930echo "Bars launched..."
2931#+end_src
2932
2933** PowerTOP
2934:PROPERTIES:
2935:header-args+: :tangle "/sudo::/etc/systemd/system/powertop.service"
2936:END:
2937
2938#+begin_src conf
2939[Unit]
2940Description=Powertop tunings
2941
2942[Service]
2943ExecStart=/usr/bin/powertop --auto-tune
2944RemainAfterExit=true
2945
2946[Install]
2947WantedBy=multi-user.target
2948#+end_src
2949
2950** ranger
2951
2952*** rc.conf
2953:PROPERTIES:
2954:header-args+: :tangle ~/.config/ranger/rc.conf
2955:END:
2956
2957#+begin_src conf :tangle no
2958# ===================================================================
2959# This file contains the default startup commands for ranger.
2960# To change them, it is recommended to create the file
2961# ~/.config/ranger/rc.conf and add your custom commands there.
2962#
2963# If you copy this whole file there, you may want to set the environment
2964# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
2965#
2966# The purpose of this file is mainly to define keybindings and settings.
2967# For running more complex python code, please create a plugin in "plugins/" or
2968# a command in "commands.py".
2969#
2970# Each line is a command that will be run before the user interface
2971# is initialized. As a result, you can not use commands which rely
2972# on the UI such as :delete or :mark.
2973# ===================================================================
2974
2975# ===================================================================
2976# == Options
2977# ===================================================================
2978
2979# How many columns are there, and what are their relative widths?
2980set column_ratios 1,3,4
2981
2982# Which files should be hidden? (regular expression)
2983set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
2984
2985# Show hidden files? You can toggle this by typing 'zh'
2986set show_hidden false
2987
2988# Ask for a confirmation when running the "delete" command?
2989# Valid values are "always" (default), "never", "multiple"
2990# With "multiple", ranger will ask only if you delete multiple files at once.
2991set confirm_on_delete multiple
2992
2993# Which script is used to generate file previews?
2994# ranger ships with scope.sh, a script that calls external programs (see
2995# README for dependencies) to preview images, archives, etc.
2996set preview_script ~/.config/ranger/scope.sh
2997
2998# Use the external preview script or display simple plain text previews?
2999set use_preview_script true
3000
3001# Open all images in this directory when running certain image viewers
3002# like feh or sxiv? You can still open selected files by marking them.
3003set open_all_images true
3004
3005# Be aware of version control systems and display information.
3006set vcs_aware false
3007
3008# State of the three backends git, hg, bzr. The possible states are
3009# disabled, local (only show local info), enabled (show local and remote
3010# information).
3011set vcs_backend_git enabled
3012set vcs_backend_hg disabled
3013set vcs_backend_bzr disabled
3014
3015# Preview images in full color with the external command "w3mimgpreview"?
3016# This requires the console web browser "w3m" and a supported terminal.
3017# It has been successfully tested with "xterm" and "urxvt" without tmux.
3018set preview_images true
3019
3020# Use a unicode "..." character to mark cut-off filenames?
3021set unicode_ellipsis false
3022
3023# Show dotfiles in the bookmark preview box?
3024set show_hidden_bookmarks true
3025
3026# Which colorscheme to use? These colorschemes are available by default:
3027# default, jungle, snow
3028set colorscheme default
3029
3030# Preview files on the rightmost column?
3031# And collapse (shrink) the last column if there is nothing to preview?
3032set preview_files true
3033set preview_directories true
3034set collapse_preview true
3035
3036# Save the console history on exit?
3037set save_console_history true
3038
3039# Draw the status bar on top of the browser window (default: bottom)
3040set status_bar_on_top false
3041
3042# Draw a progress bar in the status bar which displays the average state of all
3043# currently running tasks which support progress bars?
3044set draw_progress_bar_in_status_bar true
3045
3046# Draw borders around columns?
3047set draw_borders true
3048
3049# Display the directory name in tabs?
3050set dirname_in_tabs false
3051
3052# Enable the mouse support?
3053set mouse_enabled true
3054
3055# Display the file size in the main column or status bar?
3056set display_size_in_main_column true
3057set display_size_in_status_bar true
3058
3059# Display files tags in all columns or only in main column?
3060set display_tags_in_all_columns true
3061
3062# Set a title for the window?
3063set update_title false
3064
3065# Set the title to "ranger" in the tmux program?
3066set update_tmux_title false
3067
3068# Shorten the title if it gets long? The number defines how many
3069# directories are displayed at once, 0 turns off this feature.
3070set shorten_title 3
3071
3072# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
3073set tilde_in_titlebar false
3074
3075# How many directory-changes or console-commands should be kept in history?
3076set max_history_size 20
3077set max_console_history_size 50
3078
3079# Try to keep so much space between the top/bottom border when scrolling:
3080set scroll_offset 8
3081
3082# Flush the input after each key hit? (Noticable when ranger lags)
3083set flushinput true
3084
3085# Padding on the right when there's no preview?
3086# This allows you to click into the space to run the file.
3087set padding_right true
3088
3089# Save bookmarks (used with mX and `X) instantly?
3090# This helps to synchronize bookmarks between multiple ranger
3091# instances but leads to *slight* performance loss.
3092# When false, bookmarks are saved when ranger is exited.
3093set autosave_bookmarks true
3094
3095# You can display the "real" cumulative size of directories by using the
3096# command :get_cumulative_size or typing "dc". The size is expensive to
3097# calculate and will not be updated automatically. You can choose
3098# to update it automatically though by turning on this option:
3099set autoupdate_cumulative_size false
3100
3101# Turning this on makes sense for screen readers:
3102set show_cursor false
3103
3104# One of: size, basename, mtime, type
3105set sort natural
3106
3107# Additional sorting options
3108set sort_reverse false
3109set sort_case_insensitive true
3110set sort_directories_first true
3111
3112# Enable this if key combinations with the Alt Key don't work for you.
3113# (Especially on xterm)
3114set xterm_alt_key false
3115
3116# ===================================================================
3117# == Local Options
3118# ===================================================================
3119# You can set local options that only affect a single directory.
3120
3121# Examples:
3122# setlocal path=~/downloads sort mtime
3123
3124# ===================================================================
3125# == Command Aliases in the Console
3126# ===================================================================
3127
3128alias e edit
3129alias q quit
3130alias q! quitall
3131alias qall quitall
3132alias setl setlocal
3133
3134alias filter scout -prt
3135alias find scout -aet
3136alias mark scout -mr
3137alias unmark scout -Mr
3138alias search scout -rs
3139alias search_inc scout -rts
3140alias travel scout -aefiklst
3141
3142# ===================================================================
3143# == Define keys for the browser
3144# ===================================================================
3145
3146# Basic
3147map Q quit!
3148map q quit
3149copymap q ZZ ZQ
3150
3151map R reload_cwd
3152map <C-r> reset
3153map <C-l> redraw_window
3154map <C-c> abort
3155map <esc> change_mode normal
3156
3157map i display_file
3158map ? help
3159map W display_log
3160map w taskview_open
3161map S shell $SHELL
3162
3163map : console
3164map ; console
3165map ! console shell
3166map @ console -p6 shell %%s
3167map # console shell -p
3168map s console shell
3169map r chain draw_possible_programs; console open_with
3170map f console find
3171map cd console cd
3172
3173# Tagging / Marking
3174map t tag_toggle
3175map ut tag_remove
3176map "<any> tag_toggle tag=%any
3177map <Space> mark_files toggle=True
3178map v mark_files all=True toggle=True
3179map uv mark_files all=True val=False
3180map V toggle_visual_mode
3181map uV toggle_visual_mode reverse=True
3182
3183# For the nostalgics: Midnight Commander bindings
3184map <F1> help
3185map <F3> display_file
3186map <F4> edit
3187map <F5> copy
3188map <F6> cut
3189map <F7> console mkdir
3190map <F8> console delete
3191map <F10> exit
3192
3193# In case you work on a keyboard with dvorak layout
3194map <UP> move up=1
3195map <DOWN> move down=1
3196map <LEFT> move left=1
3197map <RIGHT> move right=1
3198map <HOME> move to=0
3199map <END> move to=-1
3200map <PAGEDOWN> move down=1 pages=True
3201map <PAGEUP> move up=1 pages=True
3202map <CR> move right=1
3203map <DELETE> console delete
3204map <INSERT> console touch
3205
3206# VIM-like
3207copymap <UP> k
3208copymap <DOWN> j
3209copymap <LEFT> h
3210copymap <RIGHT> l
3211copymap <HOME> gg
3212copymap <END> G
3213copymap <PAGEDOWN> <C-F>
3214copymap <PAGEUP> <C-B>
3215
3216map J move down=0.5 pages=True
3217map K move up=0.5 pages=True
3218copymap J <C-D>
3219copymap K <C-U>
3220
3221# Jumping around
3222map H history_go -1
3223map L history_go 1
3224map ] move_parent 1
3225map [ move_parent -1
3226map } traverse
3227
3228map gh cd ~
3229map ge cd /etc
3230map gu cd /usr
3231map gd cd /dev
3232map gl cd -r .
3233map gL cd -r %f
3234map go cd /opt
3235map gv cd /var
3236map gm cd /media
3237map gM cd /mnt
3238map gs cd /srv
3239map gr cd /
3240map gR eval fm.cd(ranger.RANGERDIR)
3241map g/ cd /
3242map g? cd /usr/share/doc/ranger
3243
3244# External Programs
3245map E edit
3246map du shell -p du --max-depth=1 -h --apparent-size
3247map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
3248map yp shell -d echo -n %d/%f | xsel -i
3249map yd shell -d echo -n %d | xsel -i
3250map yn shell -d echo -n %f | xsel -i
3251
3252# Filesystem Operations
3253map = chmod
3254
3255map cw console rename
3256map A eval fm.open_console('rename ' + fm.thisfile.basename)
3257map I eval fm.open_console('rename ' + fm.thisfile.basename, position=7)
3258
3259map pp paste
3260map po paste overwrite=True
3261map pl paste_symlink relative=False
3262map pL paste_symlink relative=True
3263map phl paste_hardlink
3264map pht paste_hardlinked_subtree
3265
3266map dd cut
3267map ud uncut
3268map da cut mode=add
3269map dr cut mode=remove
3270
3271map yy copy
3272map uy uncut
3273map ya copy mode=add
3274map yr copy mode=remove
3275
3276# Temporary workarounds
3277map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
3278map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
3279map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
3280map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
3281map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
3282map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
3283map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
3284map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
3285
3286# Searching
3287map / console search
3288map n search_next
3289map N search_next forward=False
3290map ct search_next order=tag
3291map cs search_next order=size
3292map ci search_next order=mimetype
3293map cc search_next order=ctime
3294map cm search_next order=mtime
3295map ca search_next order=atime
3296
3297# Tabs
3298map <C-n> tab_new ~
3299map <C-w> tab_close
3300map <TAB> tab_move 1
3301map <S-TAB> tab_move -1
3302map <A-Right> tab_move 1
3303map <A-Left> tab_move -1
3304map gt tab_move 1
3305map gT tab_move -1
3306map gn tab_new ~
3307map gc tab_close
3308map uq tab_restore
3309map <a-1> tab_open 1
3310map <a-2> tab_open 2
3311map <a-3> tab_open 3
3312map <a-4> tab_open 4
3313map <a-5> tab_open 5
3314map <a-6> tab_open 6
3315map <a-7> tab_open 7
3316map <a-8> tab_open 8
3317map <a-9> tab_open 9
3318
3319# Sorting
3320map or toggle_option sort_reverse
3321map os chain set sort=size; set sort_reverse=False
3322map ob chain set sort=basename; set sort_reverse=False
3323map on chain set sort=natural; set sort_reverse=False
3324map om chain set sort=mtime; set sort_reverse=False
3325map oc chain set sort=ctime; set sort_reverse=False
3326map oa chain set sort=atime; set sort_reverse=False
3327map ot chain set sort=type; set sort_reverse=False
3328
3329map oS chain set sort=size; set sort_reverse=True
3330map oB chain set sort=basename; set sort_reverse=True
3331map oN chain set sort=natural; set sort_reverse=True
3332map oM chain set sort=mtime; set sort_reverse=True
3333map oC chain set sort=ctime; set sort_reverse=True
3334map oA chain set sort=atime; set sort_reverse=True
3335map oT chain set sort=type; set sort_reverse=True
3336
3337map dc get_cumulative_size
3338
3339# Settings
3340map zc toggle_option collapse_preview
3341map zd toggle_option sort_directories_first
3342map zh toggle_option show_hidden
3343map <C-h> toggle_option show_hidden
3344map zi toggle_option flushinput
3345map zm toggle_option mouse_enabled
3346map zp toggle_option preview_files
3347map zP toggle_option preview_directories
3348map zs toggle_option sort_case_insensitive
3349map zu toggle_option autoupdate_cumulative_size
3350map zv toggle_option use_preview_script
3351map zf console filter
3352
3353# Bookmarks
3354map `<any> enter_bookmark %any
3355map '<any> enter_bookmark %any
3356map m<any> set_bookmark %any
3357map um<any> unset_bookmark %any
3358
3359map m<bg> draw_bookmarks
3360copymap m<bg> um<bg> `<bg> '<bg>
3361
3362# Generate all the chmod bindings with some python help:
3363eval for arg in "rwxXst": cmd("map +u{0} shell -d chmod u+{0} %s".format(arg))
3364eval for arg in "rwxXst": cmd("map +g{0} shell -d chmod g+{0} %s".format(arg))
3365eval for arg in "rwxXst": cmd("map +o{0} shell -d chmod o+{0} %s".format(arg))
3366eval for arg in "rwxXst": cmd("map +a{0} shell -d chmod a+{0} %s".format(arg))
3367eval for arg in "rwxXst": cmd("map +{0} shell -d chmod u+{0} %s".format(arg))
3368
3369eval for arg in "rwxXst": cmd("map -u{0} shell -d chmod u-{0} %s".format(arg))
3370eval for arg in "rwxXst": cmd("map -g{0} shell -d chmod g-{0} %s".format(arg))
3371eval for arg in "rwxXst": cmd("map -o{0} shell -d chmod o-{0} %s".format(arg))
3372eval for arg in "rwxXst": cmd("map -a{0} shell -d chmod a-{0} %s".format(arg))
3373eval for arg in "rwxXst": cmd("map -{0} shell -d chmod u-{0} %s".format(arg))
3374
3375# ===================================================================
3376# == Define keys for the console
3377# ===================================================================
3378# Note: Unmapped keys are passed directly to the console.
3379
3380# Basic
3381cmap <tab> eval fm.ui.console.tab()
3382cmap <s-tab> eval fm.ui.console.tab(-1)
3383cmap <ESC> eval fm.ui.console.close()
3384cmap <CR> eval fm.ui.console.execute()
3385cmap <C-l> redraw_window
3386
3387copycmap <ESC> <C-c>
3388copycmap <CR> <C-j>
3389
3390# Move around
3391cmap <up> eval fm.ui.console.history_move(-1)
3392cmap <down> eval fm.ui.console.history_move(1)
3393cmap <left> eval fm.ui.console.move(left=1)
3394cmap <right> eval fm.ui.console.move(right=1)
3395cmap <home> eval fm.ui.console.move(right=0, absolute=True)
3396cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
3397
3398# Line Editing
3399cmap <backspace> eval fm.ui.console.delete(-1)
3400cmap <delete> eval fm.ui.console.delete(0)
3401cmap <C-w> eval fm.ui.console.delete_word()
3402cmap <C-k> eval fm.ui.console.delete_rest(1)
3403cmap <C-u> eval fm.ui.console.delete_rest(-1)
3404cmap <C-y> eval fm.ui.console.paste()
3405
3406# And of course the emacs way
3407copycmap <up> <C-p>
3408copycmap <down> <C-n>
3409copycmap <left> <C-b>
3410copycmap <right> <C-f>
3411copycmap <home> <C-a>
3412copycmap <end> <C-e>
3413copycmap <delete> <C-d>
3414copycmap <backspace> <C-h>
3415
3416# Note: There are multiple ways to express backspaces. <backspace> (code 263)
3417# and <backspace2> (code 127). To be sure, use both.
3418copycmap <backspace> <backspace2>
3419
3420# This special expression allows typing in numerals:
3421cmap <allow_quantifiers> false
3422
3423# ===================================================================
3424# == Pager Keybindings
3425# ===================================================================
3426
3427# Movement
3428pmap <down> pager_move down=1
3429pmap <up> pager_move up=1
3430pmap <left> pager_move left=4
3431pmap <right> pager_move right=4
3432pmap <home> pager_move to=0
3433pmap <end> pager_move to=-1
3434pmap <pagedown> pager_move down=1.0 pages=True
3435pmap <pageup> pager_move up=1.0 pages=True
3436pmap <C-d> pager_move down=0.5 pages=True
3437pmap <C-u> pager_move up=0.5 pages=True
3438
3439copypmap <UP> k <C-p>
3440copypmap <DOWN> j <C-n> <CR>
3441copypmap <LEFT> h
3442copypmap <RIGHT> l
3443copypmap <HOME> g
3444copypmap <END> G
3445copypmap <C-d> d
3446copypmap <C-u> u
3447copypmap <PAGEDOWN> n f <C-F> <Space>
3448copypmap <PAGEUP> p b <C-B>
3449
3450# Basic
3451pmap <ESC> pager_close
3452copypmap <ESC> q Q i <F3>
3453pmap E edit_file
3454
3455# ===================================================================
3456# == Taskview Keybindings
3457# ===================================================================
3458
3459# Movement
3460tmap <up> taskview_move up=1
3461tmap <down> taskview_move down=1
3462tmap <home> taskview_move to=0
3463tmap <end> taskview_move to=-1
3464tmap <pagedown> taskview_move down=1.0 pages=True
3465tmap <pageup> taskview_move up=1.0 pages=True
3466tmap <C-d> taskview_move down=0.5 pages=True
3467tmap <C-u> taskview_move up=0.5 pages=True
3468
3469copytmap <UP> k <C-p>
3470copytmap <DOWN> j <C-n> <CR>
3471copytmap <HOME> g
3472copytmap <END> G
3473copytmap <C-u> u
3474copytmap <PAGEDOWN> n f <C-F> <Space>
3475copytmap <PAGEUP> p b <C-B>
3476
3477# Changing priority and deleting tasks
3478tmap J eval -q fm.ui.taskview.task_move(-1)
3479tmap K eval -q fm.ui.taskview.task_move(0)
3480tmap dd eval -q fm.ui.taskview.task_remove()
3481tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
3482tmap <pageup> eval -q fm.ui.taskview.task_move(0)
3483tmap <delete> eval -q fm.ui.taskview.task_remove()
3484
3485# Basic
3486tmap <ESC> taskview_close
3487copytmap <ESC> q Q w <C-c>
3488#+end_src
3489
3490*** scope.sh
3491:PROPERTIES:
3492:header-args+: :tangle ~/.config/ranger/scope.sh :shebang "#!/usr/bin/env sh"
3493:END:
3494
3495#+begin_src sh :tangle no
3496# ranger supports enhanced previews. If the option "use_preview_script"
3497# is set to True and this file exists, this script will be called and its
3498# output is displayed in ranger. ANSI color codes are supported.
3499
3500# NOTES: This script is considered a configuration file. If you upgrade
3501# ranger, it will be left untouched. (You must update it yourself.)
3502# Also, ranger disables STDIN here, so interactive scripts won't work properly
3503
3504# Meanings of exit codes:
3505# code | meaning | action of ranger
3506# -----+------------+-------------------------------------------
3507# 0 | success | success. display stdout as preview
3508# 1 | no preview | failure. display no preview at all
3509# 2 | plain text | display the plain content of the file
3510# 3 | fix width | success. Don't reload when width changes
3511# 4 | fix height | success. Don't reload when height changes
3512# 5 | fix both | success. Don't ever reload
3513
3514# Meaningful aliases for arguments:
3515path="$1" # Full path of the selected file
3516width="$2" # Width of the preview pane (number of fitting characters)
3517height="$3" # Height of the preview pane (number of fitting characters)
3518
3519maxln=200 # Stop after $maxln lines. Can be used like ls | head -n $maxln
3520
3521# Find out something about the file:
3522mimetype=$(file --mime-type -Lb "$path")
3523extension=${path##*.}
3524
3525# Functions:
3526# runs a command and saves its output into $output. Useful if you need
3527# the return value AND want to use the output in a pipe
3528try() { output=$(eval '"$@"'); }
3529
3530# writes the output of the previouosly used "try" command
3531dump() { echo "$output"; }
3532
3533# a common post-processing function used after most commands
3534trim() { head -n "$maxln"; }
3535
3536# wraps highlight to treat exit code 141 (killed by SIGPIPE) as success
3537highlight() { command highlight "$@"; test $? = 0 -o $? = 141; }
3538
3539case "$extension" in
3540 # Archive extensions:
3541 7z|a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
3542 rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
3543 try als "$path" && { dump | trim; exit 0; }
3544 try acat "$path" && { dump | trim; exit 3; }
3545 try bsdtar -lf "$path" && { dump | trim; exit 0; }
3546 exit 1;;
3547 rar)
3548 try unrar -p- lt "$path" && { dump | trim; exit 0; } || exit 1;;
3549 # PDF documents:
3550 pdf)
3551 try pdftotext -l 10 -nopgbrk -q "$path" - && \
3552 { dump | trim | fmt -s -w $width; exit 0; } || exit 1;;
3553 # BitTorrent Files
3554 torrent)
3555 try transmission-show "$path" && { dump | trim; exit 5; } || exit 1;;
3556 # HTML Pages:
3557 htm|html|xhtml)
3558 try w3m -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
3559 try lynx -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
3560 try elinks -dump "$path" && { dump | trim | fmt -s -w $width; exit 4; }
3561 ;; # fall back to highlight/cat if the text browsers fail
3562esac
3563
3564case "$mimetype" in
3565 # Syntax highlight for text files:
3566 text/* | */xml)
3567 try highlight --out-format=ansi "$path" && { dump | trim; exit 5; } || exit 2;;
3568 # Ascii-previews of images:
3569 image/*)
3570 img2txt --gamma=0.6 --width="$width" "$path" && exit 4 || exit 1;;
3571 # Display information about media files:
3572 video/* | audio/*)
3573 exiftool "$path" && exit 5
3574 # Use sed to remove spaces so the output fits into the narrow window
3575 try mediainfo "$path" && { dump | trim | sed 's/ \+:/: /;'; exit 5; } || exit 1;;
3576esac
3577
3578exit 1
3579#+end_src
3580
3581** redshift
3582:PROPERTIES:
3583:header-args+: :tangle ~/.config/redshift.conf :comments none
3584:END:
3585
3586#+begin_src conf
3587; Global settings for redshift
3588[redshift]
3589; Set the day and night screen temperatures (Neutral is 6500K)
3590;temp-day=5700
3591;temp-night=3500
3592
3593;temp-day=6500
3594temp-day=6200
3595;temp-night=4800
3596;temp-night=5000
3597;temp-night=4500
3598temp-night=4000
3599
3600; Enable/Disable a smooth transition between day and night
3601; 0 will cause a direct change from day to night screen temperature.
3602; 1 will gradually increase or decrease the screen temperature.
3603transition=1
3604
3605; Set the screen brightness. Default is 1.0.
3606;brightness=0.9
3607; It is also possible to use different settings for day and night
3608; since version 1.8.
3609;brightness-day=0.7
3610;brightness-night=0.4
3611; Set the screen gamma (for all colors, or each color channel
3612; individually)
3613;gamma=0.8
3614;gamma=1.0
3615;gamma=0.8:0.7:0.8
3616; This can also be set individually for day and night since
3617; version 1.10.
3618;gamma-day=0.8:0.7:0.8
3619;gamma-night=0.6
3620
3621; Set the location-provider: 'geoclue2' or 'manual'
3622; type 'redshift -l list' to see possible values.
3623; The location provider settings are in a different section.
3624;location-provider=manual
3625location-provider=geoclue2
3626
3627; Set the adjustment-method: 'randr', 'vidmode'
3628; type 'redshift -m list' to see all possible values.
3629; 'randr' is the preferred method, 'vidmode' is an older API.
3630; but works in some cases when 'randr' does not.
3631; The adjustment method settings are in a different section.
3632adjustment-method=randr
3633
3634; Configuration of the location-provider:
3635; type 'redshift -l PROVIDER:help' to see the settings.
3636; ex: 'redshift -l manual:help'
3637; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
3638; are negative numbers.
3639;[manual]
3640;lat=48.1
3641;lon=11.6
3642
3643; Configuration of the adjustment-method
3644; type 'redshift -m METHOD:help' to see the settings.
3645; ex: 'redshift -m randr:help'
3646; In this example, randr is configured to adjust screen 1.
3647; Note that the numbering starts from 0, so this is actually the
3648; second screen. If this option is not specified, Redshift will try
3649; to adjust _all_ screens.
3650;[randr]
3651;screen=1
3652#+end_src
3653
3654** rofi
3655:PROPERTIES:
3656:header-args+: :tangle ~/.config/rofi/config
3657:END:
3658
3659#+begin_src conf
3660rofi.font: Ubuntu Mono 13
3661! rofi.font: Inconsolata 16
3662! rofi.font: Iosevka 13
3663! rofi.font: Source Code Pro 11
3664rofi.modi: run,window
3665! rofi.width: 640
3666rofi.width: 600
3667!rofi.location: 2
3668!rofi.yoffset: 200
3669rofi.monitor: -1
3670!rofi.lines: 10
3671
3672!rofi.theme: /usr/share/rofi/themes//Arc.rasi
3673!rofi.theme: /usr/share/rofi/themes//Paper.rasi
3674!rofi.theme: /usr/share/rofi/themes//sidebar.rasi
3675
3676rofi.theme: /usr/share/rofi/themes//gruvbox-light.rasi
3677#+end_src
3678
3679** rofi-pass
3680:PROPERTIES:
3681:header-args+: :tangle ~/.config/rofi-pass/config
3682:END:
3683
3684#+begin_src conf
3685# permanently set alternative root dir
3686# root=/path/to/root
3687
3688# rofi command. Make sure to have "$@" as last argument
3689_rofi () {
3690 #rofi -no-auto-select -kb-accept-entry "!Return" -i -no-levenshtein-sort "$@"
3691 rofi -i -no-auto-select -kb-accept-entry "!Return" "$@"
3692}
3693
3694# xdotool needs the keyboard layout to be set using setxkbmap
3695# You can do this in your autostart scripts (e.g. xinitrc)
3696
3697# If for some reason, you cannot do this, you can set the command here.
3698# and set fix_layout to true
3699fix_layout=false
3700
3701layout_cmd () {
3702 setxkbmap us
3703}
3704
3705# fields to be used
3706URL_field='url'
3707USERNAME_field='user'
3708AUTOTYPE_field='autotype'
3709
3710# delay to be used for :delay keyword
3711delay=2
3712
3713## Programs to be used
3714# Editor
3715EDITOR='gvim -f'
3716
3717# Browser
3718BROWSER='chromium'
3719
3720## Misc settings
3721
3722default_do='menu' # menu, autotype, copyPass, typeUser, typePass, copyUser, copyUrl, viewEntry, typeMenu, actionMenu, copyMenu, openUrl
3723auto_enter='false'
3724notify='false'
3725default_autotype='user :tab pass'
3726
3727# color of the help messages
3728# leave empty for autodetection
3729help_color="#4872FF"
3730
3731# Clipboard settings
3732# Possible options: primary, clipboard, both
3733clip=primary
3734
3735# Options for generating new password entries
3736# default_user is also used for password files that have no user field.
3737default_user=aminb
3738default_user2=aminban
3739password_length=30
3740
3741# Custom Keybindings
3742#autotype="Alt+1"
3743autotype="Alt+m"
3744type_user="Alt+2"
3745type_pass="Alt+3"
3746open_url="Alt+4"
3747copy_name="Alt+u"
3748copy_url="Alt+l"
3749copy_pass="Alt+p"
3750show="Alt+o"
3751copy_entry="Alt+2"
3752type_entry="Alt+1"
3753copy_menu="Alt+c"
3754action_menu="Alt+a"
3755type_menu="Alt+t"
3756help="Alt+h"
3757switch="Alt+x"
3758insert_pass="Alt+n"
3759#+end_src
3760
3761** sway
3762:PROPERTIES:
3763:header-args+: :tangle ~/.config/sway/config
3764:END:
3765
3766#+begin_src conf
3767exec xrdb .Xresources
3768exec dunst
3769### Variables
3770# super
3771set $mod Mod4
3772# alt
3773set $mod2 Mod1
3774set $left h
3775set $down j
3776set $up k
3777set $right l
3778set $term urxvt
3779set $menu rofi -show run -display-run '> ' -display-window ' 🗔 '
3780
3781### Output configuration
3782#
3783# Default wallpaper (more resolutions are available in __DATADIR__/backgrounds/sway/)
3784output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
3785#
3786# Example configuration:
3787#
3788# output HDMI-A-1 resolution 1920x1080 position 1920,0
3789#
3790# You can get the names of your outputs by running: swaymsg -t get_outputs
3791
3792### Idle configuration
3793#
3794# Example configuration:
3795#
3796#exec swayidle \
3797# timeout 300 'swaylock -c 000000' \
3798# timeout 600 'swaymsg "output * dpms off"' \
3799# resume 'swaymsg "output * dpms on"' \
3800# before-sleep 'swaylock -c 000000'
3801#
3802# This will lock your screen after 300 seconds of inactivity, then turn off
3803# your displays after another 600 seconds, and turn your screens back on when
3804# resumed. It will also lock your screen before your computer goes to sleep.
3805
3806### Input configuration
3807
3808input "1739:31251:DLL07BE:01_06CB:7A13_Touchpad" {
3809 dwt enabled
3810 tap enabled
3811 natural_scroll enabled
3812 middle_emulation enabled
3813 click_method clickfinger
3814}
3815
3816input "1:1:AT_Translated_Set_2_keyboard" {
3817 repeat_delay 200
3818 repeat_rate 45
3819 xkb_layout us,ir
3820 xkb_options ctrl:nocaps,altwin:swap_alt_win,ctrl:rctrl_ralt,grp:shifts_toggle
3821}
3822
3823
3824### Key bindings
3825#
3826# Basics:
3827#
3828 # start a terminal
3829 bindsym $mod+Return exec $term
3830
3831 # kill focused window
3832 bindsym $mod+Shift+q kill
3833
3834 # start your launcher
3835 bindsym $mod+d exec $menu
3836
3837 # password manager
3838 bindsym $mod2+space exec rofi-pass
3839
3840 # Drag floating windows by holding down $mod and left mouse button.
3841 # Resize them with right mouse button + $mod.
3842 # Despite the name, also works for non-floating windows.
3843 # Change normal to inverse to use left mouse button for resizing and right
3844 # mouse button for dragging.
3845 floating_modifier $mod normal
3846
3847 # reload the configuration file
3848 bindsym $mod+Shift+c reload
3849
3850 # exit sway (logs you out of your wayland session)
3851 bindsym $mod+Shift+e exit
3852
3853 bindsym $mod+apostrophe exec rofi-light # rofi-based brightness chooser
3854 bindsym XF86MonBrightnessUp exec light -A 5 # increase screen brightness
3855 bindsym XF86MonBrightnessDown exec light -U 5 # decrease screen brightness
3856
3857 bindsym XF86AudioRaiseVolume exec pamixer --allow-boost --increase 5
3858 bindsym XF86AudioLowerVolume exec pamixer --allow-boost --decrease 5
3859 bindsym XF86AudioMute exec pamixer --toggle-mute
3860 bindsym XF86AudioMicMute exec pactl set-source-mute 1 toggle
3861
3862 # original sway workspace switch and window move
3863 bindsym $mod+bracketleft workspace prev
3864 bindsym $mod+bracketright workspace next
3865 bindsym $mod+braceleft move container to workspace prev
3866 bindsym $mod+braceright move container to workspace next
3867
3868 # bspwm-esque workspace switch and window move
3869 bindsym $mod2+bracketleft exec sway-ws-util switch prev
3870 bindsym $mod2+bracketright exec sway-ws-util switch next
3871 bindsym $mod2+braceleft exec sway-ws-util move prev follow
3872 bindsym $mod2+braceright exec sway-ws-util move next follow
3873#
3874# Moving around:
3875#
3876 # Move your focus around
3877 bindsym $mod+$left focus left
3878 bindsym $mod+$down focus down
3879 bindsym $mod+$up focus up
3880 bindsym $mod+$right focus right
3881 # or use $mod+[up|down|left|right]
3882 bindsym $mod+Left focus left
3883 bindsym $mod+Down focus down
3884 bindsym $mod+Up focus up
3885 bindsym $mod+Right focus right
3886
3887 # _move_ the focused window with the same, but add Shift
3888 bindsym $mod+Shift+$left move left
3889 bindsym $mod+Shift+$down move down
3890 bindsym $mod+Shift+$up move up
3891 bindsym $mod+Shift+$right move right
3892 # ditto, with arrow keys
3893 bindsym $mod+Shift+Left move left
3894 bindsym $mod+Shift+Down move down
3895 bindsym $mod+Shift+Up move up
3896 bindsym $mod+Shift+Right move right
3897#
3898# Workspaces:
3899#
3900 # switch to workspace
3901 bindsym $mod+1 workspace 1
3902 bindsym $mod+2 workspace 2
3903 bindsym $mod+3 workspace 3
3904 bindsym $mod+4 workspace 4
3905 bindsym $mod+5 workspace 5
3906 bindsym $mod+6 workspace 6
3907 bindsym $mod+7 workspace 7
3908 bindsym $mod+8 workspace 8
3909 bindsym $mod+9 workspace 9
3910 bindsym $mod+0 workspace 10
3911 # move focused container to workspace
3912 bindsym $mod+Shift+1 move container to workspace 1
3913 bindsym $mod+Shift+2 move container to workspace 2
3914 bindsym $mod+Shift+3 move container to workspace 3
3915 bindsym $mod+Shift+4 move container to workspace 4
3916 bindsym $mod+Shift+5 move container to workspace 5
3917 bindsym $mod+Shift+6 move container to workspace 6
3918 bindsym $mod+Shift+7 move container to workspace 7
3919 bindsym $mod+Shift+8 move container to workspace 8
3920 bindsym $mod+Shift+9 move container to workspace 9
3921 bindsym $mod+Shift+0 move container to workspace 10
3922 # Note: workspaces can have any name you want, not just numbers.
3923 # We just use 1-10 as the default.
3924#
3925# Layout stuff:
3926#
3927 # You can "split" the current object of your focus with
3928 # $mod+b or $mod+v, for horizontal and vertical splits
3929 # respectively.
3930 bindsym $mod+b splith
3931 bindsym $mod+v splitv
3932
3933 # Switch the current container between different layout styles
3934 bindsym $mod+s layout stacking
3935 bindsym $mod+w layout tabbed
3936 bindsym $mod+e layout toggle split
3937
3938 # Make the current focus fullscreen
3939 bindsym $mod+f fullscreen
3940
3941 # Toggle the current focus between tiling and floating mode
3942 bindsym $mod+Shift+space floating toggle
3943
3944 # Swap focus between the tiling area and the floating area
3945 bindsym $mod+space focus mode_toggle
3946
3947 # move focus to the parent container
3948 bindsym $mod+a focus parent
3949#
3950# Scratchpad:
3951#
3952 # Sway has a "scratchpad", which is a bag of holding for windows.
3953 # You can send windows there and get them back later.
3954
3955 # Move the currently focused window to the scratchpad
3956 bindsym $mod+Shift+minus move scratchpad
3957
3958 # Show the next scratchpad window or hide the focused scratchpad window.
3959 # If there are multiple scratchpad windows, this command cycles through them.
3960 bindsym $mod+minus scratchpad show
3961#
3962# Resizing containers:
3963#
3964mode "resize" {
3965 # left will shrink the containers width
3966 # right will grow the containers width
3967 # up will shrink the containers height
3968 # down will grow the containers height
3969 bindsym $left resize shrink width 10px
3970 bindsym $down resize grow height 10px
3971 bindsym $up resize shrink height 10px
3972 bindsym $right resize grow width 10px
3973
3974 # ditto, with arrow keys
3975 bindsym Left resize shrink width 10px
3976 bindsym Down resize grow height 10px
3977 bindsym Up resize shrink height 10px
3978 bindsym Right resize grow width 10px
3979
3980 # return to default mode
3981 bindsym Return mode "default"
3982 bindsym Escape mode "default"
3983}
3984bindsym $mod+Shift+r mode "resize"
3985
3986#
3987# Status Bar:
3988#
3989# Read `man 5 sway-bar` for more information about this section.
3990bar {
3991 position bottom
3992 colors {
3993 statusline #ffffff
3994 background #323232
3995 inactive_workspace #32323200 #32323200 #5c5c5c
3996 }
3997 status_command i3status
3998}
3999
4000include /etc/sway/config.d/*
4001#+end_src
4002
4003** TLP
4004
4005*** TODO enigma
4006*** archy
4007
4008#+begin_src conf :tangle (when (and (eq system-type 'gnu/linux) (string= (system-name) "archy")) "/sudo::/etc/default/tlp")
4009# ------------------------------------------------------------------------------
4010# tlp - Parameters for power saving
4011# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html
4012
4013# Hint: some features are disabled by default, remove the leading # to enable
4014# them.
4015
4016# Set to 0 to disable, 1 to enable TLP.
4017TLP_ENABLE=1
4018
4019# Operation mode when no power supply can be detected: AC, BAT.
4020# Concerns some desktop and embedded hardware only.
4021TLP_DEFAULT_MODE=AC
4022
4023# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
4024# Hint: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
4025TLP_PERSISTENT_DEFAULT=0
4026
4027# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
4028# Non-zero value enables, zero disables laptop mode.
4029DISK_IDLE_SECS_ON_AC=0
4030DISK_IDLE_SECS_ON_BAT=2
4031
4032# Dirty page values (timeouts in secs).
4033MAX_LOST_WORK_SECS_ON_AC=15
4034MAX_LOST_WORK_SECS_ON_BAT=60
4035
4036# Hint: CPU parameters below are disabled by default, remove the leading #
4037# to enable them, otherwise kernel default values are used.
4038
4039# Select a CPU frequency scaling governor.
4040# Intel Core i processor with intel_pstate driver:
4041# powersave(*), performance.
4042# Older hardware with acpi-cpufreq driver:
4043# ondemand(*), powersave, performance, conservative, schedutil.
4044# (*) is recommended.
4045# Hint: use tlp-stat -p to show the active driver and available governors.
4046# Important:
4047# powersave for intel_pstate and ondemand for acpi-cpufreq are power
4048# efficient for *almost all* workloads and therefore kernel and most
4049# distributions have chosen them as defaults. If you still want to change,
4050# you should know what you're doing! You *must* disable your distribution's
4051# governor settings or conflicts will occur.
4052#CPU_SCALING_GOVERNOR_ON_AC=powersave
4053#CPU_SCALING_GOVERNOR_ON_BAT=powersave
4054
4055# Set the min/max frequency available for the scaling governor.
4056# Possible values strongly depend on your CPU. For available frequencies see
4057# the output of tlp-stat -p.
4058#CPU_SCALING_MIN_FREQ_ON_AC=0
4059#CPU_SCALING_MAX_FREQ_ON_AC=0
4060#CPU_SCALING_MIN_FREQ_ON_BAT=0
4061#CPU_SCALING_MAX_FREQ_ON_BAT=0
4062
4063# Set energy performance hints (HWP) for Intel P-state governor:
4064# performance, balance_performance, default, balance_power, power
4065# Values are given in order of increasing power saving.
4066# Note: Intel Skylake or newer CPU and Kernel >= 4.10 required.
4067CPU_HWP_ON_AC=balance_performance
4068CPU_HWP_ON_BAT=balance_power
4069
4070# Set Intel P-state performance: 0..100 (%).
4071# Limit the max/min P-state to control the power dissipation of the CPU.
4072# Values are stated as a percentage of the available performance.
4073# Requires an Intel Core i processor with intel_pstate driver.
4074#CPU_MIN_PERF_ON_AC=0
4075#CPU_MAX_PERF_ON_AC=100
4076#CPU_MIN_PERF_ON_BAT=0
4077#CPU_MAX_PERF_ON_BAT=30
4078
4079# Set the CPU "turbo boost" feature: 0=disable, 1=allow
4080# Requires an Intel Core i processor.
4081# Important:
4082# - This may conflict with your distribution's governor settings
4083# - A value of 1 does *not* activate boosting, it just allows it
4084#CPU_BOOST_ON_AC=1
4085#CPU_BOOST_ON_BAT=0
4086
4087# Minimize number of used CPU cores/hyper-threads under light load conditions:
4088# 0=disable, 1=enable.
4089SCHED_POWERSAVE_ON_AC=0
4090SCHED_POWERSAVE_ON_BAT=1
4091
4092# Kernel NMI Watchdog:
4093# 0=disable (default, saves power), 1=enable (for kernel debugging only).
4094NMI_WATCHDOG=0
4095
4096# Change CPU voltages aka "undervolting" - Kernel with PHC patch required.
4097# Frequency voltage pairs are written to:
4098# /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
4099# CAUTION: only use this, if you thoroughly understand what you are doing!
4100#PHC_CONTROLS="F:V F:V F:V F:V"
4101
4102# Set CPU performance versus energy savings policy:
4103# performance, balance-performance, default, balance-power, power.
4104# Values are given in order of increasing power saving.
4105# Requires kernel module msr and x86_energy_perf_policy from linux-tools.
4106ENERGY_PERF_POLICY_ON_AC=performance
4107ENERGY_PERF_POLICY_ON_BAT=balance-power
4108
4109# Disk devices; separate multiple devices with spaces (default: sda).
4110# Devices can be specified by disk ID also (lookup with: tlp diskid).
4111DISK_DEVICES="sda sdb"
4112
4113# Disk advanced power management level: 1..254, 255 (max saving, min, off).
4114# Levels 1..127 may spin down the disk; 255 allowable on most drives.
4115# Separate values for multiple disks with spaces. Use the special value 'keep'
4116# to keep the hardware default for the particular disk.
4117DISK_APM_LEVEL_ON_AC="254 254"
4118DISK_APM_LEVEL_ON_BAT="128 128"
4119
4120# Hard disk spin down timeout:
4121# 0: spin down disabled
4122# 1..240: timeouts from 5s to 20min (in units of 5s)
4123# 241..251: timeouts from 30min to 5.5 hours (in units of 30min)
4124# See 'man hdparm' for details.
4125# Separate values for multiple disks with spaces. Use the special value 'keep'
4126# to keep the hardware default for the particular disk.
4127#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
4128#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"
4129
4130# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq).
4131# Separate values for multiple disks with spaces. Use the special value 'keep'
4132# to keep the kernel default scheduler for the particular disk.
4133#DISK_IOSCHED="cfq cfq"
4134
4135# AHCI link power management (ALPM) for disk devices:
4136# min_power, med_power_with_dipm(*), medium_power, max_performance.
4137# (*) Kernel >= 4.15 required, then recommended.
4138# Multiple values separated with spaces are tried sequentially until success.
4139SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance"
4140SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power"
4141
4142# Exclude host devices from AHCI link power management.
4143# Separate multiple hosts with spaces.
4144#SATA_LINKPWR_BLACKLIST="host1"
4145
4146# Runtime Power Management for AHCI host and disks devices:
4147# on=disable, auto=enable.
4148# EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss.
4149#AHCI_RUNTIME_PM_ON_AC=on
4150#AHCI_RUNTIME_PM_ON_BAT=on
4151
4152# Seconds of inactivity before disk is suspended.
4153AHCI_RUNTIME_PM_TIMEOUT=15
4154
4155# PCI Express Active State Power Management (PCIe ASPM):
4156# default, performance, powersave.
4157PCIE_ASPM_ON_AC=performance
4158PCIE_ASPM_ON_BAT=powersave
4159
4160# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
4161# auto = mid on BAT, high on AC; default = use hardware defaults.
4162RADEON_POWER_PROFILE_ON_AC=high
4163RADEON_POWER_PROFILE_ON_BAT=low
4164
4165# Radeon dynamic power management method (DPM): battery, performance.
4166RADEON_DPM_STATE_ON_AC=performance
4167RADEON_DPM_STATE_ON_BAT=battery
4168
4169# Radeon DPM performance level: auto, low, high; auto is recommended.
4170RADEON_DPM_PERF_LEVEL_ON_AC=auto
4171RADEON_DPM_PERF_LEVEL_ON_BAT=auto
4172
4173# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
4174WIFI_PWR_ON_AC=off
4175WIFI_PWR_ON_BAT=on
4176
4177# Disable wake on LAN: Y/N.
4178WOL_DISABLE=Y
4179
4180# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
4181# A value of 0 disables, >=1 enables power saving (recommended: 1).
4182SOUND_POWER_SAVE_ON_AC=0
4183SOUND_POWER_SAVE_ON_BAT=0
4184
4185# Disable controller too (HDA only): Y/N.
4186SOUND_POWER_SAVE_CONTROLLER=N
4187
4188# Power off optical drive in UltraBay/MediaBay: 0=disable, 1=enable.
4189# Drive can be powered on again by releasing (and reinserting) the eject lever
4190# or by pressing the disc eject button on newer models.
4191# Note: an UltraBay/MediaBay hard disk is never powered off.
4192BAY_POWEROFF_ON_AC=0
4193BAY_POWEROFF_ON_BAT=0
4194# Optical drive device to power off (default sr0).
4195BAY_DEVICE="sr0"
4196
4197# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable.
4198RUNTIME_PM_ON_AC=on
4199RUNTIME_PM_ON_BAT=auto
4200
4201# Exclude PCI(e) device adresses the following list from Runtime PM
4202# (separate with spaces). Use lspci to get the adresses (1st column).
4203#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"
4204RUNTIME_PM_BLACKLIST="01:00.0"
4205
4206# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM.
4207# Default when unconfigured is "amdgpu nouveau nvidia radeon" which
4208# prevents accidential power-on of dGPU in hybrid graphics setups.
4209# Use "" to disable the feature completely.
4210# Separate multiple drivers with spaces.
4211#RUNTIME_PM_DRIVER_BLACKLIST="amdgpu nouveau nvidia radeon"
4212
4213# Set to 0 to disable, 1 to enable USB autosuspend feature.
4214USB_AUTOSUSPEND=1
4215
4216# Exclude listed devices from USB autosuspend (separate with spaces).
4217# Use lsusb to get the ids.
4218# Note: input devices (usbhid) are excluded automatically
4219#USB_BLACKLIST="1111:2222 3333:4444"
4220
4221# Bluetooth devices are excluded from USB autosuspend:
4222# 0=do not exclude, 1=exclude.
4223USB_BLACKLIST_BTUSB=0
4224
4225# Phone devices are excluded from USB autosuspend:
4226# 0=do not exclude, 1=exclude (enable charging).
4227USB_BLACKLIST_PHONE=0
4228
4229# Printers are excluded from USB autosuspend:
4230# 0=do not exclude, 1=exclude.
4231USB_BLACKLIST_PRINTER=1
4232
4233# WWAN devices are excluded from USB autosuspend:
4234# 0=do not exclude, 1=exclude.
4235USB_BLACKLIST_WWAN=1
4236
4237# Include listed devices into USB autosuspend even if already excluded
4238# by the blacklists above (separate with spaces).
4239# Use lsusb to get the ids.
4240#USB_WHITELIST="1111:2222 3333:4444"
4241
4242# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
4243# (workaround for USB devices that cause shutdown problems).
4244#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1
4245
4246# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
4247# on system startup: 0=disable, 1=enable.
4248# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
4249# are ignored when this is enabled!
4250#RESTORE_DEVICE_STATE_ON_STARTUP=0
4251RESTORE_DEVICE_STATE_ON_STARTUP=1
4252
4253# Radio devices to disable on startup: bluetooth, wifi, wwan.
4254# Separate multiple devices with spaces.
4255#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"
4256
4257# Radio devices to enable on startup: bluetooth, wifi, wwan.
4258# Separate multiple devices with spaces.
4259#DEVICES_TO_ENABLE_ON_STARTUP="wifi"
4260
4261# Radio devices to disable on shutdown: bluetooth, wifi, wwan.
4262# (workaround for devices that are blocking shutdown).
4263#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"
4264
4265# Radio devices to enable on shutdown: bluetooth, wifi, wwan.
4266# (to prevent other operating systems from missing radios).
4267#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"
4268
4269# Radio devices to enable on AC: bluetooth, wifi, wwan.
4270#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"
4271
4272# Radio devices to disable on battery: bluetooth, wifi, wwan.
4273#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"
4274
4275# Radio devices to disable on battery when not in use (not connected):
4276# bluetooth, wifi, wwan.
4277#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"
4278
4279# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
4280# required). Charging starts when the remaining capacity falls below the
4281# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
4282# Main / Internal battery (values in %)
4283#START_CHARGE_THRESH_BAT0=75
4284#STOP_CHARGE_THRESH_BAT0=80
4285# Ultrabay / Slice / Replaceable battery (values in %)
4286#START_CHARGE_THRESH_BAT1=75
4287#STOP_CHARGE_THRESH_BAT1=80
4288
4289# Restore charge thresholds when AC is unplugged: 0=disable, 1=enable.
4290#RESTORE_THRESHOLDS_ON_BAT=1
4291
4292# ------------------------------------------------------------------------------
4293# tlp-rdw - Parameters for the radio device wizard
4294# Possible devices: bluetooth, wifi, wwan.
4295
4296# Hints:
4297# - Parameters are disabled by default, remove the leading # to enable them
4298# - Separate multiple radio devices with spaces
4299
4300# Radio devices to disable on connect.
4301#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
4302#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
4303#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"
4304
4305# Radio devices to enable on disconnect.
4306#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
4307#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
4308#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""
4309
4310# Radio devices to enable/disable when docked.
4311#DEVICES_TO_ENABLE_ON_DOCK=""
4312#DEVICES_TO_DISABLE_ON_DOCK=""
4313
4314# Radio devices to enable/disable when undocked.
4315#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
4316#DEVICES_TO_DISABLE_ON_UNDOCK=""
4317#+end_src
4318
4319** X
4320
4321*** xprofile
4322:PROPERTIES:
4323:header-args+: :tangle ~/.xprofile
4324:END:
4325
4326=~/.xprofile= is similar in style to =~/.xinitrc=, but on the
4327contrary, it's automatically sourced by LightDM, my display manager of
4328choice.
4329
4330#+begin_src sh :tangle no
4331xset -b # disable bell
4332xset r rate 200 45 # repeat delay (ms) and rate (repeats/sec)
4333
4334# setxkbmap -option compose:ralt
4335
4336setxkbmap -option ctrl:nocaps # turn capslock into control
4337setxkbmap -option altwin:swap_alt_win # swap alt and super
4338
4339if [ $(hostname) = "plasma" ]
4340then
4341 setxkbmap -option ctrl:rctrl_ralt # turn right control into right alt
4342fi
4343
4344if [ $(hostname) = "enigma" ]
4345then
4346 xmodmap -e "keycode 135 = Alt_R" # remap menu key to alt
4347fi
4348
4349light -Scrs "intel_backlight" 2
4350
4351source $HOME/.zprofile
4352
4353export _JAVA_AWT_WM_NONREPARENTING=1
4354export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
4355
4356if [ $(hostname) = "plasma" ]
4357then
4358 unlock-def-gk.py &
4359fi
4360
4361bspwm &
4362#+end_src
4363
4364*** X resources
4365
4366**** Xresources
4367:PROPERTIES:
4368:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources")
4369:END:
4370
4371#+begin_src conf-xdefaults
4372#include ".Xresources.d/fonts"
4373! #include ".Xresources.d/colors"
4374#include ".Xresources.d/emacs"
4375#include ".Xresources.d/rxvt-unicode"
4376#+end_src
4377
4378**** Xresources.d
4379
4380***** fonts
4381:PROPERTIES:
4382:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/fonts")
4383:END:
4384
4385#+begin_src conf-xdefaults
4386Xft.lcdfilter: lcddefault
4387Xft.antialias: true
4388Xft.autohint: 0
4389Xft.hinting: true
4390Xft.hintstyle: hintslight
4391! Xft.hintstyle: hintfull
4392Xft.rgba: rgb
4393Xft.dpi: 96
4394#+end_src
4395
4396***** colors
4397:PROPERTIES:
4398:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/colors")
4399:END:
4400
4401#+begin_src conf-xdefaults :tangle no
4402#include "gruvbox-light.xresources"
4403! #include "gruvbox-dark.xresources"
4404#include "gruvbox-urxvt256.xresources"
4405#+end_src
4406
4407#+begin_src conf-xdefaults :tangle no
4408! -----------------------------------------------------------------------------
4409! File: gruvbox-light.xresources
4410! Description: Retro groove colorscheme generalized
4411! Author: morhetz <morhetz@gmail.com>
4412! Source: https://github.com/morhetz/gruvbox-generalized
4413! Last Modified: 6 Sep 2014
4414! -----------------------------------------------------------------------------
4415
4416! hard contrast: *background: #f9f5d7
4417*background: #fbf1c7
4418! soft contrast: *background: #f2e5bc
4419*foreground: #3c3836
4420! Black + DarkGrey
4421*color0: #fdf4c1
4422*color8: #928374
4423! DarkRed + Red
4424*color1: #cc241d
4425*color9: #9d0006
4426! DarkGreen + Green
4427*color2: #98971a
4428*color10: #79740e
4429! DarkYellow + Yellow
4430*color3: #d79921
4431*color11: #b57614
4432! DarkBlue + Blue
4433*color4: #458588
4434*color12: #076678
4435! DarkMagenta + Magenta
4436*color5: #b16286
4437*color13: #8f3f71
4438! DarkCyan + Cyan
4439*color6: #689d6a
4440*color14: #427b58
4441! LightGrey + White
4442*color7: #7c6f64
4443*color15: #3c3836
4444#+end_src
4445
4446#+begin_src conf-xdefaults :tangle no
4447! -----------------------------------------------------------------------------
4448! File: gruvbox-dark.xresources
4449! Description: Retro groove colorscheme generalized
4450! Author: morhetz <morhetz@gmail.com>
4451! Source: https://github.com/morhetz/gruvbox-generalized
4452! Last Modified: 6 Sep 2014
4453! -----------------------------------------------------------------------------
4454
4455! hard contrast: *background: #1d2021
4456*background: #282828
4457! soft contrast: *background: #32302f
4458*foreground: #ebdbb2
4459! Black + DarkGrey
4460*color0: #282828
4461*color8: #928374
4462! DarkRed + Red
4463*color1: #cc241d
4464*color9: #fb4934
4465! DarkGreen + Green
4466*color2: #98971a
4467*color10: #b8bb26
4468! DarkYellow + Yellow
4469*color3: #d79921
4470*color11: #fabd2f
4471! DarkBlue + Blue
4472*color4: #458588
4473*color12: #83a598
4474! DarkMagenta + Magenta
4475*color5: #b16286
4476*color13: #d3869b
4477! DarkCyan + Cyan
4478*color6: #689d6a
4479*color14: #8ec07c
4480! LightGrey + White
4481*color7: #a89984
4482*color15: #ebdbb2
4483#+end_src
4484
4485#+begin_src conf-xdefaults :tangle no
4486! -----------------------------------------------------------------------------
4487! File: gruvbox-urxvt256.xresources
4488! Description: Retro groove colorscheme generalized
4489! Author: morhetz <morhetz@gmail.com>
4490! Source: https://github.com/morhetz/gruvbox-generalized
4491! Last Modified: 13 Dec 2013
4492! -----------------------------------------------------------------------------
4493
4494URxvt.color24: #076678
4495URxvt.color66: #427b58
4496URxvt.color88: #9d0006
4497URxvt.color96: #8f3f71
4498URxvt.color100: #79740e
4499URxvt.color108: #8ec07c
4500URxvt.color109: #83a598
4501URxvt.color130: #af3a03
4502URxvt.color136: #b57614
4503URxvt.color142: #b8bb26
4504URxvt.color167: #fb4934
4505URxvt.color175: #d3869b
4506URxvt.color208: #fe8019
4507URxvt.color214: #fabd2f
4508URxvt.color223: #ebdbb2
4509URxvt.color228: #f2e5bc
4510URxvt.color229: #fbf1c7
4511URxvt.color230: #f9f5d7
4512URxvt.color234: #1d2021
4513URxvt.color235: #282828
4514URxvt.color236: #32302f
4515URxvt.color237: #3c3836
4516URxvt.color239: #504945
4517URxvt.color241: #665c54
4518URxvt.color243: #7c6f64
4519URxvt.color244: #928374
4520URxvt.color245: #928374
4521URxvt.color246: #a89984
4522URxvt.color248: #bdae93
4523URxvt.color250: #d5c4a1
4524#+end_src
4525
4526***** emacs
4527:PROPERTIES:
4528:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/emacs")
4529:END:
4530
4531#+begin_src conf-xdefaults
4532Emacs.menuBar: off
4533Emacs.toolBar: off
4534Emacs.verticalScrollBars: off
4535Emacs.cursorBlink: off
4536Emacs.FontBackend: xft,x
4537! Emacs.font: Ubuntu Mono-12
4538! Emacs.font: Triplicate T4C-11
4539! Emacs.font: Ubuntu Mono-10.5
4540! Emacs.font: Ubuntu Mono-12
4541! Emacs.font: Iosevka-11
4542
4543! Emacs.font: Fira Mono:size=15
4544! Emacs.font: DejaVu Sans Mono:size=15
4545! Emacs.font: Inconsolata:size=17
4546! Emacs.font: Inconsolata:size=16
4547! Emacs.font: Inconsolata LGC:size=14
4548! Emacs.font: Source Code Pro Medium-10.5
4549Emacs.font: Ubuntu Mono:size=16
4550! Emacs.font: Iosevka:size=16
4551#+end_src
4552
4553***** rxvt-unicode
4554:PROPERTIES:
4555:header-args+: :tangle (when (eq system-type 'gnu/linux) "~/.Xresources.d/rxvt-unicode")
4556:END:
4557
4558#+begin_src conf-xdefaults
4559! Font
4560URxvt.font: xft:ubuntu mono:pixelsize=16:antialias=true:hinting=true, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true
4561URxvt.boldFont: xft:ubuntu mono:pixelsize=16:antialias=true:hinting=true:bold, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bold
4562URxvt.italicFont: xft:ubuntu mono:pixelsize=16:antialias=true:hinting=true:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:italic
4563URxvt.bolditalicFont: xft:ubuntu mono:pixelsize=16:antialias=true:hinting=true:bold:italic, xft:dejavu sans mono:pixelsize=15:antialias=true:hinting=true:bolditalic
4564
4565URxvt.xftAntialias: true
4566URxvt.letterSpace: 0
4567
4568URxvt.depth: 0
4569URxvt.loginShell: true
4570URxvt.saveLines: 100000
4571URxvt.internalBorder: 3
4572URxvt.lineSpace: 0
4573URxvt.scrollBar: false
4574URxvt.scrollStyle: rxvt
4575URxvt*scrollTtyOutput: false
4576URxvt*scrollWithBuffer: true
4577URxvt*scrollTtyKeypress: true
4578URxvt.keysym.Shift-Up: command:\033]720;1\007
4579URxvt.keysym.Shift-Down: command:\033]721;1\007
4580
4581URxvt.perl-ext-common: default,clipboard,url-select,keyboard-select
4582URxvt.perl-ext: bidi
4583URxvt.bidi.enabled: 1
4584URxvt.url-select.launcher: firefox
4585URxvt.url-select.underline: true
4586URxvt.keysym.M-u: perl:url-select:select_next
4587URxvt.keysym.M-Escape: perl:keyboard-select:activate
4588URxvt.keysym.M-s: perl:keyboard-select:search
4589URxvt.url-launcher: /usr/bin/firefox
4590URxvt.matcher.button: 1
4591URxvt.iso14755: false
4592URxvt.iso14755_53: false
4593URxvt.keysym.M-c: perl:clipboard:copy
4594URxvt.keysym.M-v: perl:clipboard:paste
4595URxvt.keysym.C-A-V: perl:clipboard:paste_escaped
4596URxvt.keysym.C-Up: font-size:increase
4597URxvt.keysym.C-Down: font-size:decrease
4598URxvt.keysym.C-S-Up: font-size:incglobal
4599URxvt.keysym.C-S-Down: font-size:decglobal
4600URxvt.keysym.C-equal: font-size:reset
4601!URxvt.keysym.C-question: font-size:show
4602
4603URxvt.iconFile: /usr/share/icons/Paper/48x48/apps/utilities-terminal.png
4604
4605!urxvt*foreground: white
4606!urxvt*background: black
4607
4608!*color0: #2E3436
4609!*color1: #a40000
4610!*color2: #4E9A06
4611!*color3: #C4A000
4612!*color4: #3465A4
4613!*color5: #75507B
4614!*color6: #ce5c00
4615!*color7: #babdb9
4616!*color8: #555753
4617!*color9: #EF2929
4618!*color10: #8AE234
4619!*color11: #FCE94F
4620!*color12: #729FCF
4621!*color13: #AD7FA8
4622!*color14: #fcaf3e
4623!*color15: #EEEEEC
4624
4625!URxvt.foreground: #C8C8C8
4626!URxvt.background: #FFFFFF
4627
4628!! black
4629!*color0: #2E3436
4630!*color8: #555753
4631!! red
4632!*color1: #a40000
4633!*color9: #EF2929
4634!! green
4635!*color2: #4E9A06
4636!*color10: #8AE234
4637!! yellow
4638!*color3: #C4A000
4639!*color11: #FCE94F
4640!! blue
4641!*color4: #3465A4
4642!*color12: #729FCF
4643!! purple
4644!*color5: #75507B
4645!*color13: #AD7FA8
4646!! orange (replaces cyan)
4647!*color6: #ce5c00
4648!*color14: #fcaf3e
4649!! white
4650!*color7: #babdb9
4651!*color15: #EEEEEC
4652
4653! Tango colour theme for rxvt-unicode
4654URxvt.background: #FFFFFF
4655URxvt.foreground: #000000
4656
4657! Black
4658URxvt.color0: #2E3436
4659URxvt.color8: #757773
4660
4661! Red
4662URxvt.color1: #CC0000
4663URxvt.color9: #EF2929
4664
4665! Green
4666URxvt.color2: #4E9A06
4667URxvt.color10: #8AE234
4668
4669! Yellow
4670URxvt.color3: #C4A000
4671URxvt.color11: #FCE94F
4672
4673! Blue
4674URxvt.color4: #3465A4
4675URxvt.color12: #729FCF
4676
4677! Magenta
4678URxvt.color5: #75507B
4679URxvt.color13: #AD7FA8
4680
4681!! Cyan
4682!URxvt.color6: #06989A
4683!URxvt.color14: #34E2E2
4684! orange (replaces cyan)
4685*color6: #ce5c00
4686*color14: #fcaf3e
4687
4688! White
4689URxvt.color7: #D3D7CF
4690URxvt.color15: #EEEEEC
4691#+end_src
4692
4693** XDG
4694:PROPERTIES:
4695:header-args+: :tangle ~/.config/user-dirs.dirs
4696:END:
4697
4698#+begin_src conf
4699XDG_DESKTOP_DIR="$HOME/Desktop"
4700XDG_DOCUMENTS_DIR="$HOME/usr/docs"
4701XDG_DOWNLOAD_DIR="$HOME/usr/dls"
4702XDG_MUSIC_DIR="$HOME/usr/music"
4703XDG_PICTURES_DIR="$HOME/usr/pics"
4704XDG_PUBLICSHARE_DIR="$HOME/usr/Public"
4705XDG_TEMPLATES_DIR="$HOME/usr/Templates"
4706XDG_VIDEOS_DIR="$HOME/usr/vids"
4707#+end_src
4708
4709** Zathura
4710:PROPERTIES:
4711:header-args+: :tangle ~/.config/zathura/zathurarc
4712:END:
4713
4714#+begin_src conf
4715set smooth-scroll true
4716set selection-clipboard clipboard
4717set zoom-step 05
4718set default-bg "#272727"
4719set statusbar-bg "#272727"
4720set inputbar-bg "#373737"
4721#+end_src
4722
4723** Zsh
4724
4725My zsh setup is built on [[https://github.com/zimfw/zimfw][Zim]]. Further, my zshrc references [[https://github.com/junegunn/fzf][fzf]],
4726[[https://github.com/zsh-users/zsh-autosuggestions][zsh-autosuggestions]], and [[https://github.com/hlissner/zsh-autopair][zsh-autopair]]; so be sure to have them
4727installed.
4728
4729*** zimrc
4730:PROPERTIES:
4731:header-args+: :tangle ~/.zimrc
4732:END:
4733
4734#+begin_src sh
4735
4736
4737#################
4738# CORE SETTINGS #
4739#################
4740
4741#
4742# Zim settings
4743#
4744
4745# Select what modules you would like enabled.
4746# The second line of modules may depend on options set by modules in the first
4747# line. These dependencies are noted on the respective module's README.md.
4748zmodules=(directory environment git git-info history input ssh utility custom \
4749 syntax-highlighting history-substring-search prompt completion)
4750
4751
4752###################
4753# MODULE SETTINGS #
4754###################
4755
4756#
4757# Prompt
4758#
4759
4760# Set your desired prompt here
4761zprompt_theme='pure'
4762#PURE_PROMPT_SYMBOL=λ
4763#PURE_PROMPT_SYMBOL=δ
4764PURE_PROMPT_SYMBOL=➜
4765
4766#
4767# Completion
4768#
4769
4770# set an optional host-specific filename for the completion cache file
4771# if none is provided, the default '.zcompdump' is used.
4772#zcompdump_file=".zcompdump-${HOST}-${ZSH_VERSION}"
4773
4774#
4775# Utility
4776#
4777
4778# Uncomment to enable command correction prompts
4779# See: http://zsh.sourceforge.net/Doc/Release/Options.html#Input_002fOutput
4780setopt CORRECT
4781
4782#
4783# Environment
4784#
4785
4786# Set the string below to the desired terminal title format string.
4787# The terminal title is redrawn upon directory change, however, variables like
4788# ${PWD} are only evaluated once. Use prompt expansion strings for dynamic data:
4789# http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Simple-Prompt-Escapes
4790# The example below uses the following format: 'username@host:/current/directory'
4791ztermtitle='%n@%m:%~'
4792
4793#
4794# Input
4795#
4796
4797# Uncomment to enable double-dot expansion.
4798# This appends '../' to your input for each '.' you type after an initial '..'
4799#zdouble_dot_expand='true'
4800
4801#
4802# Syntax-Highlighting
4803#
4804
4805# This determines what highlighters will be used with the syntax-highlighting module.
4806# Documentation of the highlighters can be found here:
4807# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
4808# For (u)rxvt, termite and gnome-terminal users,
4809# removing the 'cursor' highlighter will fix the disappearing cursor problem
4810#zhighlighters=(main brackets cursor)
4811zhighlighters=(main brackets pattern)
4812
4813
4814#
4815# SSH
4816#
4817
4818# Load these ssh identities with the ssh module
4819zssh_ids=(id_ed25519_amin)
4820
4821
4822#
4823# Pacman
4824#
4825
4826# Set (optional) pacman front-end.
4827zpacman_frontend='yay'
4828
4829# Load any helper scripts as defined here
4830#zpacman_helper=(aur)
4831#+end_src
4832
4833*** zlogin
4834:PROPERTIES:
4835:header-args+: :tangle ~/.zlogin
4836:END:
4837
4838#+begin_src sh
4839
4840
4841#
4842# User configuration sourced by login shells
4843#
4844
4845# Initialize zim
4846[[ -s ${ZIM_HOME}/login_init.zsh ]] && source ${ZIM_HOME}/login_init.zsh
4847#+end_src
4848
4849*** zprofile
4850:PROPERTIES:
4851:header-args+: :tangle ~/.zprofile
4852:END:
4853
4854#+begin_src sh
4855#PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH"
4856#PATH=$HOME/.gem/ruby/2.4.0/bin:$PATH
4857export PATH=$HOME/.local/bin:$HOME/.cabal/bin:$HOME/.cargo/bin:$HOME/.elan/bin:$PATH
4858export XDG_CONFIG_HOME=$HOME/.config
4859export XDG_DATA_HOME=$HOME/.local/share
4860export XDG_DATA_DIRS=/usr/local/share:/usr/share
4861export MAILDIR="$HOME/mail"
4862export CVS_RSH=ssh
4863#export MATHMODELS=$HOME/src/eiffel/mathmodels
4864#export RUST_SRC_PATH=~/.multirust/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src
4865#export PATH=$PATH:$HOME/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/
4866
4867# Eiffel2Java stuff
4868#export JAVA_HOME=/usr/lib/jvm/default
4869#export CPATH=$CPATH:"$JAVA_HOME/include:$JAVA_HOME/include/linux"
4870#export LIBRARY_PATH=$LIBRARY_PATH:"$JAVA_HOME/jre/lib/amd64/server"
4871#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:"$JAVA_HOME/jre/lib/amd64/server"
4872
4873#export PATH="$HOME/usr/build/pvs:$PATH"
4874#export SBCLISP_HOME=/usr/share/sbcl-source
4875#export PVS_LIBRARY_PATH="$HOME/usr/build/pvs/nasalib"
4876
4877export MOZ_USE_XINPUT2=1 # precise scrolling in firefox
4878
4879#export JAVA_HOME=/usr/lib/jvm/java-8-openjdk
4880#export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4G"
4881
4882if [ -e /home/amin/.nix-profile/etc/profile.d/nix.sh ]; then . /home/amin/.nix-profile/etc/profile.d/nix.sh; fi # added by Nix installer
4883#+end_src
4884
4885*** zshenv
4886:PROPERTIES:
4887:header-args+: :tangle ~/.zshenv
4888:END:
4889
4890#+begin_src sh
4891# Ensure that a non-login, non-interactive shell has a defined environment.
4892if [[ "$SHLVL" -eq 1 && ! -o LOGIN && -s "${ZDOTDIR:-$HOME}/.zprofile" ]]; then
4893 source "${ZDOTDIR:-$HOME}/.zprofile"
4894fi
4895#+end_src
4896
4897*** zshrc
4898:PROPERTIES:
4899:header-args+: :tangle ~/.zshrc
4900:END:
4901
4902#+begin_src sh
4903# Bash-like navigation
4904#export WORDCHARS='*?_-.[]~=&;!#$%^(){}<>'
4905#export WORDCHARS='*?-[]~=&;!#$%^(){}<>'
4906export WORDCHARS='*?[]~=&;!#$%^(){}<>'
4907#ZLE_SPACE_SUFFIX_CHARS=$'|&'
4908
4909#disable -r time # disable shell reserved word
4910#alias time='time -p' # -p for POSIX output
4911
4912# rehash if last command was pacaur or pacman
4913# (so that zsh picks up changes in $PATH immediately)
4914TRAPUSR1() { rehash}; precmd() { [[ $history[$[ HISTCMD -1 ]] == *(pacaur|pacman)* ]] && killall -USR1 zsh }
4915
4916#
4917# User configuration sourced by interactive shells
4918#
4919
4920# Change default zim location
4921export ZIM_HOME=${ZDOTDIR:-${HOME}}/.zim
4922
4923# Start zim
4924[[ -s ${ZIM_HOME}/init.zsh ]] && source ${ZIM_HOME}/init.zsh
4925
4926ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red')
4927#ZSH_HIGHLIGHT_STYLES[unknown-token]='fg=red,bold'
4928
4929setopt globdots
4930
4931source ~/.zsh/zsh-autosuggestions/zsh-autosuggestions.zsh
4932source ~/.zsh/zsh-autopair/autopair.zsh
4933
4934
4935### fzf ###
4936
4937source /usr/share/fzf/key-bindings.zsh
4938source /usr/share/fzf/completion.zsh
4939
4940# Accept history selection instead of putting it on
4941# the command line
4942fzf-history-widget-accept() {
4943 fzf-history-widget
4944 zle accept-line
4945}
4946#zle -N fzf-history-widget-accept
4947#bindkey '^R' fzf-history-widget-accept
4948
4949# alt+c preview
4950export FZF_ALT_C_OPTS="--preview 'tree -C {} | head -200'"
4951
4952### fzf ###
4953
4954
4955# aliases
4956alias mpv="mpv --ytdl-format mp4"
4957alias mv="mv -iv"
4958alias cp="cp -iv"
4959alias scl=systemctl
4960alias jcl=journalctl
4961alias m="mbsync -Va; getmail; notmuch new"
4962alias best="youtube-dl -f best"
4963alias nixx="ssh amin@nix.aminb.org"
4964alias fence="ssh aminb@fencepost.gnu.org"
4965
4966aur() {
4967 cd ~/usr/build
4968 git clone https://aur.archlinux.org/${1}.git
4969 cd ${1}
4970}
4971
4972# i-beam cursor
4973echo -e "\033[5 q"
4974#echo -e "\033[6 q"
4975#+end_src
4976
4977* Scripts
4978
4979This section contains various useful scripts and the ones used by the
4980programs above. For instance, =toggle-tablet= for switching to and
4981from tablet mode on my X220T, =toggle-presentation-mode= for toggling
4982Xfce's presentation mode which keeps the screen awake, and
4983=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
4984exact brightness value.
4985
4986** battery-percentage-time
4987:PROPERTIES:
4988:header-args+: :tangle ~/.local/bin/battery-percentage-time :shebang "#!/bin/sh"
4989:END:
4990
4991#+begin_src sh :tangle no
4992dbus_send() {
4993 label=$1
4994 dbus-send --print-reply=literal --system \
4995 --dest=org.freedesktop.UPower \
4996 /org/freedesktop/UPower/devices/battery_BAT0 \
4997 org.freedesktop.DBus.Properties.Get \
4998 string:org.freedesktop.UPower.Device \
4999 string:"${label}" | awk '{print $3}'
5000}
5001
5002perc=$(dbus_send 'Percentage')
5003state=$(dbus_send 'State')
5004
5005if [ "$state" -eq 2 ]; then # Discharging
5006 secs=$(dbus_send 'TimeToEmpty')
5007elif [ "$state" -eq 1 ]; then # Charging
5008 secs=$(dbus_send 'TimeToFull')
5009fi
5010
5011printf '%s%%%%%2dh%02dm \n' "$perc" $((secs / 3600)) $((secs % 3600 / 60))
5012#+end_src
5013
5014** rofi-light
5015:PROPERTIES:
5016:header-args+: :tangle ~/.local/bin/rofi-light :shebang "#!/bin/bash"
5017:END:
5018
5019#+begin_src bash
5020cur=$(light -G)
5021val=$(rofi -dmenu -mesg "light $cur" -p "light -S " -l 0 -width 12)
5022light -S $val
5023#+end_src
5024
5025** s (run sway)
5026:PROPERTIES:
5027:header-args+: :tangle ~/.local/bin/s :shebang "#!/bin/bash"
5028:END:
5029
5030#+begin_src bash
5031export _JAVA_AWT_WM_NONREPARENTING=1
5032export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true'
5033light -Scrs "intel_backlight" 2
5034source $HOME/.zprofile
5035sway
5036#+end_src
5037
5038** sway-ws-util
5039:PROPERTIES:
5040:header-args+: :tangle ~/.local/bin/sway-ws-util :shebang "#!/bin/bash"
5041:END:
5042
5043#+begin_src bash
5044curr_ws=$(swaymsg -t get_workspaces | jq -r '.[] | select(.focused==true).name')
5045[[ $curr_ws -eq 1 ]] && prev_ws=10 || prev_ws=$((curr_ws-1))
5046[[ $curr_ws -eq 10 ]] && next_ws=1 || next_ws=$((curr_ws+1))
5047dest_ws=-1
5048op=-1
5049
5050if [ "$1" = "switch" ] || [ "$1" = "move" ]; then
5051 op="$1"
5052 if [ "$2" = "prev" ]; then
5053 dest_ws="$prev_ws"
5054 elif [ "$2" = "next" ]; then
5055 dest_ws="$next_ws"
5056 else
5057 echo "Usage: $0 $1 {prev|next} [follow]"
5058 exit 1
5059 fi
5060else
5061 echo "Usage: $0 {switch|move} {prev|next} [follow]"
5062 exit 1
5063fi
5064
5065if [ "$op" = "switch" ]; then
5066 sway workspace "$dest_ws"
5067elif [ "$op" = "move" ]; then
5068 sway move container to workspace "$dest_ws"
5069 if [ "$3" = "follow" ]; then
5070 sway workspace "$dest_ws"
5071 fi
5072fi
5073#+end_src
5074
5075** toggle-layout
5076:PROPERTIES:
5077:header-args+: :tangle ~/.local/bin/toggle-layout :shebang "#!/bin/bash"
5078:END:
5079
5080#+begin_src bash :tangle no
5081lang="$(setxkbmap -print | grep xkb_symbols | cut -d'+' -f 2)"
5082
5083if [ "$lang" = "us" ]; then
5084 setxkbmap ir
5085else
5086 setxkbmap us
5087 # xmodmap $HOME/.Xmodmap
5088fi
5089#+end_src
5090
5091** toggle-presentation-mode
5092:PROPERTIES:
5093:header-args+: :tangle ~/.local/bin/toggle-presentation-mode :shebang "#!/bin/bash"
5094:END:
5095
5096#+begin_src bash :tangle no
5097xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -T
5098#+end_src
5099
5100** toggle-tablet
5101:PROPERTIES:
5102:header-args+: :tangle ~/.local/bin/toggle-tablet :shebang "#!/bin/bash"
5103:END:
5104
5105This script toggles between a 'normal' mode and a 'tablet' mode, doing
5106a few things:
5107
5108- rotates the screen using =xrandr=, so that rotating the physical
5109 display of my X220t would have the laptop's battery on the right
5110 hand side,
5111- enables touch screen,
5112- properly rotates the stylus pen and touch screen pointers, and
5113- toggles between RGB and Vertical BGR sub-pixel order.
5114
5115#+begin_src bash :tangle no
5116case $(xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation) in
5117 0) # Screen is not rotated, we should rotate it right (90°)
5118 xrandr -o 3
5119 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 1
5120 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 1
5121 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 1
5122 xfconf-query -c xsettings -p /Xft/RGBA -s vbgr
5123 ;;
5124 1) # Currently top is rotated right, we should set it normal (0°)
5125 xrandr -o 0
5126 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation -s 0
5127 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Wacom_Rotation -s 0
5128 xfconf-query -c pointers -p /Wacom_ISDv4_E6_Finger_touch/Properties/Device_Enabled -s 0
5129 xfconf-query -c xsettings -p /Xft/RGBA -s rgb
5130 ;;
5131 *)
5132 echo "Unknown result from 'xfconf-query -c pointers -p /Wacom_ISDv4_E6_Pen_stylus/Properties/Wacom_Rotation'" >&2
5133 exit 1
5134 ;;
5135esac
5136#+end_src
5137
5138** unlock-def-gk.py
5139:PROPERTIES:
5140:header-args+: :tangle ~/.local/bin/unlock-def-gk.py :shebang "#!/usr/bin/env python2"
5141:END:
5142
5143#+begin_src python :tangle no
5144import gnomekeyring as gk
5145# list_item_ids_sync('login')[0] == 1L
5146gk.unlock_sync('Default_keyring',gk.item_get_info_sync('login',1L).get_secret())
5147#+end_src
5148
5149** volume-info
5150:PROPERTIES:
5151:header-args+: :tangle ~/.local/bin/volume-info :shebang "#!/bin/sh"
5152:END:
5153
5154#+begin_src sh :tangle no
5155cur_vol=$(pamixer --get-volume)
5156
5157if [ $(pamixer --get-mute) = true ]; then
5158 printf 'mt \n' "$cur_vol"
5159else
5160 printf '%02d \n' "$cur_vol"
5161fi
5162#+end_src
5163
5164** wp
5165
5166My little wallpaper changer script.
5167
5168*** wp
5169:PROPERTIES:
5170:header-args+: :tangle ~/.local/bin/wp :shebang "#!/bin/bash"
5171:END:
5172
5173#+begin_src bash :tangle no
5174export DISPLAY=:0
5175
5176case "$1" in
5177 "day")
5178 feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg
5179 ;;
5180 "night")
5181 feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg
5182 ;;
5183 *)
5184 echo $"Usage: $0 {day|night}"
5185 exit 1
5186esac
5187#+end_src
5188
5189*** wp-auto
5190:PROPERTIES:
5191:header-args+: :tangle ~/.local/bin/wp-auto :shebang "#!/bin/bash"
5192:END:
5193
5194#+begin_src bash :tangle no
5195SED=$(which sed)
5196ROFI=$(which rofi)
5197
5198export DISPLAY=:0
5199HOUR=$(date +%H)
5200
5201if [ -z "${SED}" ]
5202then
5203 echo "Did not find 'sed', script cannot continue."
5204 exit 1
5205fi
5206if [ -z "${ROFI}" ]
5207then
5208 echo "Did not find rofi, there is no point to continue."
5209 exit 1
5210fi
5211
5212###
5213# Create if not exists, then removes #include of .theme file (if present) and add the selected theme to the end.
5214# Repeated calls should leave the config clean-ish
5215###
5216function set_theme()
5217{
5218 CDIR="${HOME}/.config/rofi/"
5219 if [ ! -d "${CDIR}" ]
5220 then
5221 mkdir -p ${CDIR}
5222 fi
5223 if [ -f "${CDIR}/config" ]
5224 then
5225 ${SED} -i "/rofi\.theme: .*\.rasi$/d" "${CDIR}/config"
5226 fi
5227 echo "rofi.theme: ${1}" >> "${CDIR}/config"
5228
5229}
5230
5231if [ "$HOUR" -gt "19" ] || [ "$HOUR" -lt "7" ]
5232 then
5233 feh --bg-scale $HOME/usr/pics/island_night_by_arsenixc-d6cz757.jpg
5234 xrdb -merge $HOME/.Xresources.d/gruvbox-dark.xresources
5235 set_theme "/usr/share/rofi/themes//gruvbox-dark.rasi"
5236 else
5237 feh --bg-scale $HOME/usr/pics/island_day_by_arsenixc-d6ctqon.jpg
5238 xrdb -merge $HOME/.Xresources.d/gruvbox-light.xresources
5239 set_theme "/usr/share/rofi/themes//gruvbox-light.rasi"
5240fi
5241#+end_src
5242
5243*** wp.service
5244:PROPERTIES:
5245:header-args+: :tangle ~/.config/systemd/user/wp.service
5246:END:
5247
5248#+begin_src conf :tangle no
5249[Unit]
5250Description=wallpaper service
5251
5252[Service]
5253Type=oneshot
5254ExecStart=/usr/bin/bash -c %h/.local/bin/wp-auto
5255#+end_src
5256
5257*** wp.timer
5258:PROPERTIES:
5259:header-args+: :tangle ~/.config/systemd/user/wp.timer
5260:END:
5261
5262#+begin_src conf :tangle no
5263[Unit]
5264[Unit]
5265Description=wallpaper timer
5266
5267[Timer]
5268OnCalendar=07,21:00
5269Unit=wp.service
5270Persistent=true
5271
5272[Install]
5273WantedBy=timers.target
5274#+end_src
5275
5276** zathura-sync.sh
5277:PROPERTIES:
5278:header-args+: :tangle ~/.local/bin/zathura-sync.sh :shebang "#!/bin/sh"
5279:END:
5280
5281#+begin_src sh
5282pos="$1"
5283pdffile="$2"
5284zathura --synctex-forward "$pos" "$pdffile" || \
5285 (
5286 zathura -x "emacsclient --eval '(progn (switch-to-buffer (file-name-nondirectory \"%{input}\")) (goto-line %{line}))'" "$pdffile" &
5287 sleep 1; zathura --synctex-forward "$pos" "$pdffile" )
5288#+end_src
5289** Fun :)
5290
5291*** eat-em
5292:PROPERTIES:
5293:header-args+: :tangle ~/.local/bin/eat-em :shebang "#!/bin/sh"
5294:END:
5295
5296#+begin_src sh
5297# Original Posted at http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921
5298# [ESC] character in original post removed here.
5299
5300# ANSI Color -- use these variables to easily have different color
5301# and format output. Make sure to output the reset sequence after
5302# colors (f = foreground, b = background), and use the 'off'
5303# feature for anything you turn on.
5304
5305initializeANSI()
5306{
5307 esc="$(echo -en '\e')"
5308
5309 blackf="${esc}[30m"; redf="${esc}[31m"; greenf="${esc}[32m"
5310 yellowf="${esc}[33m" bluef="${esc}[34m"; purplef="${esc}[35m"
5311 cyanf="${esc}[36m"; whitef="${esc}[37m"
5312
5313 blackb="${esc}[40m"; redb="${esc}[41m"; greenb="${esc}[42m"
5314 yellowb="${esc}[43m" blueb="${esc}[44m"; purpleb="${esc}[45m"
5315 cyanb="${esc}[46m"; whiteb="${esc}[47m"
5316
5317 boldon="${esc}[1m"; boldoff="${esc}[22m"
5318 italicson="${esc}[3m"; italicsoff="${esc}[23m"
5319 ulon="${esc}[4m"; uloff="${esc}[24m"
5320 invon="${esc}[7m"; invoff="${esc}[27m"
5321
5322 reset="${esc}[0m"
5323}
5324
5325# note in this first use that switching colors doesn't require a reset
5326# first - the new color overrides the old one.
5327
5328#clear
5329
5330initializeANSI
5331
5332cat << EOF
5333
5334 ${yellowf} ▄███████▄${reset} ${redf} ▄██████▄${reset} ${greenf} ▄██████▄${reset} ${bluef} ▄██████▄${reset} ${purplef} ▄██████▄${reset} ${cyanf} ▄██████▄${reset}
5335 ${yellowf}▄█████████▀▀${reset} ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄${reset} ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄${reset} ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄${reset} ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄${reset} ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset}
5336 ${yellowf}███████▀${reset} ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███${reset} ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███${reset} ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███${reset} ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███${reset} ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset}
5337 ${yellowf}███████▄${reset} ${redf}████████████${reset} ${greenf}████████████${reset} ${bluef}████████████${reset} ${purplef}████████████${reset} ${cyanf}████████████${reset}
5338 ${yellowf}▀█████████▄▄${reset} ${redf}██▀██▀▀██▀██${reset} ${greenf}██▀██▀▀██▀██${reset} ${bluef}██▀██▀▀██▀██${reset} ${purplef}██▀██▀▀██▀██${reset} ${cyanf}██▀██▀▀██▀██${reset}
5339 ${yellowf} ▀███████▀${reset} ${redf}▀ ▀ ▀ ▀${reset} ${greenf}▀ ▀ ▀ ▀${reset} ${bluef}▀ ▀ ▀ ▀${reset} ${purplef}▀ ▀ ▀ ▀${reset} ${cyanf}▀ ▀ ▀ ▀${reset}
5340
5341 ${boldon}${yellowf} ▄███████▄ ${redf} ▄██████▄ ${greenf} ▄██████▄ ${bluef} ▄██████▄ ${purplef} ▄██████▄ ${cyanf} ▄██████▄${reset}
5342 ${boldon}${yellowf}▄█████████▀▀ ${redf}▄${whitef}█▀█${redf}██${whitef}█▀█${redf}██▄ ${greenf}▄${whitef}█▀█${greenf}██${whitef}█▀█${greenf}██▄ ${bluef}▄${whitef}█▀█${bluef}██${whitef}█▀█${bluef}██▄ ${purplef}▄${whitef}█▀█${purplef}██${whitef}█▀█${purplef}██▄ ${cyanf}▄${whitef}█▀█${cyanf}██${whitef}█▀█${cyanf}██▄${reset}
5343 ${boldon}${yellowf}███████▀ ${redf}█${whitef}▄▄█${redf}██${whitef}▄▄█${redf}███ ${greenf}█${whitef}▄▄█${greenf}██${whitef}▄▄█${greenf}███ ${bluef}█${whitef}▄▄█${bluef}██${whitef}▄▄█${bluef}███ ${purplef}█${whitef}▄▄█${purplef}██${whitef}▄▄█${purplef}███ ${cyanf}█${whitef}▄▄█${cyanf}██${whitef}▄▄█${cyanf}███${reset}
5344 ${boldon}${yellowf}███████▄ ${redf}████████████ ${greenf}████████████ ${bluef}████████████ ${purplef}████████████ ${cyanf}████████████${reset}
5345 ${boldon}${yellowf}▀█████████▄▄ ${redf}██▀██▀▀██▀██ ${greenf}██▀██▀▀██▀██ ${bluef}██▀██▀▀██▀██ ${purplef}██▀██▀▀██▀██ ${cyanf}██▀██▀▀██▀██${reset}
5346 ${boldon}${yellowf} ▀███████▀ ${redf}▀ ▀ ▀ ▀ ${greenf}▀ ▀ ▀ ▀ ${bluef}▀ ▀ ▀ ▀ ${purplef}▀ ▀ ▀ ▀ ${cyanf}▀ ▀ ▀ ▀${reset}
5347
5348EOF
5349#+end_src
5350
5351*** invade-em
5352:PROPERTIES:
5353:header-args+: :tangle ~/.local/bin/invade-em :shebang "#!/bin/bash"
5354:END:
5355
5356#+begin_src bash
5357#
5358# ANSI color scheme script featuring Space Invaders
5359#
5360# Original: http://crunchbang.org/forums/viewtopic.php?pid=126921%23p126921#p126921
5361# Modified by lolilolicon
5362#
5363
5364f=3 b=4
5365for j in f b; do
5366 for i in {0..7}; do
5367 printf -v $j$i %b "\e[${!j}${i}m"
5368 done
5369done
5370bld=$'\e[1m'
5371rst=$'\e[0m'
5372
5373cat << EOF
5374
5375 $f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
5376 $f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
5377 $f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst
5378 $f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst
5379
5380 $bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst
5381 $bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst
5382 $bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst
5383 $bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst
5384
5385
5386 $f7▌$rst
5387
5388 $f7▌$rst
5389
5390 $f7 ▄█▄ $rst
5391 $f7▄█████████▄$rst
5392 $f7▀▀▀▀▀▀▀▀▀▀▀$rst
5393
5394EOF
5395#+end_src