-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathratpoisonrc
381 lines (323 loc) · 17 KB
/
ratpoisonrc
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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
#-*- Mode: Ratpoisonrc -*-
set startupmessage 0
# prefix map for C-t y used for much of my own custom stuff, after I ran out of other buttons to use. Was initially
# only used for C-t y t for watching teh youtubes, thus the name.
newkmap waitoob
bind y readkey waitoob
bind C-y readkey waitoob
definekey waitoob k exec setxkbmap -option ctrl:nocaps
unmanage Qt-ponies
unmanage qt-ponies
# this unmanages the trayer-srg window
unmanage panel
unmanage stalonetray
exec pgrep -l stalonetray || stalonetray -t true
# can't use from scripts etc.
alias curwindow exec ratpoison -c "echo `ratpoison -c 'windows' | grep '*' | egrep -o '[[:digit:]]+'`"
alias reload exec ratpoison -c "source $HOME/.ratpoisonrc"
alias loadrc reload
set bgcolor black
set fgcolor green
set infofmt (%H, %W) %n(%c - %a) -- PID: %p, XWID: %i
set fwcolor white
set font unifont
bind apostrophe select
bind o focus
bind C-o focusprev
bind Tab focuslast
# # frame slots
alias store-fs1 exec ratpoison -c "setenv fs1 `ratpoison -c 'fdump'`"
alias restore-fs1 exec ratpoison -c "frestore `ratpoison -c 'getenv fs1'`"
alias store-fs2 exec ratpoison -c "setenv fs2 `ratpoison -c 'fdump'`"
alias restore-fs2 exec ratpoison -c "frestore `ratpoison -c 'getenv fs2'`"
alias store-fs3 exec ratpoison -c "setenv fs3 `ratpoison -c 'fdump'`"
alias restore-fs3 exec ratpoison -c "frestore `ratpoison -c 'getenv fs3'`"
alias store-fs4 exec ratpoison -c "setenv fs4 `ratpoison -c 'fdump'`"
alias restore-fs4 exec ratpoison -c "frestore `ratpoison -c 'getenv fs4'`"
alias store-fs5 exec ratpoison -c "setenv fs5 `ratpoison -c 'fdump'`"
alias restore-fs5 exec ratpoison -c "frestore `ratpoison -c 'getenv fs5'`"
bind M-exclam store-fs1
bind M-1 restore-fs1
bind M-at store-fs2
bind M-2 restore-fs2
bind M-numbersign store-fs3
bind M-3 restore-fs3
bind M-dollar store-fs4
bind M-4 restore-fs4
bind M-percent store-fs5
bind M-5 restore-fs5
# more splitting options
bind C-s split 2/3
bind C-S hsplit 2/3
# move commands (moves window to other frame w/o exchanging)
# TODO: works badly when moving causes an empty frame ('other' fails)
alias moveleft exec ratpoison -c 'exchangeleft' -c 'focuslast' -c 'other' -c 'focuslast'
alias movedown exec ratpoison -c 'exchangedown' -c 'focuslast' -c 'other' -c 'focuslast'
alias moveup exec ratpoison -c 'exchangeup' -c 'focuslast' -c 'other' -c 'focuslast'
alias moveright exec ratpoison -c 'exchangeright' -c 'focuslast' -c 'other' -c 'focuslast'
# avoid stretching for the arrow keys (prefixless binds)
# TODO: I should probably use these more...
definekey top s-j focusleft
definekey top s-k focusdown
definekey top s-i focusup
definekey top s-l focusright
definekey top s-Left focusleft
definekey top s-Down focusdown
definekey top s-Up focusup
definekey top s-Right focusright
definekey top C-s-j exchangeleft
definekey top C-s-k exchangedown
definekey top C-s-i exchangeup
definekey top C-s-l exchangeright
definekey top C-s-Left exchangeleft
definekey top C-s-Down exchangedown
definekey top C-s-Up exchangeup
definekey top C-s-Right exchangeright
# Shifted versions move but do not exchange
definekey top s-J moveleft
definekey top s-K movedown
definekey top s-I moveup
definekey top s-L moveright
definekey top S-s-Left moveleft
definekey top S-s-Down movedown
definekey top S-s-Up moveup
definekey top S-s-Right moveright
bind S-Left moveleft
bind S-Down movedown
bind S-Up moveup
bind S-Right moveright
# ctrl+shift also moves it into the new group (useful when moving window to another screen)
bind C-S-Left exec ratpoison -c moveleft -c rpms_gmove-here
bind C-S-Down exec ratpoison -c movedown -c rpms_gmove-here
bind C-S-Up exec ratpoison -c moveup -c rpms_gmove-here
bind C-S-Right exec ratpoison -c moveright -c rpms_gmove-here
# TODO: move into rpms?
definekey top s-bracketleft prevscreen
definekey top s-bracketright nextscreen
definekey top s-u prevscreen
definekey top s-o nextscreen
definekey top s-braceleft rpms_swap-screen-prev
definekey top s-braceright rpms_swap-screen-next
definekey top s-backslash rpms_screen-other
definekey top s-slash rpms_desktop-other
definekey top C-s-slash rpms_desktop-other-global
definekey top s-comma rpms_prevdesktop
definekey top s-period rpms_nextdesktop
# prefixless terminal spawners
definekey top s-Return exec ratpoison -c hsplit -c focus -c xterm
definekey top s-S-Return exec ratpoison -c split -c focus -c xterm
# prefixless window delete
definekey top s-C delete
setenv filewin_w 1000
setenv filewin_h 700
alias fix-gtk-filechooser exec sed -i -e 's/GeometryWidth=.*$/GeometryWidth='"${filewin_w}/" -e 's/GeometryHeight=.*$/GeometryHeight='"${filewin_h}/" ~/.config/gtk-2.0/gtkfilechooser.ini; gsettings set org.gtk.Settings.FileChooser window-size "(${filewin_w}, ${filewin_h})"
alias fix-audacious-filebrowser exec sed -i -e 's/filebrowser_win=.*$/filebrowser_win=100,100,'"${filewin_w},${filewin_h}/" ~/.config/audacious/config
definekey waitoob g exec ratpoison -c fix-gtk-filechooser -c fix-audacious-filebrowser
alias transset-toggle exec transset
alias transset exec transset $(ratpoison -c 'prompt trans: ')
definekey waitoob o transset-toggle
definekey waitoob C-o transset-toggle
definekey waitoob O transset
definekey waitoob C-O transset
# setenv xterm-trans .75
setenv xterm_trans .85
# bind C-exclam colon exec urxvtc -e
alias system exec ratpoison -c "echo $(sh -c "$(ratpoison -c 'prompt system: ')")"
bind C-exclam system
bind C-M-exclam colon exec xterm -e
bind c exec st
alias xterm exec xterm -e '$SHELL -c "transset -i $WINDOWID $xterm_trans; exec $SHELL -l"'
alias xterm-count exec ratpoison -c "echo XTerm count: $(ratpoison -c 'windows %c' | grep XTerm | wc -l)"
alias xterm-and-count exec ratpoison -c 'xterm'; sleep .1; ratpoison -c 'xterm-count'
alias xterm-white exec xterm -rv -e '$SHELL -c "transset -i $WINDOWID .90; exec $SHELL -l"'
bind C-c xterm-and-count
bind C-C xterm-white
newkmap smallbutton
definekey top XF86MyComputer readkey smallbutton
definekey smallbutton XF86TouchpadToggle exec ratpoison -c 'meta o' -c 'meta o'
definekey smallbutton XF86ScreenSaver meta space
definekey smallbutton Up meta s
definekey smallbutton Down meta v
definekey smallbutton Right meta j
# Rotatey stuff
setenv rp_rotation 0
# rotate-handle-xsetwacom never called directly! (consider using getenv to get value, instead of shell interpolation, in the future if buggy?)
setenv rp_map_rotation_to_xsetwacom 0 2 3 1
setenv rp_map_rotation_to_xrandr normal left inverted right
alias %rotate-handle-xsetwacom exec ARG=$( echo "${rp_map_rotation_to_xsetwacom}" | cut -d' ' -f$(( rp_rotation%4 + 1 )) ); for i in ${rp_wacomdevices}; do xsetwacom --set $i rotate $ARG; done
alias %rotate-handle-xrandr exec ARG=$( echo "${rp_map_rotation_to_xrandr}" | cut -d' ' -f$(( rp_rotation%4 + 1 )) ); xrandr --output ${rp_rotate_screen:-LVDS1} --rotate $ARG
alias rotate-counterclockwise exec newrot=$(( rp_rotation + 1 )); [ "$newrot" -gt 3 ] && newrot=0; ratpoison -c "setenv rp_rotation $newrot" -c '%rotate-handle-xsetwacom' -c '%rotate-handle-xrandr'
alias rotate-clockwise exec newrot=$(( rp_rotation - 1 )); [ "$newrot" -lt 0 ] && newrot=3; ratpoison -c "setenv rp_rotation $newrot" -c '%rotate-handle-xsetwacom' -c '%rotate-handle-xrandr'
alias rotate-toggle-tablet-mode exec [ "$rp_rotation" -eq 3 ] && newrot=0 || newrot=3; ratpoison -c "setenv rp_rotation $newrot" -c '%rotate-handle-xsetwacom' -c '%rotate-handle-xrandr'
alias rotate-0 exec newrot=$(( rp_rotation ^ 1 )); ratpoison -c "setenv rp_rotation $newrot" -c '%rotate-handle-xsetwacom' -c '%rotate-handle-xrandr'
alias rotate-1 exec newrot=$(( rp_rotation ^ 2 )); ratpoison -c "setenv rp_rotation $newrot" -c '%rotate-handle-xsetwacom' -c '%rotate-handle-xrandr'
alias rotate-2 exec ratpoison -c rotate-0 -c rotate-1
definekey top C-XF86ScreenSaver rotate-clockwise
definekey top C-M-XF86ScreenSaver rotate-counterclockwise
definekey top C-XF86TouchpadToggle rotate-toggle-tablet-mode
definekey top XF86ScreenSaver rotate-1
definekey top XF86TouchpadToggle rotate-0
bind e exec emacsclient -c
# Binds for the very useful commands inext, cnext etc. (StumpWM not having these and undo functionality
# is the main reason I'm still using ratpoison... Also ratpoison has better multihead support)
bind C-n inext
bind C-N cnext
bind C-p iprev
bind C-P cprev
bind C-t other
bind C-T iother
bind C-M-T cother
bind C-M-t cother
alias xclock-toggle exec ratpoison -c 'unmanage xclock'; (pgrep -f xclock && killall xclock) || LC_ALL=ja_JP.utf8 xclock -digital -update 1 -geometry -0-0 &
bind C-x xclock-toggle
alias lock-screen exec physlock
definekey waitoob t exec mpv "$(xsel -o)"
definekey waitoob T exec mpv "$(xsel -bo)"
alias describe-key describekey root
alias where-is exec ratpoison -c "echo $(ratpoison -c 'help' | grep $(ratpoison -c 'prompt Where is command: ') | xargs -i echo C-t {})" || ratpoison -c 'echo No match'
newkmap help
bind h readkey help
bind C-h readkey help
definekey help c describe-key
definekey help k describekey
definekey help w where-is
alias calc exec ratpoison -c "echo $(calc "$(ratpoison -c 'prompt calc: ')")"
bind plus calc
bind equal calc
alias man colon exec xterm -e man
bind at man
bind C-at man
alias pgrep-l exec ratpoison -c "echo $(pgrep -l $(ratpoison -c 'prompt pgrep -l '))" || ratpoison -c 'echo No results'
alias pgrep-af exec ratpoison -c "echo $(pgrep -af $(ratpoison -c 'prompt pgrep -af '))" || ratpoison -c 'echo No results'
bind M-p pgrep-l
bind M-P pgrep-af
alias uptime exec ratpoison -c "echo $(uptime)"
alias ddate exec ratpoison -c "echo $(ddate)"
alias battery exec ratpoison -c "echo $(emacsclient -e \(battery\))"
alias battery-verbose exec ratpoison -c "echo $(cat /proc/acpi/battery/BAT0/state; echo; emacsclient -e \(battery\))"
alias ifconfig exec ratpoison -c "echo $(which ifconfig > /dev/null && ifconfig || /sbin/ifconfig)"
alias iwconfig exec ratpoison -c "echo $(iwconfig || /sbin/iwconfig || /usr/sbin/iwconfig)"
alias sensors exec ratpoison -c "echo $(sensors)"
alias cpufreq-info exec ratpoison -c "echo `cpupower frequency-info`"
bind C-b battery
bind C-M-b battery-verbose
bind C-i ifconfig
bind C-I iwconfig
# bind V invert-colors
bind C-a uptime
bind C-A ddate
bind C-B sensors
bind B cpufreq-info
definekey top Print exec scrot
bind Print exec scrot
bind C-Print exec scrot -s
alias xpdf exec xpdf -cont -remote fisk
alias xpdf_toggle_cont exec xpdf -remote fisk -exec toggleContinuousMode
alias xpdf_toggle_fs exec xpdf -remote fisk -exec toggleFullScreenMode
alias xpdf_open exec xpdf -remote fisk -exec openFile\($(ratpoison -c prompt)\)
alias xpdf_open_nw exec xpdf -remote fisk -exec openFileInNewWin\($(ratpoison -c prompt)\)
alias xpdf_open_dlg exec xpdf -remote fisk -exec open
alias xpdf_open_nw_dlg exec xpdf -remote fisk -exec openInNewWin
alias xpdf_zoom exec xpdf -remote fisk -exec zoomPercent\($(ratpoison -c prompt)\)
alias xpdf_menu exec ratpoison -c 'ratwarp 500 100'; ratpoison -c 'ratclick 3'; ratpoison -c 'ratrelwarp 10 10'; sleep 0.1; ratpoison -c 'meta Down'
# Moving with mouse madness
# Control mouse with hjklyubn
setenv mouse_step 10
setenv mouse_step_diag 7
setenv mouse_hold_1 f
setenv mouse_hold_2 f
setenv mouse_hold_3 f
alias mouse-set-step exec ratpoison -c "setenv mouse_step $(ratpoison -c 'prompt')"; ratpoison -c "setenv mouse_step_diag $(calc round\($(ratpoison -c 'getenv step')/sqrt\(2\)\) | grep -o '[[:digit:]]*')"
alias mouse-up exec ratpoison -c "ratrelwarp 0 -$mouse_step"
alias mouse-down exec ratpoison -c "ratrelwarp 0 $mouse_step"
alias mouse-left exec ratpoison -c "ratrelwarp -$mouse_step 0"
alias mouse-right exec ratpoison -c "ratrelwarp $mouse_step 0"
alias mouse-up-left exec ratpoison -c "ratrelwarp -$mouse_step_diag -$mouse_step_diag"
alias mouse-up-right exec ratpoison -c "ratrelwarp $mouse_step_diag -$mouse_step_diag"
alias mouse-down-left exec ratpoison -c "ratrelwarp -$mouse_step_diag $mouse_step_diag"
alias mouse-down-right exec ratpoison -c "ratrelwarp $mouse_step_diag $mouse_step_diag"
alias mouse-toggle-1 exec if [ $mouse_hold_1 = 'f' ]; then ratpoison -c 'rathold down 1' -c 'setenv mouse_hold_1 t'; else ratpoison -c 'rathold up 1' -c 'setenv mouse_hold_1 f'; fi
alias mouse-toggle-2 exec if [ $mouse_hold_2 = 'f' ]; then ratpoison -c 'rathold down 2' -c 'setenv mouse_hold_2 t'; else ratpoison -c 'rathold up 2' -c 'setenv mouse_hold_2 f'; fi
alias mouse-toggle-3 exec if [ $mouse_hold_3 = 'f' ]; then ratpoison -c 'rathold down 3' -c 'setenv mouse_hold_3 t'; else ratpoison -c 'rathold up 3' -c 'setenv mouse_hold_3 f'; fi
alias mouse-click-1 exec ratpoison -c 'ratclick 1' -c 'setenv mouse_hold_1 f'
alias mouse-click-2 exec ratpoison -c 'ratclick 2' -c 'setenv mouse_hold_2 f'
alias mouse-click-3 exec ratpoison -c 'ratclick 3' -c 'setenv mouse_hold_3 f'
alias mouse-unhold exec [ $mouse_hold_1 = 't' ] && ratpoison -c 'mouse-toggle-1'; [ $mouse_hold_2 = 't' ] && ratpoison -c 'mouse-toggle-2'; [ $mouse_hold_3 = 't' ] && ratpoison -c 'mouse-toggle-3'; ratpoison -c 'echo Phew!'
newkmap mouse
definekey mouse h mouse-left
definekey mouse l mouse-right
definekey mouse j mouse-down
definekey mouse k mouse-up
definekey mouse q mouse-stop
definekey mouse C-g mouse-stop
definekey mouse Escape mouse-stop
definekey mouse y mouse-up-left
definekey mouse u mouse-up-right
definekey mouse b mouse-down-left
definekey mouse n mouse-down-right
definekey mouse space mouse-click-1
definekey mouse period mouse-click-2
definekey mouse comma mouse-click-3
definekey mouse C-space mouse-toggle-1
definekey mouse C-period mouse-toggle-2
definekey mouse C-comma mouse-toggle-3
definekey mouse M-space mouse-toggle-1
definekey mouse M-period mouse-toggle-2
definekey mouse Mst-comma mouse-toggle-3
alias mouse-start exec ratpoison -c 'set topkmap mouse' -c 'echo Mousey!'
alias mouse-stop exec ratpoison -c 'mouse-unhold' -c 'set topkmap top'
bind m mouse-start
# Keymap for group related actions. Partially inspired by stumpwm default keybinds
newkmap gee
definekey gee m gmove
definekey gee M gmerge
definekey gee s gselect
definekey gee g groups
definekey gee d rpms_gselect-current-desktop
definekey gee c rpms_gselect-current-desktop
definekey gee n gnext
definekey gee p gprev
definekey gee h rpms_gmove-here
bind g readkey gee
## per workspace registers
alias r1-store exec ratpoison -c "setenv desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r1 $(ratpoison -c fdump)"
alias r2-store exec ratpoison -c "setenv desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r2 $(ratpoison -c fdump)"
alias r3-store exec ratpoison -c "setenv desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r3 $(ratpoison -c fdump)"
alias r4-store exec ratpoison -c "setenv desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r4 $(ratpoison -c fdump)"
alias r1-fetch exec ratpoison -c "frestore $(ratpoison -c getenv\ desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r1)"
alias r2-fetch exec ratpoison -c "frestore $(ratpoison -c getenv\ desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r2)"
alias r3-fetch exec ratpoison -c "frestore $(ratpoison -c getenv\ desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r3)"
alias r4-fetch exec ratpoison -c "frestore $(ratpoison -c getenv\ desktop_$(ratpoison -c "getenv rpms_screen_${rpms_selected_screen}_current_desktop")_r4)"
newkmap register
newkmap register-store
newkmap register-fetch
definekey register s readkey register-store
definekey register f readkey register-fetch
definekey register-store 1 r1-store
definekey register-store 2 r2-store
definekey register-store 3 r3-store
definekey register-store 4 r4-store
definekey register-fetch 1 r1-fetch
definekey register-fetch 2 r2-fetch
definekey register-fetch 3 r3-fetch
definekey register-fetch 4 r4-fetch
definekey waitoob r readkey register
# dessa kan tas bort i framtiden vid behov av plats?
definekey waitoob f readkey register-fetch
definekey waitoob s readkey register-store
# being able to toggle borders is a good thing (since ratpoison doesn't care about apps having
# entered fullscreen mode, and will just display borders regardless). for things like mplayer
# borders are a nuisance but for many tiled terminals it becomes easier to remember the current one
alias toggle-borders exec if [ "$(ratpoison -c 'set border')" -ge 1 ]; then ratpoison -c 'set border 0'; else ratpoison -c 'set border 1'; fi
definekey waitoob b toggle-borders
alias toggle-redshift exec killall -USR1 redshift
definekey waitoob z toggle-redshift
exec wpc="${rp_wallpapercmd:-feh --bg-fill}"; ratpoison -c "setenv rp_wallpapercmd ${wpc}"
alias load-wallpaper exec if [ -n "${rp_wallpaper}" ]; then ${rp_wallpapercmd} "${rp_wallpaper}"; fi
load-wallpaper
# Give us 13 (ESC, F1-F12) virtual desktops with rpms
alias rpms-init exec $HOME/.config/ratpoison/bin/rpms init 13
rpms-init
alias randr-update exec ratpoison -c 'load-wallpaper' -c 'rpms-init'
exec wmname LG3D
echo ratpoisonrc loaded successfully