UP | HOME

Sawfish init

Table of Contents

1 The menu

I barely use the graphical menu, but if I do use it there ars some applications that I woud prefer accessing more easily.

(setq user-apps-menu
      '(("Emacs" (system "emacsclient -c &"))
        ("Terminal" (system "urxvt &"))))

2 Keybindings

2.1 Window management

I've been using tiling window managers (both automatic and manual) for a good while now, and although it might not necessarily be what I need, the ability to manage the windows completely from the keyboard is very nice.

2.1.1 Packing

… is moving the window all the way to a side of a screen, or the side of the closest window in that direction.

(define oni:window-packing-keymap (make-keymap))

(bind-keys oni:window-packing-keymap
           "p" 'pack-window-up
           "n" 'pack-window-down
           "b" 'pack-window-left
           "f" 'pack-window-right)

2.1.2 Growing

… is re-sizing the window all the way to a side of a screen, or the side of the closest window in that direction.

(define oni:window-growing-keymap (make-keymap))

(bind-keys oni:window-growing-keymap
           "p" 'grow-window-up
           "n" 'grow-window-down
           "b" 'grow-window-left
           "f" 'grow-window-right)

2.1.3 Shrinking

… is re-sizing the window until it overlaps with one less window.

(define oni:window-shrinking-keymap (make-keymap))

(bind-keys oni:window-shrinking-keymap
           "p" 'shrink-window-up
           "n" 'shrink-window-down
           "b" 'shrink-window-left
           "f" 'shrink-window-right)

2.1.4 Yanking

… is moving the window until it overlaps with one less window.

(define oni:window-yanking-keymap (make-keymap))

(bind-keys oni:window-yanking-keymap
           "p" 'yank-window-up
           "n" 'yank-window-down
           "b" 'yank-window-left
           "f" 'yank-window-right)

2.1.5 Bringing it together

Other than the Packing, Growing, Shrinking and Yanking functions I like being able to maximize the windows I work with, since that's how I usually use them.

(define oni:window-management-keymap (make-keymap))

(bind-keys oni:window-management-keymap
           "M" 'maximize-window-toggle
           "p" oni:window-packing-keymap
           "g" oni:window-growing-keymap
           "s" oni:window-shrinking-keymap
           "y" oni:window-yanking-keymap)

2.2 Music

I like to listen to music sometimes, and using media keys on your keyboard is very handy if you always have something running like MPD.

(bind-keys global-keymap
           "XF86AudioPlay" '(run-shell-command "mpc toggle")
           "XF86AudioStop" '(run-shell-command "mpc stop")
           "XF86AudioMute" '(run-shell-command "amixer sset Master toggle")
           "XF86AudioLowerVolume" '(run-shell-command "mpc volume -5")
           "XF86AudioRaiseVolume" '(run-shell-command "mpc volume +5")
           "XF86AudioPrev" '(run-shell-command "mpc prev")
           "XF86AudioNext" '(run-shell-command "mpc next"))

2.3 Other key bindings

Super-x seemed like a nice idea, since so many things in emacs start with C-x. And then the w in oni:extended-keymap is, of course, for "Window".

I keep the comments around global-keymap because whenever I change anything in that keymap I have to run those commands before and after changing the keymap.

(define oni:extended-keymap (make-keymap))

(bind-keys oni:extended-keymap
           "w" oni:window-management-keymap)

;; (ungrab-keymap global-keymap)
(bind-keys global-keymap
           "C-M-l" '(run-shell-command "i3lock -c \"#000000\"")
           "Super-e" '(run-shell-command (getenv "EDITOR"))
           "Super-w" '(run-shell-command (getenv "BROWSER"))
           "Super-c" '(run-shell-command "urxvt")
           "Super-TAB" 'cycle-windows
           "Super-x" oni:extended-keymap
           "Menu" 'popup-root-menu)
;; (grab-keymap global-keymap)

3 Theme

My window manager not only has to work well, it has to look good too.

(setq default-frame-style 'naquadah)

4 Automatic window options

In order for me to pay less attention to such things I will need certain windows to be automatically placed in certain positions.

(require 'sawfish.wm.ext.match-window)

(add-window-matcher '((WM_CLASS . "^Navigator/Firefox$"))
                    '((position . north-east)
                      (maximized . t)))

Date: 02-07-2012 12:25:18

Org version 7.8.11 with Emacs version 24

Validate XHTML 1.0