1 ; Sawfish configuration
2 ; http://sawmill.sourceforge.net/
4 ; Author: Sridhar Ratnakumar
6 (setq work-system-name "sridharr-laptop")
8 (system "xmodmap ~/.xmodmap")
9 ;; xkbcomp hack! (ugly)
10 (system "~/.sawfish/xkbcomp-hack.sh")
13 (system "xsetbg -fullscreen ~/background")
15 (require 'jump-or-exec) ;; TODO: deprecate this code (it does trivial stuff)
17 (defun open-app (title-re class)
18 "open windows with Title matching `title-re' and windows class as `class'"
22 ;; jump/minimize or exec
23 (defun bind-key-for-app (key title-re command)
24 (bind-keys global-keymap
25 key `(jump-or-exec ,title-re
28 (concat command " &")))
30 (let (old-ws (car (window-workspaces wind)))
31 (toggle-window-iconified wind))))))
34 (defun terminal-cmd (title command)
35 (concat "gnome-terminal --hide-menubar -t '" title "' -e '" command "'"))
37 (defun terminal-cmd-bg (title command)
38 (concat (terminal-cmd title command)
41 (bind-key-for-app "Super-e" "^emacs.*@" "/usr/bin/emacs-snapshot")
42 (bind-key-for-app "Super-t" "^Terminal$"
43 (terminal-cmd "Terminal" "screen -dRR"))
44 (bind-key-for-app "Super-f" "Firefox$" "~/firefox/firefox")
45 (bind-key-for-app "H-g" "^Buddy List$" "gaim")
46 (bind-key-for-app "Super-d" ".*DrScheme[\*]?$" "/usr/bin/drscheme")
47 (bind-key-for-app "Super-h" "Help Desk" "ls")
50 (when (string= (system-name) work-system-name)
51 (bind-key-for-app "Super-m" "Evolution$" "evolution")
52 (bind-key-for-app "Hyper-m" "^Compose Message$" "ls")
53 ; xterm for personal-work or procrastination
54 (bind-key-for-app "Super-t" "^Terminal$"
55 (terminal-cmd "Terminal"
56 "ssh sridharr.desktop.amazon.com "))
57 (bind-key-for-app "Super-p" "^Terminal .Personal.$"
58 (terminal-cmd "Terminal (Personal)" "screen -dRR")))
61 (bind-keys global-keymap "Super-Hyper-l"
62 `,(lambda () (system "xscreensaver-command -lock &")))
63 (bind-keys global-keymap "H-w" `(popup-window-list))
66 (defun display-windows-for-class (class #!optional filter-p)
67 (map-windows (lambda (w)
68 (when (and (string= class (window-class w))
69 (if (functionp filter-p) (filter-p w) #t))
70 (format t "display window: %s" (window-full-name w))
74 (bind-keys global-keymap "Super-r"
75 `,(lambda () (display-windows-for-class "Exaile")))
77 (defun display-gaim-windows ()
78 (defun not-buddy-list (w)
79 (not (string= "Buddy List" (window-full-name w))))
80 (display-windows-for-class "Gaim" not-buddy-list))
82 ;; display all IM windows
83 (bind-keys global-keymap "Super-g" `(display-gaim-windows))
85 (bind-keys global-keymap "Super-0"
86 `,(lambda () (system "display /home/srid/dvorak/keycaps.gif &")))
90 (if (string= (system-name) work-system-name)
92 (system "xscreensaver &")
93 (system (terminal-cmd-bg "Terminal" "ssh sridharr.desktop.amazon.com"))
94 (system (terminal-cmd-bg "Terminal (Personal)" "screen -dRR"))
95 (system "evolution &")))
96 ; (system (terminal-cmd-bg "Terminal" "screen -dRR")))