Hidden Config Options

Not all sawfish functionality is exposed through the configuration gui. To change some of these options, copy the relevant parts of this handy list someone else compiled to your ~/.sawfishrc.

Workspace Wrapping

To enable workspace wrapping, add this to your ~/.sawfishrc: (define-special-variable workspace-boundary-mode 'wrap-around)

Making Sawfish Respect Aspect-Ratio Hints

Applications (like mplayer) give the window manager hints about what aspect ratio to use. Unfortunately, sawfish has no code for this, as far as I know so David wrote some. Although primitive, it's better than nothing. Insert this in your ~/.sawfishrc and forget you ever knew about mplayer's -xy option.

(defun respect-aspect-ratio-hint (wobj)
  (let ((min-ar (window-min-aspect wobj))
        (max-ar (window-max-aspect wobj))
        (w (car (window-dimensions wobj)))
        (h (cdr (window-dimensions wobj))))
    (when (and min-ar (> min-ar (/ w h)))
      (resize-window-to wobj w (->int (/ w min-ar))))
    (when (and max-ar (< max-ar (/ w h)))
      (resize-window-to wobj (->int (* h max-ar)) h))))

(add-hook 'after-resize-hook respect-aspect-ratio-hint)

(defun window-min-aspect (wobj)
  (let ((pair (cdr (assoc 'min-aspect (window-size-hints wobj)))))
    (if pair (let ((w (car pair))
                   (h (cdr pair)))
               (/ w h))

(defun window-max-aspect (wobj)
  (let ((pair (cdr (assoc 'max-aspect (window-size-hints wobj)))))
    (if pair (let ((w (car pair))
                   (h (cdr pair)))
               (/ w h))

(defun ->int (n)
  (inexact->exact (round (exact->inexact n))))

DebianNotes/Sawfish (last edited 2008-03-10 01:38:26 by localhost)