-
Notifications
You must be signed in to change notification settings - Fork 4
/
xbindkeysrc
220 lines (160 loc) · 8.96 KB
/
xbindkeysrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
# XBindKeys(1) configuration (window manager-agnostic keybindings; mostly multimedia keys)
#
# See [Xbindkeys][1], [Extra keyboard keys][1] and [Extra keyboard keys in Xorg][2] in the
# ArchWiki. `xbindkeys --defaults` prints a default configuration file.
#
# [1]: https://wiki.archlinux.org/title/Xbindkeys
# [2]: https://wiki.archlinux.org/title/Extra_keyboard_keys
# [3]: https://wiki.archlinux.org/title/Keyboard_shortcuts#Xorg
"i3-msg 'floating enable; move position 13 68; resize set 1248 1458'"
Mod4 + Shift + h
"i3-msg 'floating enable; move position 1293 68; resize set 1248 1458'"
Mod4 + Shift + l
"wmctrl -r :ACTIVE: -e 0,3,-1,2554,-1"
Mod4 + Shift + j
"wmctrl -r :ACTIVE: -e 0,-1,71,-1,1462"
Mod4 + Shift + k
"amixer -q set Master toggle"
XF86AudioMute
# These notifications are excluded from Dunst's message history based on the "application
# name" hzVgHJS3. I used `-c ephemeral` to achieve the same with `notify-send` before,
# but `dunstify` doesn't seem to allow specifying a notification category. TODO: Does
# <https://github.com/dunst-project/dunst/pull/552> mean that we can use `notify-send`
# instead of `dunstify`?
"dunstify -u low -t 2000 -a hzVgHJS3 -r 699814432 - "$(amixer set Master playback 2db- | sed -En '$s!.*\[(.*%)\].*!<small>ALSA master volume</small>\n\1!p')""
XF86AudioLowerVolume
"dunstify -u low -t 2000 -a hzVgHJS3 -r 699814432 - "$(amixer set Master playback 2db+ | sed -En '$s!.*\[(.*%)\].*!<small>ALSA master volume</small>\n\1!p')""
XF86AudioRaiseVolume
# Increase the audio volume by scrolling up while holding the Super key. With a
# TrackPoint, this is much faster and more convenient than the media keys.
"dunstify -u low -t 2000 -a hzVgHJS3 -r 699814432 - "$(amixer set Master playback 1%+ | sed -En '$s!.*\[(.*%)\].*!<small>ALSA master volume</small>\n\1!p')""
Mod4 + b:4
# Decrease the volume by scrolling down while holding the Super/Windows key.
"dunstify -u low -t 2000 -a hzVgHJS3 -r 699814432 - "$(amixer set Master playback 1%- | sed -En '$s!.*\[(.*%)\].*!<small>ALSA master volume</small>\n\1!p')""
Mod4 + b:5
"mpc seek +5"
XF86Forward
"mpc seek -5"
XF86Back
"mpc next"
XF86AudioNext
"mpc next"
Mod4 + Shift + period
# Like ncmpcpp.
"mpc seek 0"
Mod4 + BackSpace
"mpc toggle"
XF86AudioPlay
"mpc toggle"
Mod4 + Escape
"mpc prev"
XF86AudioPrev
"mpc prev"
Mod4 + Shift + comma
# Take a screenshot using maim(1).
"f="$HOME/screenshots/$(date '+%Y%m%dT%H%M%S').png" bash -c 'maim -s -b 2 -c .843,.373,.373 --nokeyboard "$f" || maim "$f" && notify-send -u low "Screenshot saved to file://$f"'"
Print
# Simply using `qrencode --size=9 --margin 1 "$(xsel)" -o - | feh -` would work, but it
# makes it hard to specifically match the feh window in i3's configuration file, which I
# do to make the window float. Using mktemp with a custom template makes the feh window
# easily identifiable; see `home/config/i3/config`. TODO: use `xsel -b`?
"path=$(mktemp --tmpdir= qrencode.XXX.png) && { qrencode --size=9 --margin=1 "$(xsel -o)" -o "$path" && feh "$path"; rm "$path"; }"
Mod4 + minus
"trans -speak en: <<< "$(xsel -o)""
Mod4 + equal
# Show or create my "dropdown terminal" scratchpad.
"if [[ $(i3-msg '[instance="^scratchpad$"] scratchpad show') != '[{"success":true}]' ]]; then ~/dotfiles/misc/keybind-scripts/append-scratchpad-layout; if screen -ls scratchpad; then exec xterm -sl 0 -name scratchpad -e 'screen -x scratchpad'; else exec xterm -sl 0 -name scratchpad -e 'screen -S scratchpad'; fi; fi"
Mod4 + grave
"i3-msg '[class="^firefox$"] focus'"
Mod4 + f
# Switch to or start NeoMutt. The `GPG_TTY=$(tty)` variable assignment makes sure that
# the creation of the `pinentry-curses` dialog doesn't fail. This dialog is indirectly
# created by `pass` when my NeoMutt configuration invokes it to get passwords. For more
# details, search for `GPG_TTY` in `home/bashrc`.
"[[ $(i3-msg '[instance="^neomutt$" class="^XTerm$"] focus') == '[{"success":true}]' ]] || xterm -name neomutt -e 'GPG_TTY=$(tty) neomutt'"
Mod4 + m
"urxvt -name 'floating xterm' -e nvim +'inoremap <C-Space> <Esc>:Snippets<CR>' +Mail +1bw +startinsert"
Mod4 + Shift + m
"xterm -name 'floating xterm' -geometry 36x25 -e bash --rcfile ~/dotfiles/misc/keybind-scripts/super-i -s resize"
Mod4 + i
"if [[ $(i3-msg '[instance="^scratchpad$"] focus') == '[{"success":true}]' ]]; then screen -S scratchpad -X screen bash --rcfile ~/dotfiles/misc/keybind-scripts/super-i; else ~/dotfiles/misc/keybind-scripts/append-scratchpad-layout; if screen -ls scratchpad; then screen -S scratchpad -X screen bash --rcfile ~/dotfiles/misc/keybind-scripts/super-i; exec xterm -sl 0 -name scratchpad -e 'screen -x scratchpad -p 42'; else exec xterm -sl 0 -name scratchpad -e 'screen -S scratchpad bash --rcfile ~/dotfiles/misc/keybind-scripts/super-i'; fi; fi"
Mod4 + Shift + i
"if [[ $(i3-msg '[instance="^scratchpad$"] focus') == '[{"success":true}]' ]]; then screen -S scratchpad -X screen; else ~/dotfiles/misc/keybind-scripts/append-scratchpad-layout; if screen -ls scratchpad; then xterm -sl 0 -name scratchpad -e 'screen -x scratchpad -p +'; else xterm -sl 0 -name scratchpad -e 'screen -S scratchpad'; fi; fi"
Mod4 + backslash
"if [[ $(i3-msg '[instance="^scratchpad$"] focus') == '[{"success":true}]' ]]; then screen -S scratchpad -X chdir ~/dotfiles; screen -S scratchpad -X screen; screen -S scratchpad -X chdir; else ~/dotfiles/misc/keybind-scripts/append-scratchpad-layout; if screen -ls scratchpad; then screen -S scratchpad -X chdir ~/dotfiles; screen -S scratchpad -X screen; screen -S scratchpad -X chdir; exec xterm -sl 0 -name scratchpad -e 'screen -x scratchpad -p 42'; else exec xterm -sl 0 -name scratchpad -e 'screen -S scratchpad bash -c "cd ~/dotfiles && bash"'; fi; fi"
Mod4 + Shift + backslash
# Switch to or start Vim.
"[[ $(i3-msg '[instance="^vim$" class="^URxvt$"] focus') == '[{"success":true}]' ]] || urxvt -geometry 195x61 -b 2 -name vim -e vim -S"
Mod4 + v
# Start or kill ncmpcpp.
"pkill -u $USER -x ncmpcpp || xterm -name ncmpcpp -e ncmpcpp"
Mod4 + c
# This is very similar to the "Mod4 + grave" keybind above.
"if [[ $(i3-msg '[instance="^newsboat$"] scratchpad show') != '[{"success":true}]' ]]; then if screen -ls newsboat; then exec xterm -name newsboat -geometry 140x24 -e 'stty -ixon && exec screen -x newsboat'; else exec xterm -name newsboat -geometry 140x24 -e 'stty -ixon && exec screen -S newsboat newsboat'; fi; fi"
Mod4 + Shift + n
"xterm -name 'floating xterm' -e p"
Mod4 + g
# List [desktop entry files][1] using j4-dmenu-desktop and fzf and launch the selected
# program. I used Rofi instead of fzf before, but fzf is faster and has superior fuzzy
# matching.
"~/dotfiles/misc/keybind-scripts/j4-fzf-desktop"
Mod4 + Shift + semicolon
# [1]: https://wiki.archlinux.org/title/Desktop_entries
"xterm -name 'floating xterm' -geometry 80x8 -e ~/dotfiles/misc/keybind-scripts/fzf-command-runner"
Mod4 + semicolon
# I previously used IPython here, but it's a bit slow to start compared to pretty much
# every other potential option for doing some quick maths (`bc`, `calc`, `dc`, `lua`, just
# `python`, ...). Now I'm trying GHCi. Also see <https://reddit.com/comments/5z5fwh>.
"[[ $(i3-msg '[instance="^ghci$"] scratchpad show') == '[{"success":true}]' ]] || xterm -name ghci -geometry 61x34 -e ghci"
Mod4 + u
# Why not both?
"[[ $(i3-msg '[instance="^ipython$"] scratchpad show') == '[{"success":true}]' ]] || xterm -name ipython -geometry 61x34 -e ipython --no-banner"
Mod4 + Shift + u
"PINENTRY_USER_DATA=spawn-xterm xterm -name 'floating xterm' -geometry 36x24 -e ~/dotfiles/misc/keybind-scripts/fzf-pass"
Mod4 + y
"~/dotfiles/misc/keybind-scripts/fzf-window-switcher"
Mod4 + space
"i3-msg [class=.] focus"
Mod4 + Tab
# Lock the screen.
"lock"
XF86ScreenSaver
"flock -Fn /tmp/HAB1DQ4j ~/dotfiles/misc/keybind-scripts/date-time-battery-song-notification"
Mod4 + b
# Look on my works, ye Mighty, and despair!
"pkill -fx 'sleep 0.057891381'; sleep 0.057891381 && dunstify --close 84873362"
Mod4 + b + Release
"vimsel"
Mod4 + e
"~/dotfiles/misc/keybind-scripts/fzf-wiki"
Mod4 + r
# TODO: kill this xterm when it loses focus?
"xterm -name 'floating xterm' -geometry 100x25"
Mod4 + o
"xterm -name 'floating xterm' -geometry 100x25 fish"
Mod4 + Shift + o
"xterm -name 'funny xterm'"
Mod4 + x
"xterm -name 'borderless floating xterm' -geometry 178x28 -e htop"
Mod4 + apostrophe
"xterm -name 'borderless floating xterm' -geometry 159x32 -e alsamixer"
Mod4 + Shift + apostrophe
"i3-msg '[instance="^floating man$"] scratchpad show'"
Mod4 + z
"~/dotfiles/misc/keybind-scripts/man 0:0p:1:1p:6:8"
Mod4 + F1
"~/dotfiles/misc/keybind-scripts/man 2"
Mod4 + F2
"~/dotfiles/misc/keybind-scripts/man 3:3p:3type"
Mod4 + F3
"~/dotfiles/misc/keybind-scripts/man 4"
Mod4 + F4
"~/dotfiles/misc/keybind-scripts/man 5"
Mod4 + F5
"~/dotfiles/misc/keybind-scripts/man 6"
Mod4 + F6
"~/dotfiles/misc/keybind-scripts/man 7"
Mod4 + F7
"~/dotfiles/misc/keybind-scripts/man 8"
Mod4 + F8
# vim: ft=conf