My Sawfish Resource Control file
A.J.Hurst
Version 1.2.2
Table of Contents
1. Introduction
FVWM was a really cool window manager. Well, it still is, but
I say "was" because I have moved to GNOME recently, and
FVWM is non-compliant, so I thought it time to change. While I
am generally reluctant to change for the sake of change,
somethings have to move along, so here we are.
This document is reconstructed from an earlier literate program
definition of the FVWM resource file, in an attempt to provide
some consistency between implementations during the cross-over.
In practice, about all that has survived are the section
headings. They seemed reasonably relevant, so I have stuck with
them, but several of them are still empty at present.
There will always be some variations between systems, even if
it is just at the level of defining pull-down menus for logging
in. Hence this document is written as a parameterized literate
program. The reader not familiar with literate programming is
referred to Knuth's excellent original article: Knuth, D.E.,
Literate Programming, Computer J., 27(2):97-111(1984).
The tool used here is xlp, a local derivative of
nuweb by Briggs, P., Nuweb,
ftp://ftp.cs.rmit.edu.au/tex-archive/web/nuweb/nuweb0.87b/,
as of 31 Jul 1997, and described in Hurst, A.J., Nutweb,
http://www.cs.monash.edu.au/~ajh/research/literate/nutweb-1.12.tar.gz,
as of 2 Sep 1997.
This document describes the resource control file for the
window manager sawfishmill. These definitions set up the window
layout with my preferences. Each of the following code
fragments is described in its own section.
"sawfishrc" 1
=
<desktops and pagers 2>
<window parameters 3>
<style settings 4>
<mouse bindings 5>
<keyboard shortcuts 42>
<startups 43>
<other stuff 44>
<>
2. Desktops and Pagers
<desktops and pagers 2>
=
<>
Macro referenced in scrap <1>.
3. Window Parameters
<window parameters 3>
=
<>
Macro referenced in scrap <1>.
4. Style Settings
<style settings 4>
=
<>
Macro referenced in scrap <1>.
5. Mouse Bindings
Here's what I want in the way of mouse clicks
<mouse bindings 5>
=
<global mouse bindings 6>
<root window mouse bindings 7>
<window body mouse bindings 31>
<title bar mouse bindings 32>
<menu button mouse bindings 38>
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
5.1. Global Mouse Button Bindings
<global mouse bindings 6>
=
;(bind-keys global-keymap "C-S-Button1-Click" '(popup-root-menu))
;(bind-keys global-keymap "C-S-Button2-Click" '(popup-apps-menu))
;(bind-keys global-keymap "C-S-Button3-Click" '(popup-warp-menu))
;(bind-keys global-keymap "M-Button1-Click" '(popup-window-list))
;(bind-keys global-keymap "A-Button1-Click" '(popup-warp-menu))
<>
Macro referenced in scrap <5>.
These are the same bindings as for the unmodified root window
bindings.
5.2. Root Window Mouse Button Bindings
<root window mouse bindings 7>
=
(bind-keys root-window-keymap "Button1-Click" '(popup-root-menu))
(bind-keys root-window-keymap "Button2-Click" '(popup-apps-menu))
(bind-keys root-window-keymap "Button3-Click" '(popup-warp-menu))
<>
Macro defined by scraps <7>, <8>.
Macro referenced in scrap <5>.
The three functions popup-window-menu,
popup-apps-menu, and popup-root-menu are defined
in the sawfish library menus.jl, and are assumed here.
The applications defined in the apps-menu are defined
below. Note that the Button 3 binding here refers to
popup-window-list, which is defined in
workspace.jl.
<root window mouse bindings 8>
=
(setq apps-menu `(("logins" <logins for <$1 hawthorn 0> 11>)
()
("applications" <applications for <$1 hawthorn 0> 20>)
()
("Root Image" <root image menu 30>)
))
<>
Macro defined by scraps <7>, <8>.
Macro referenced in scrap <5>.
<logins for horsham 9>
=
("local" (system "xterm -bg \"<horsham colour 22>\" -e bash &"))
("hawthorn" (system "xterm -bg \"<hawthorn colour 23>\" <remote login twin position 29> -e ssh 130.194.226.24 &"))
("junee" (system "xterm -bg \"<junee colour 24>\" <remote login twin position 29> -e ssh junee &"))
("fangorn" (system "xterm -bg \"<fangorn colour 28>\" -e ssh fangorn.csse.monash.edu.au &"))
("cerg" (system "xterm -bg \"<cerg colour 26>\" -e ssh cerg.csse.monash.edu.au &"))
("redfern" (system "xterm -bg \"<redfern colour 21>\" -e ssh redfern &"))
("nautilus" (system "xterm -bg \"<nautilus colour 27>\" <j-to-n 17> &"))
("www.infotech" (system "xterm -bg \"<sunweb colour 25>\" <j-to-w 18> &"))
<>
Macro never referenced.
<logins for junee 10>
=
("local" (system "xterm -bg \"<junee colour 24>\" -e bash &"))
("horsham" (system "xterm -bg \"<horsham colour 22>\" <remote login twin position 29> <j-to-ho 16> &"))
("hawthorn" (system "xterm -bg \"<hawthorn colour 23>\" <remote login twin position 29> -e ssh hawthorn&"))
("nexus" (system "xterm -bg \"<nexus colour 0>\" -e ssh nexus.csse.monash.edu.au &"))
("cerg" (system "xterm -bg \"<cerg colour 26>\" -e ssh cerg.csse.monash.edu.au &"))
("redfern" (system "xterm -bg \"<redfern colour 21>\" -e ssh redfern &"))
("nautilus" (system "xterm -bg \"<nautilus colour 27>\" <j-to-n 17> &"))
("www.infotech" (system "xterm -bg \"<sunweb colour 25>\" <j-to-w 18> &"))
<>
Macro never referenced.
<logins for hawthorn 11>
=
("local" (system "xterm -bg \"<hawthorn colour 23>\" -e bash &"))
("horsham" (system "xterm -bg \"<horsham colour 22>\" <remote login twin position 29> <h-to-ho 13> &"))
("junee" (system "xterm -bg \"<junee colour 24>\" <remote login twin position 29> <h-to-j 12> &"))
("nexus" (system "xterm -bg \"<nexus colour 0>\" -e ssh nexus &"))
("cerg" (system "xterm -bg \"<cerg colour 26>\" -e ssh cerg &"))
("redfern" (system "xterm -bg \"<redfern colour 21>\" <h-to-r 14> &"))
("www.infotech" (system "xterm -bg \"<sunweb colour 25>\" <h-to-w 15> &"))
<>
Macro referenced in scrap <8>.
<h-to-j 12>
=
-e ssh c19062.eburwd1.vic.optusnet.com.au<>
Macro referenced in scrap <11>.
<h-to-ho 13>
=
-e ssh horsham<>
Macro referenced in scrap <11>.
<h-to-r 14>
=
-e ssh hurst.bpc-users.org<>
Macro referenced in scrap <11>.
<h-to-w 15>
=
-e ssh www.infotech.monash.edu.au<>
Macro referenced in scrap <11>.
<j-to-ho 16>
=
-e ssh horsham<>
Macro referenced in scrap <10>.
<j-to-n 17>
=
-e ssh nautilus<>
Macro referenced in scraps <9>, <10>.
<j-to-w 18>
=
-e ssh www.infotech.monash.edu.au<>
Macro referenced in scraps <9>, <10>.
<applications for junee 19>
=
("emacs" (system "/usr/bin/emacs &"))
("mozilla" (system "/usr/bin/mozilla &"))
("netscape" (system "/home/ajh/bin/netscape &"))
("gtimer" (system "/usr/bin/gtimer &"))
("Gimp" (system "/usr/bin/gimp &"))
("Restart" restart)
<>
Macro never referenced.
<applications for hawthorn 20>
=
("jpilot" (system "/home/ajh/bin/jpilot &"))
("emacs" (system "/usr/bin/emacs &"))
("netscape" (system "/home/ajh/bin/netscape &"))
("StarOffice" (system "/dos/office52/soffice &"))
("Gimp" (system "/usr/bin/gimp &"))
("Restart" restart)
<>
Macro referenced in scrap <8>.
<redfern colour 21>
=
rgb:ff/cc/99<>
Macro referenced in scraps <9>, <10>, <11>.
<horsham colour 22>
=
rgb:ff/ff/cc<>
Macro referenced in scraps <9>, <10>, <11>.
<hawthorn colour 23>
=
rgb:cc/ff/ff<>
Macro referenced in scraps <9>, <10>, <11>.
<junee colour 24>
=
rgb:cc/ff/cc<>
Macro referenced in scraps <9>, <10>, <11>.
<sunweb colour 25>
=
rgb:cc/cc/ff<>
Macro referenced in scraps <9>, <10>, <11>.
<cerg colour 26>
=
rgb:cc/99/ff<>
Macro referenced in scraps <9>, <10>, <11>.
<nautilus colour 27>
=
rgb:99/ff/cc<>
Macro referenced in scraps <9>, <10>.
<fangorn colour 28>
=
rgb:99/cc/ff<>
Macro referenced in scrap <9>.
<remote login twin position 29>
=
-geometry +258-0<>
Macro referenced in scraps <9>, <10>, <11>.
<root image menu 30>
=
("score"
("score 0" (system "rootimage score 0"))
("score 1" (system "rootimage score 1"))
("score 2" (system "rootimage score 2"))
("score 3" (system "rootimage score 3"))
("score 4" (system "rootimage score 4"))
("score 5" (system "rootimage score 5"))
("score 6" (system "rootimage score 6"))
("score 7" (system "rootimage score 7"))
("score 8" (system "rootimage score 8"))
("score 9" (system "rootimage score 9"))
("score 10" (system "rootimage score 10"))
)
()
("reshow" (system "rootimage reshow"))
("next" (system "rootimage next"))
("slideshow" (system "rootimage stay &"))
("kill" (system "rootimage kill"))
<>
Macro referenced in scrap <8>.
5.3. Window Body Mouse Button Bindings
<window body mouse bindings 31>
=
(bind-keys window-keymap "Button1-Click"
'(raise-window-and-pass-through-click (input-focus)))
<>
Macro referenced in scrap <5>.
5.4. Title Bar Mouse Button Bindings
<title bar mouse bindings 32>
=
(bind-keys title-keymap "Button1-Off" '(raise-window (input-focus)))
(bind-keys title-keymap "Button2-Click"
'(popup-windows-menu))
(bind-keys title-keymap "Button3-Off" '(lower-window (input-focus)))
<>
Macro referenced in scrap <5>.
5.5. Mouse Binding Support Routines
<mouse bindings 33>
=
;(defun make-ws-list ()
; (let ((ws-num 0))
; (mapcar (lambda (n)
; (progn
; (setq ws-num (+1 ws-num))
; (cons n `(select-workspace ws-num)))
; )
; workspace-names)
; )
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<mouse bindings 34>
=
;(defun popup-windows-menu ()
; (interactive)
; (popup-menu '(
; ("go to" . workspace-menu)
; ("send to" . send-to-ws-list)
; ("Next" send-to-next-workspace)
; ("Prev" send-to-previous-workspace)
; ("Next and Stay" send-window-to-next-and-stay)
; ("Prev and Stay" send-window-to-prev-and-stay)
; ))
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<mouse bindings 35>
=
;(defun send-to-ws-list ()
; (let*
; ((limits (workspace-limits))
; (i (car limits))
; menu)
; (while (<= i (cdr limits))
; (let ((ws-name (format nil
; (_ "%d: %s")
; i
; (or (nth (- i (car limits)) workspace-names)
; (format nil (_ "space %d")
; (1+ (- i (car limits))))
; ))))
; (setq menu (cons (list (format nil (_ "%s%s") ws-name
; (if (= i current-workspace) " *" ""))
; `(ws-move-window (input-focus) current-workspace ,i))
; menu)))
; (setq i (1+ i)))
; (nreverse menu)
; )
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<mouse bindings 36>
=
;(defun send-window-to-next-and-stay ()
; (interactive)
; (send-to-next-workspace (input-focus) 1)
; ;(previous-workspace 1)
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<mouse bindings 37>
=
;(defun send-window-to-prev-and-stay ()
; (interactive)
; (send-to-prev-workspace (input-focus) 1)
; ;(next-workspace 1)
; )
;(setq workspace-names '("Admin" "Work" "Mail" "StarOffice"))
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<menu button mouse bindings 38>
=
;(bind-keys menu-button-keymap "Button1-Click1" '(popup-send-window-menu))
;(bind-keys menu-button-keymap "Button3-Click1" '(popup-window-menu))
<>
Macro referenced in scrap <5>.
<mouse bindings 39>
=
;(defun popup-send-window-menu ()
; (interactive)
; (popup-menu `(
; ("send to" . send-to-ws-list)
; ))
; )
;
;(defvar send-window-menu
; (let*
; ((limits (workspace-limits))
; (i (car limits))
; menu)
; (while (<= i (cdr limits))
; (let ((ws-name (format nil
; (_ "%d: %s")
; i
; (or (nth (- i (car limits)) workspace-names)
; (format nil (_ "space %d")
; (1+ (- i (car limits))))
; ))))
; (setq menu (cons (list (format nil (_ "%s%s") ws-name
; (if (= i current-workspace) " *" ""))
; `(ws-move-window (input-focus) current-workspace ,i))
; menu)))
; (setq i (1+ i)))
; (nreverse menu)
; )
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
Build a menu that has a list of workspaces (with names if
they've got them). Clicking on a workspace name will send the
window to that workspace.
<mouse bindings 40>
=
;(defun popup-warp-menu ()
; (interactive)
; (popup-menu (move-to-workspace-menu))
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
<mouse bindings 41>
=
;(defun move-to-workspace-menu ()
; (let*
; ((limits (workspace-limits))
; (i (car limits))
; menu)
; (while (<= i (cdr limits))
; (let ((ws-name (format nil
; (_ "%d: %s")
; i
; (or (nth (- i (car limits)) workspace-names)
; (format nil (_ "space %d")
; (1+ (- i (car limits))))
; ))))
; (setq menu (cons (list (format nil (_ "%s%s") ws-name
; (if (= i current-workspace) " *" ""))
; `(select-workspace ,i))
; menu)))
; (setq i (1+ i)))
; (nreverse menu)
; )
; )
<>
Macro defined by scraps <5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>.
Macro referenced in scrap <1>.
6. Keyboard Shortcuts
Here's what I want in the way of keyboard shortcuts or
accelerators.
Keystroke |
Context |
Meaning |
F1 |
Global |
Raise window if not at top, or lower it if at top |
F2 |
Global |
Iconify window |
F3 |
Global |
Warp to emacs |
<keyboard shortcuts 42>
=
;(bind-keys global-keymap "F1" '(raise-lower-window (input-focus)))
;(bind-keys global-keymap "F2" '(iconify-window (input-focus)))
;(bind-keys global-keymap "F3" '(warp-emacs-into-existence))
<>
Macro referenced in scrap <1>.
7. Startups
<startups 43>
=
;(system "/home/ajh/bin/rootimage stay &")
;(system "/usr/bin/emacs &")
<>
Macro referenced in scrap <1>.
Startups have been moved to the Session Startup Programs
section of Gnome Control Program
8. Other Stuff
8.1. Emacs hot key
<other stuff 44>
=
;(defun warp-emacs-into-existence ()
; "warp cursor into emacs, wherever it is, creating one if not found"
; (interactive)
; <check window list for an emacs window 0>
; <exec an emacs if not found 0>
; <put the cursor into the found/created emacs window 0>
; )
<>
Macro defined by scraps <44>, <45>, <46>.
Macro referenced in scrap <1>.
8.2. Tiling windows
<other stuff 45>
=
(defun evm-tile-windows-horizontally ()
"Tile windows horizontally"
(let ((wins (workspace-windows current-workspace))
(calculated-width 0)
(x 0)
(border-width 0)
(borders-width 0))
;; Calculate width of the window border
(setq border-width (- (car (window-frame-dimensions (car wins)))
(car (window-dimensions (car wins)))))
;; Calculate width of borders of all windows on current viewport
(setq borders-width
(* (length wins) border-width))
(setq calculated-width
(ceiling (/ (- (screen-width) borders-width)
(length wins))))
(while wins
(resize-window-to (car wins) calculated-width (- (screen-height) 54))
(move-window-to (car wins) x 0)
(setq x (+ x calculated-width border-width))
(setq wins (cdr wins))
)
)
)
<>
Macro defined by scraps <44>, <45>, <46>.
Macro referenced in scrap <1>.
<other stuff 46>
=
(defun evm-tile-windows-vertically ()
"Tile windows vertically"
(let ((wins (workspace-windows current-workspace))
(calculated-height 0)
(y 0)
(border-height 0)
(borders-heights 0))
;; Calculate height of the window border
(setq border-height (- (cdr (window-frame-dimensions (car wins)))
(cdr (window-dimensions (car wins)))))
;; Calculate height of borders of all windows on current viewport
(setq borders-height
(* (length wins) border-height))
(setq calculated-height
(ceiling (/ (- (screen-height) borders-height 28)
(length wins))))
(while wins
(resize-window-to (car wins) (- (screen-width) 18) calculated-height)
(move-window-to (car wins) 0 y)
(setq y (+ y calculated-height border-height))
(setq wins (cdr wins))
)
)
)
<>
Macro defined by scraps <44>, <45>, <46>.
Macro referenced in scrap <1>.
9. Wish List
- 20000825:163517
- Send window to next/prev workspace has option/alternative
to leave focus on current desktop.
- 20000904:220247
- Haven't got root/global mouse
bindings quite right.
- 20000904:220321
- send to pop up in title bar
doesn't work quite right.
10. Makefile
"Makefile" 47
=
SYNCH = $(HOME)/bin/synch
default=sawfish
WEBPAGE=$(HOME)/web/research/literate
WORKPAGE=$(HOME)/public_html/research/literate
CSSEWEBPAGE=/shelob/research/literate
all: sawfish.html
include $(HOME)/etc/MakeXMLLiterate
install: install-sawfish install-html
install-sawfish: sawfishrc
cp -p sawfishrc ${HOME}/.sawfish/rc
install-html: sawfish.html
cp -p sawfish.html $(WEBPAGE)/sawfish.html
cp -p sawfish.html $(WORKPAGE)/sawfish.html
if [ -d $(CSSEWEBPAGE) ] ; then \
cp -p sawfish.html $(CSSEWEBPAGE)/sawfish.html ; \
fi
sawfishrc: sawfish.xml
horsham: sawfish.w
xlp -w -1 horsham sawfish.w ; rm sawfish.tangle
cp -p sawfishrc /horsham/.sawfishrc
<>
11. Indices
11.1. Chunks
<applications for \#1
<20>>
Referenced in scrap <8>.
<applications for hawthorn
<20>>
Referenced in scrap <8>.
<applications for junee
<19>>
Not referenced.
<cerg colour
<26>>
Referenced in scraps <9>, <10>, <11>.
<check window list for an emacs window
?>
Referenced in scrap <44>.
<desktops and pagers
<2>>
Referenced in scrap <1>.
<exec an emacs if not found
?>
Referenced in scrap <44>.
<fangorn colour
<28>>
Referenced in scrap <9>.
<global mouse bindings
<6>>
Referenced in scrap <5>.
<h-to-ho
<13>>
Referenced in scrap <11>.
<h-to-j
<12>>
Referenced in scrap <11>.
<h-to-r
<14>>
Referenced in scrap <11>.
<h-to-w
<15>>
Referenced in scrap <11>.
<hawthorn colour
<23>>
Referenced in scraps <9>, <10>, <11>.
<horsham colour
<22>>
Referenced in scraps <9>, <10>, <11>.
<j-to-ho
<16>>
Referenced in scrap <10>.
<j-to-n
<17>>
Referenced in scraps <9>, <10>.
<j-to-w
<18>>
Referenced in scraps <9>, <10>.
<junee colour
<24>>
Referenced in scraps <9>, <10>, <11>.
<keyboard shortcuts
<42>>
Referenced in scrap <1>.
<logins for \#1
<11>>
Referenced in scrap <8>.
<logins for hawthorn
<11>>
Referenced in scrap <8>.
<logins for horsham
<9>>
Not referenced.
<logins for junee
<10>>
Not referenced.
<menu button mouse bindings
<38>>
Referenced in scrap <5>.
<mouse bindings
<5>, <33>, <34>, <35>, <36>, <37>, <39>, <40>, <41>>
Referenced in scrap <1>.
<nautilus colour
<27>>
Referenced in scraps <9>, <10>.
<nexus colour
?>
Referenced in scraps <10>, <11>.
<other stuff
<44>, <45>, <46>>
Referenced in scrap <1>.
<put the cursor into the found/created emacs window
?>
Referenced in scrap <44>.
<redfern colour
<21>>
Referenced in scraps <9>, <10>, <11>.
<remote login twin position
<29>>
Referenced in scraps <9>, <10>, <11>.
<root image menu
<30>>
Referenced in scrap <8>.
<root window mouse bindings
<7>, <8>>
Referenced in scrap <5>.
<startups
<43>>
Referenced in scrap <1>.
<style settings
<4>>
Referenced in scrap <1>.
<sunweb colour
<25>>
Referenced in scraps <9>, <10>, <11>.
<title bar mouse bindings
<32>>
Referenced in scrap <5>.
<window body mouse bindings
<31>>
Referenced in scrap <5>.
<window parameters
<3>>
Referenced in scrap <1>.
11.2. Identifiers
evm-tile-windows-horizontally
<45>.
evm-tile-windows-vertically
<46>.
make-ws-list
<33>.
popup-warp-menu
<40>, <7>, <6>.
popup-windows-menu
<34>, <32>.
send-to-ws-list
<35>, <39>, <35>, <34>.
send-window-to-next-and-stay
<36>, <34>.
send-window-to-prev-and-stay
<37>, <34>.
warp-emacs-into-existence
<44>, <42>.
20000905:163323 |
ajh |
1.2.0 |
fine tuning of root and global mouse bindings |
20001115:083450 |
ajh |
1.2.1 |
refined startups to include emacs |
20010416:115619 |
ajh |
1.2.2 |
changed nautilus to ssh login (from rlogin) |
20020318:101003 |
ajh |
1.2.3 |
Added horsham to logins and Makefile |