-
Notifications
You must be signed in to change notification settings - Fork 0
/
rc
386 lines (312 loc) · 13.1 KB
/
rc
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
382
383
384
385
386
;; Josh's sawfish configuration
;;
(unbind-keys window-keymap)
(define max-keymap (make-keymap))
( bind-keys max-keymap
"W-d" 'maximize-discard
"W-m" 'maximize-window-toggle
"W-v" 'maximize-window-vertically-toggle
"W-h" 'maximize-window-horizontally-toggle
"W-u" 'maximize-window-fullscreen-toggle
"W-f" 'maximize-fill-window-toggle)
(define term-keymap (make-keymap))
( bind-keys term-keymap
"y" '( jump-or-exec "xtermMplayer" "xterm -title xtermMplayer" t ))
(define emacs-keymap (make-keymap))
( bind-keys emacs-keymap
"a" '( jump-or-exec "Aptitude" "xterm -title Aptitude -e 'sudo aptitude'" )
"o" '( system "emacsclient -e '(org-clock-out)' -e '(org-save-all-org-buffers)' &" )
"x" '( system "emacsclient -e '(org-clock-cancel)' -e '(org-save-all-org-buffers)' &" )
"b" '( jump-or-exec "UC Berkeley Mail" "chromium --new-window http://bmail.berkeley.edu" t )
"m" '( jump-or-exec "\\*Man" "emacsclient -c -e '(call-interactively (quote man))'" t )
"c" '( jump-or-exec "Google Calendar" "chromium --new-window http://calendar.google.com" t ))
( bind-keys global-keymap
"W-S-e" emacs-keymap)
(setq grow-is-maximize nil)
( bind-keys window-keymap
"W-m" max-keymap
"W-`" 'popup-window-menu
"W-S-Up" 'pack-window-up
"W-S-Down" 'pack-window-down
"W-S-Left" 'pack-window-left
"W-S-Right" 'pack-window-right
"W-M-S-Up" 'move-window-up
"W-M-S-Down" 'move-window-down
"W-M-S-Left" 'move-window-left
"W-M-S-Right" 'move-window-right
"W-C-Up" 'grow-window-up
"W-C-Down" 'grow-window-down
"W-C-Left" 'grow-window-left
"W-C-Right" 'grow-window-right
"W-M-Up" 'shrink-window-up
"W-M-Down" 'shrink-window-down
"W-M-Left" 'shrink-window-left
"W-M-Right" 'shrink-window-right
"W-Prior" 'raise-window
"W-Next" 'lower-window
"W-C-Prior" 'raise-window-depth
"W-C-Next" 'lower-window-depth
"W-Button3-Move" 'resize-window-interactively
"W-Button1-Move" 'move-window-interactively
"W-Button1-Click2" 'maximize-window-toggle
"W-Button3-Click2" '(remove-transparency (input-focus))
"W-Button4-Click" '(opacity-increment (input-focus) 5)
"W-Button5-Click" '(opacity-increment (input-focus) -5)
"M-F4" 'delete-window
"W-C-k" 'delete-window ; It's hard to Alt-F4 on certain keyboards
)
(require 'opacity-tools)
(define (lockscreen)
"Lock the screen"
( system "i3lock -d -c 008b8b &" ))
(define-command 'lockscreen lockscreen)
( bind-keys global-keymap
"W-c" '( system "sawfish-config &" )
"C-W-e" 'display-errors
;; "C-W-r" 'restart
;; "C-W-q" 'quit
;; "W-TAB" 'cycle-windows
"W-S-n" '(next-workspace 1)
"W-S-p" '(previous-workspace 1)
;; "W-C-TAB" 'cycle-group
"W-t" term-keymap
;; "C-TAB" 'cycle-windows-backwards
"W-M-S-l" '(system "xterm -e ~/.sawfish/scripts/lockscreen-run.sh ~/.sawfish/scripts/fingerprint-lock.sh &")
"W-S-l" '(system "~/.sawfish/scripts/lockscreen-run.sh ~/.sawfish/scripts/fingerprint-xtrlock.sh &")
"W-M-l" '(system "~/.sawfish/scripts/lockscreen-run.sh xtrlock &")
"XF86ScreenSaver" 'lockscreen
"W-S-m" 'popup-apps-menu
"W-w" 'popup-window-list-menu
;; "C-Menu" 'popup-root-menu
;; "S-Menu" 'popup-apps-menu
"W-S-x" '( system "dmenu_run &" )
;; "Print" '( system "import -border window.png &" )
;; "C-Print" '( system "import -window root root.png &" )
;; "W-F2" `( jump-or-exec "Gnome-run-dialog" "gnome-run-dialog" t )
;; "W-F6" `( jump-or-exec "Geeqie" "geeqie" nil )
"W-e" '( system "emacsclient -c -a '' &" t )
"W-Home" `( jump-or-exec "Home" "nautilus --no-desktop ~" t ) )
;; Browser keys
( bind-keys global-keymap
"W-r" '( system "chromium &" )
"W-S-r" '( system "chromium --incognito &" )
"W-f" '( system "firefox &" )
"W-S-f" '( system "firefox -private-window &" ))
;; Open last download
( bind-keys global-keymap
"W-S-d" '( system "~/.sawfish/scripts/open-last-download.sh &" ))
;; Nautilus
( bind-keys global-keymap
"W-n" '( system "nautilus &" )
"W-C-n" '( system "pkill nautilus &" ))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Bind workspaces to keys
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(define (make-list i stop)
(if (> i stop) '()
(cons i (make-list (+ i 1) stop))))
(define (bind-workspace i)
(bind-keys global-keymap
(concat "W-F" (number->string i))
(list 'select-workspace i)))
(mapc bind-workspace (make-list 1 12))
(bind-keys global-keymap
"W-ESC" '(select-workspace 0))
;; Remember last workspace
(defvar last-workspace 0)
(define (josh-remember-workspace)
(setq last-workspace current-workspace))
(add-hook 'leave-workspace-hook josh-remember-workspace)
(define (josh-pop-last-workspace)
(select-workspace last-workspace))
(bind-keys global-keymap
"W-p" '(josh-pop-last-workspace))
(setq viewport-boundary-mode 'dynamic)
(bind-keys global-keymap
"W-Left" '(move-viewport -1 0)
"W-Right" '(move-viewport 1 0)
"W-Down" '(move-viewport 0 1)
"W-Up" '(move-viewport 0 -1))
(bind-keys global-keymap
"C-W-d" 'toggle-desktop)
;; Window Matchers
;; ( add-window-matcher '( ( WM_CLASS . "^Sawfishpager/sawfishpager$" ) )
;; '( ( position . south-east )
;; ( fixed-positon . t )
;; ( never-maximize . t )
;; ( never-iconify . t )
;; ( frame-type . none )
;; ( cycle-skip . t )
;; ( window-list-skip . t )
;; ( sticky . t )
;; ( avoid . () ) ;So we can maximize over this guy
;; ( sticky-viewport . t )
;; ( depth . 16 ) ) )
(require 'place-window-half)
( add-window-matcher '( ( WM_CLASS . "TopLevelShell" ) )
'( ( group . AFNI ) ))
( add-window-matcher '( ( WM_CLASS . "^AFNI/afni$" ) )
'( ( group . AFNI ) ))
;; To have my top panel in place
( add-window-matcher '( ( WM_NAME . "^ceftoolbar$" ) )
'( ( depth . -14 )
( position . north-west )
( opacity . 100 )
( dock-type . t )
( avoid . t)
( ignored . t)
( fixed-positon . t )))
( add-window-matcher '( ( WM_NAME . "^sawfishpager$" ) )
'( ( ignored . t)))
( add-window-matcher '( ( WM_NAME . "^stalonetray$" ) )
'( ( depth . -16 )
( opacity . 100 )) )
( add-window-matcher '( ( WM_CLASS . "^XTerm/xterm$" ) )
'( ( place-mode . under-pointer ) ))
( add-window-matcher '( ( WM_CLASS . "URxvt" ) )
'( ( place-mode . under-pointer ) ))
(require 'josh-expand)
(bind-keys global-keymap
"W-C-Button4-Click" '(expand-window (input-focus) 5)
"W-C-Button5-Click" '(expand-window (input-focus) -5)
"W-S-C-Button4-Click" '(expand-all 5)
"W-S-C-Button5-Click" '(expand-all -5))
(require 'subdivide)
(bind-keys global-keymap
"W-C-S-Left" 'half-window-left
"W-C-S-Right" 'half-window-right
"W-C-S-Up" 'half-window-up
"W-C-S-Down" 'half-window-down)
;; Some experimental tiling stuff
(define subd-keymap (make-keymap))
( bind-keys global-keymap
"W-a" subd-keymap)
( bind-keys subd-keymap
"s" '(master-wind (input-focus))
"W-s" '(binary-tile-master (input-focus) 20)
"b" '(binary-tile (viewport-windows-filtered) (calculate-workarea) 10)
"W-a" '(fan-win-area (input-focus) (shrink-rect (subd (calculate-workarea) 'left) 20))
"W-d" '(fan-win-area (input-focus) (shrink-rect (subd (calculate-workarea) 'right) 20))
"W-w" '(fan-win-area (input-focus) (shrink-rect (subd (calculate-workarea) 'up) 20))
"W-x" '(fan-win-area (input-focus) (shrink-rect (subd (calculate-workarea) 'down) 20))
"W-e" '(fan-win-area (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'right) 'up) 20))
"W-c" '(fan-win-area (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'right) 'down) 20))
"W-q" '(fan-win-area (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'left) 'up) 20))
"W-z" '(fan-win-area (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'left) 'down) 20))
"a" '(true-move (input-focus) (shrink-rect (subd (calculate-workarea) 'left) 20))
"d" '(true-move (input-focus) (shrink-rect (subd (calculate-workarea) 'right) 20))
"w" '(true-move (input-focus) (shrink-rect (subd (calculate-workarea) 'up) 20))
"x" '(true-move (input-focus) (shrink-rect (subd (calculate-workarea) 'down) 20))
"e" '(true-move (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'right) 'up) 20))
"c" '(true-move (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'right) 'down) 20))
"q" '(true-move (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'left) 'up) 20))
"z" '(true-move (input-focus) (shrink-rect (subd (subd (calculate-workarea) 'left) 'down) 20))
"W-v" '(fan-windows-all 20 20)
"W-f" '(fan-windows-master (input-focus) 20 20))
(bind-keys subd-keymap
"t" '(toggle-opacity-viewport)
"W-t" '(toggle-opacity-viewport))
(bind-keys global-keymap
"W-i" '(binary-tile-master (input-focus) 20)
"W-C-i" '(fan-windows-all 20 20))
(require 'sawfish.wm.placement.smart)
( bind-keys subd-keymap
"f" '(sp-do-placement (input-focus) sp-first-fit)
"b" '(sp-do-placement (input-focus) sp-best-fit))
(require 'swap-windows)
(bind-keys subd-keymap
"g" 'josh-swap-window-interactively
"W-g" 'josh-swap-window-interactively)
;; Linked resizing of windows
;; Basically resizing a window adjusts neighboring ones as well
(require 'josh-linked-resize)
(bind-keys window-keymap
"W-C-Button3-Move" 'linked-resize-window-interactively)
;; I keep confusing Emacs's "search" and Chromium's "save"
;; (add-window-matcher
;; '((WM_NAME . "Chromium"))
;; '((keymap-trans . (("C-s" "C-f")))))
(remove-window-matcher
'((WM_NAME . "Chromium"))
'((maximized . all)))
(define (bind-emacs)
"Get an Emacs window and bind it to W-3"
(let ((w (get-window-by-class "Emacs")))
(true-move w (shrink-rect (subd (calculate-workarea) 'left) 20))
(set-frame-style w 'candido)
(josh-bind-window "3" w)))
(define (initfunction)
"Kind of like FVWM's InitFunction, only run the first time and
not during restarts."
(if (file-exists-p "~/.sawfish/.restart_sawfish")
(delete-file "~/.sawfish/.restart_sawfish")
(system "~/.sawfish/scripts/initfunction-scripts.sh &")
(make-timer (bind-emacs) 5)))
(define (startfunction)
"Kind of like FVWM's StartFunction. Run each time Sawfish starts."
(system "~/.sawfish/scripts/startfunction-scripts.sh &"))
(define (restartfunction)
"Kind of like FVWM's RestartFunction. Run each time Sawfish restarts."
(system "touch ~/.sawfish/.restart_sawfish &")
(delete-window (get-window-by-name "ceftoolbar")))
(add-hook 'before-restart-hook restartfunction)
(add-hook 'after-initialization-hook initfunction)
(add-hook 'after-initialization-hook startfunction)
;; stalonetray -bg "black" --geometry 10x1-0+0 --grow-gravity W --icon-gravity NE --icon-size 16 --dockapp-mode simple
;; synclient VertEdgeScroll=1
;; trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 10 --transparent true --tint 0x191970 --height 14
;; (window-plist (get-window-by-class "trayer"))
;; Example Tiling configuration in Sawfish's resource file
;; (require 'sawfish.wm.tile.tile)
;; (tall-tiling 1 #:width 1.75 #:top 14 #:bottom 0 #:gap 3 #:max 5 #:right nil #:resize t)
;; (tall-tiling 2 #:width 1.75 #:top 14 #:bottom 0 #:gap 3 #:max 5 #:right nil #:resize t
;; #:master (lambda (win) (not (string-match "^xterm$" (window-name win)))) )
;; (col-tiling 0 #:top 0 #:bottom 0 #:gap 3 #:cols 3 #:resize t)
(bind-keys global-keymap
"C-M-Right" 'tall-rotate-right
"C-M-Left" 'tall-rotate-left
"M-=" 'increase-max-windows
"M--" 'decrease-max-windows
"W-t" 'next-tiling)
;; (bind-keys global-keymap
;; "XF86MonBrightnessUp" '(system "xbacklight -inc 2% &")
;; "XF86MonBrightnessDown" '(system "xbacklight -dec 2% &")
;; "S-XF86MonBrightnessDown" '(system "xbacklight -set 1 &"))
(bind-keys global-keymap
"XF86MonBrightnessUp" '(system "sudo terrible-backlight up &")
"XF86MonBrightnessDown" '(system "sudo terrible-backlight down &")
"S-XF86MonBrightnessDown" '(system "sudo terrible-backlight minimum&"))
(bind-keys global-keymap
"XF86Launch1" '(system "mplayer -fs ~/video/NitoriGetDown.mp4 &"))
(setq move-lock-when-maximized nil)
(require 'sawfish.wm.ext.pager)
(add-hook 'after-initialization-hook pager t)
(require 'dictator-scratch)
(require 'test-screenshot)
(require 'record-window)
(require 'josh-window)
(require 'josh-wallpaper)
(require 'josh-music-hotkeys)
(require 'padded-maximize)
(require 'copy-paste)
(require 'window-to-largest-rectangle)
(require 'cycle-obscure)
(require 'other-window-stuff)
;; Load undo
(setq load-path (cons "~/.sawfish/next-lisp/" load-path))
(require 'undo)
(bind-keys global-keymap
"W-z" 'undo
"W-C-z" 'undo-redo)
(bind-keys global-keymap
"W-C-x" '(system "urxvt &"))
;; (require 'sawfish.wm.ext.cabinet)
;; (bind-keys global-keymap "W-s" 'cabinet-switch)
;; (nconc cabinet-filter-out-for-display-list
;; '("^dzenLEFT$" "^dzenRIGHT$" "^stalonetray" "^ConkyCPU$" "^sawfishpager$"))
(bind-keys title-keymap
"Button3-Click" 'popup-window-ops-menu
"Button1-Click2" 'iconify-window)
;; Local Variables:
;; mode:sawfish
;; End: