Generic_Window_Manager/data/vtwmrc.gwm

607 lines
27 KiB
Plaintext

;; vtwmrc.gwm --- VTWM profile customizations
;;
;; Author: Anders Holst (aho@sans.kth.se)
;; Copyright (C) 1995 Anders Holst
;; Version: vtwm-1.0
;; Last change: 17/6 1995
;;
;; This file is copyrighted under the same terms as the rest of GWM
;; (see the X Inc license for details). There is no warranty that it
;; works.
;;
;; ---------------------------------------------------------------------
;;
;; This is an example of VTWM profile customizations. Plaese copy this
;; file to your own gwm-directory, and make the modifications you like.
;;
;; Some variables below are lists of "window types". These lists can
;; contain one of four (actually six) different kinds of specifications:
;; * An atom, representing a client class (like 'XTerm or 'Emacs).
;; * A string, representing a regexp for the window name ("^login$").
;; * A list which is a specification ala Jay Berkenbilt (as matched
;; with 'match-windowspec')
;; * An arbitrary WOOL expression, returning nil or non-nil.
;; (* 't', which matches everything.)
;; (* '()' which matches nothing.)
;;
;;=============================================================================
;;
;; User settable variables
;;
;;=============================================================================
;;
;; Below are shown in comments all default settings of customizable
;; variables from the various components of the VTWM profile.
;;
;;=============================================================================
;; General VTWM variables
;;=============================================================================
;;
;; screen-tile () ; Pixmap for screen background tiling
;; root-cursor () ; Form of root cursor
;; autoraise () ; Raise windows when entered
;; autocolormap t ; Change colormap to that of the entered window
;; autofocus t ; Set focus to entered window
;; default-placement 'vtwm-placement ; default window placement method
;; default-icon-placement () ; default icon placement method
;; placement-list () ; List of (window-type func)-specifications
;; icon-placement-list () ; of how to place different windows or icons
;; place-randomly t ; Place windows pseudo randomly,and not by user
;; raise-on-move () ; Raise windows when they are moved
;; raise-on-resize () ; Raise windows when they are resized
;; raise-on-iconify () ; Raise windows (or icons) when iconifying
(setq root-cursor (cursor-make 68))
(setq autoraise ())
(setq place-randomly t)
(setq raise-on-move t)
(setq raise-on-resize t)
(setq raise-on-iconify ())
;;=============================================================================
;; VTWM Window and Icon variables
;;=============================================================================
;;
;; vtwm-borderwidth 2 ; Borderwidth of most windows
;; vtwm-bordercolor black ; Color of border (inactive window)
;; vtwm-active-bordercolor white ; Color of active window border
;; vtwm-title-background white ; Default background of titlebar
;; vtwm-title-foreground black ; Default foreground of titlebar
;; vtwm-title-font (font-make "9x15") ; Font in titlebar
;; vtwm-icon-foreground black ; Default background of icons
;; vtwm-icon-background white ; Default foreground of icons
;; vtwm-icon-bordercolor () ; Default bordercolor of icons
;; vtwm-icon-font (font-make "fixed") ; Font in icons
;; vtwm-fancy-colors ()
;; ; List of '(window-type foreground background)' specifications.
;; vtwm-notitle-list '(Gwm (window-is-transient-for))
;; ; List of window types to make untitled
;; default-icon-pixmap-name () ; Pixmap filename for default icon
;; hilite-pixmap-name "gray" ; Filename for active titlebar pattern
;; vtwm-left-plugs '(("iconify2" (iconify-window)))
;; vtwm-right-plugs '(("resize2" (twm-resize-window) t))
;; ; Left and right plugs in the titlebar, a list of pairs
;; ; or tripplets: ( <pixmap-file> <action> [<on-press>] )
;; ; The optional third element <on-press> signals that the action
;; ; should be run on button-press, rather than button-release.
(setq vtwm-notitle-list '(XLoad XClock XBiff Gwm (window-is-transient-for)))
(setq vtwm-bordercolor black)
(setq vtwm-active-bordercolor black)
(if (= screen-type 'color)
(progn
(setq vtwm-title-foreground white)
(setq vtwm-title-background (color-make "royalblue"))
(setq vtwm-icon-foreground (color-make "darkslategray"))
(setq vtwm-icon-background (color-make "green"))
;; Example of how to use vtwm-fancy-colors. Windows called "su" or
;; "ksu" get red titlebars with black text, and (other) xterms get
;; green titlebars with white (= vtwm-title-foreground above) text.
;(setq vtwm-fancy-colors (list
; (list "^k*su$" black (color-make "red"))
; (list 'XTerm () (color-make "seagreen")))
))
;; Example of how to get a menu-plug to the left and a zoom-plug to the right
; (setq vtwm-left-plugs '(("iconify2" (iconify-window))
; ("menu" (vtwm-pop-menu window-pop) t)))
; (setq vtwm-right-plugs '(("zoom" (zoom-window))
; ("resize2" (twm-resize-window) t)))
;; Note that you can also get "squeezed title" windows ala TWM, if you
;; use either "vtwm-squeezed-window.gwm" or "vtwm-squeezed-window2.gwm".
;; Use 'set-window' to specify which windows you want squeezed titles on:
; (set-window Emacs vtwm-squeezed-window2)
;;=============================================================================
;; VTWM Zoom functions
;;=============================================================================
;;
;; zoom-offset 3 ; Minimum distance to screen edge
;; zoom-window-method-list () ; List of (wind-type zoom-func) specs.
;; ; This is to make zoom-window use different zoom methods for
;; ; different types of windows.
(setq zoom-window-method-list '((XTerm zoom-window-vert)
(XVroot zoom-window-prop)
(t zoom-window-full)))
;;=============================================================================
;; VTWM Menu appearance
;;=============================================================================
;;
;; vtwm-menu-foreground black ; Foreground of menus
;; vtwm-menu-background white ; Background of menus
;; vtwm-menu-borderwidth 2 ; Border width of menus
;; vtwm-menu-border-color black ; Border color of menus
;; vtwm-menu-label-foreground vtwm-menu-foreground
;; vtwm-menu-label-background vtwm-menu-background
;; vtwm-menu-label-borderwidth 1 ; Border width of menu labels
;; vtwm-menu-hilite-bordercolor black ; Border color of current menu item
;; vtwm-menu-hilite-borderwidth 1 ; Border width of current menu item
;; vtwm-menu-hilite-foreground () ; Text color of current menu item
;; vtwm-menu-hilite-background () ; Background of current menu item
;; vtwm-menu-shadow t ; Whether the menu has a shadow
;; vtwm-menu-shadow-color black ; Color of shadow
;; vtwm-menu-shadow-offset 6 ; Offset of shadow from menu
;; vtwm-menu-font (font-make "8x13") ; Menu item font
;; vtwm-menu-label-font vtwm-menu-font ; Menu label font
;; vtwm-menu-item-height 10 ; Minimum height of an item
;; vtwm-menu-min-width 100 ; Minimum width of menu
(setq vtwm-menu-foreground black)
(setq vtwm-menu-background (color-make "pink"))
(setq vtwm-menu-label-background (color-make "palevioletred"))
(setq vtwm-menu-hilite-bordercolor black)
(setq vtwm-menu-shadow-color black)
(setq vtwm-menu-border-color black)
(setq vtwm-menu-font
(font-make "*-helvetica-medium-o-normal-*-140-*"))
(setq vtwm-menu-label-font
(font-make "*-times-bold-i-normal-*-180-*"))
;;=============================================================================
;; Icon Manager variables
;;=============================================================================
;;
;; icon-mgr-name "Icon Manager" ; Default name of icon manager
;; icon-mgr-xpos 0 ; Default x position
;; icon-mgr-ypos 0 ; Default y position
;; show-default-icon-mgr t ; Default icon manager is used
;; show-icon-mgr t ; Use icon managers
;; icon-mgr-hide-if-empty t ; Don't show empty managers
;; iconify-by-unmapping t ; Do not use icons by default
;; iconify-unmanaged-by-icon t ; Use an icon if not in any manager
;; iconify-by-icon-list () ; Always use icons for these
;; iconify-on-start-list () ; List of window types to iconify on start
;; icon-mgr-omit-list () ; Window types not handled in default manager
;; icon-mgr-sort () ; Sort the entries in an icon manager
;; icon-mgr-font (font-make "8x13") ; Font in icon managers
;; icon-mgr-width 150 ; Width of icon manager
;; icon-mgr-foreground black ; Foreground of icon managers
;; icon-mgr-background white ; Background of icon managers
;; icon-mgr-title-foreground icon-mgr-foreground
;; icon-mgr-title-background icon-mgr-background
;; icon-mgr-no-title () ; Inhibits the icon manager title
;; icon-mgr-framed-bars () ; Makes it look more like in real VTWM
;; icon-mgr-fancy-colors () ; List of (wintype fg bg) specifications
;; icon-mgr-window-feedback t ; Rely on focus feedback from windows
;; icon-mgr-pixmap-name "iconify2"; Pixmap file for iconified symbol
;; ; In addition, the property 'icon-mgr-special-pixmap can be set on
;; ; a window to the pixmap to use for that window in the icon manager.
(if (not (= screen-type 'color))
(progn
(setq icon-mgr-foreground black)
(setq icon-mgr-background white))
(progn
(setq icon-mgr-foreground black)
(setq icon-mgr-background (color-make "tan"))
(setq icon-mgr-title-background (color-make "peru"))))
(setq show-icon-mgr t)
(setq icon-mgr-sort t)
(setq iconify-by-unmapping t)
(setq iconify-on-start-list '(XConsole "^gwmchat$"))
(setq icon-mgr-omit-list
'(XLoad XClock XBiff Gwm (window-is-transient-for)))
(setq icon-mgr-xpos -6)
(setq icon-mgr-ypos 6)
(setq icon-mgr-width 150)
(setq icon-mgr-font (font-make "8x13"))
;; If you use multiple icon managers, this might look better:
; (setq icon-mgr-width 120)
; (setq icon-mgr-font (font-make "6x13"))
;;=============================================================================
;; Virtual Screen
;;=============================================================================
;;
;; show-virtual t ; Show the map of the virtual screen
;; virtual-modifiers (together with-control with-alt)
;; ; Modifiers for arrow keys
;; virtual-omit-nailed t ; Show only non-nailed windows in map
;; virtual-omit-list () ; List of window types not shown in map
;; virtual-show-filled t ; Draw windows filled in map
;; virtual-fancy-colors ()
;; ; list of (window-type foreground background) specifications
;; virtual-xpos 0 ; Original position of map
;; virtual-ypos 0 ; - '' -
;; virtual-pixsize 160 ; Size of the map
;; virtual-background white ; Default background of the map
;; virtual-foreground black ; Default window frame color in the map
;; virtual-title-font () ; Font of window titles in the map
;; virtual-title-position () ; Position of titles in the map, could
;; ; be: top, center, bottom, above, below.
;; virtual-horizontal-step (/ screen-width 2) ; Amount to move by keys
;; virtual-vertical-step (/ screen-height 2)
;; virtual-nailed-list '(Gwm) ; Initially nailed windows
(setq virtual-xpos -166)
(setq virtual-ypos 6)
(setq virtual-pixsize 150)
(setq virtual-nailed-list '(XLoad XClock XBiff XConsole Gwm "^gwmchat$"))
(setq virtual-omit-list '(XLoad XClock XBiff Gwm))
(setq virtual-omit-nailed ())
(setq virtual-modifiers with-alt)
(if (= screen-type 'color)
(progn
(setq virtual-background (color-make "lightyellow"))
(setq virtual-foreground black)
(setq virtual-show-filled t)
(setq virtual-fancy-colors (list
(list () (color-make "lightgray"))
; (list 'XTerm () (color-make "lightskyblue"))
; (list 'Emacs () (color-make "lightpink"))
(list t () white)))
))
;;=============================================================================
;; Virtual Door variables
;;=============================================================================
;;
;; initial-doors () ; Doors to create on startup
;; door-font (font-make "8x13") ; Font in door buttons
;; door-background white ; Background color of door buttons
;; door-foreground black ; Foreground color of door buttons
;; door-borderwidth 2 ; Border width of door buttons
;; door-xsize 90 ; Door button size
;; door-ysize 16 ; - '' -
;; door-mgr-dir-horiz t ; Controls mapping of doors on virtual screen,
;; door-mgr-dir-len 2 ; e.g. two screenfulls in a (horizontal) row.
;; door-mgr-mdir-horiz t ; Controls position of door buttons, e.g.
;; door-mgr-mdir-len 2 ; place two buttons in each (horizontal) row.
;; door-mgr-xpos 0 ; Upper left corner of door manager
;; door-mgr-ypos 0 ; - '' -
;; door-mgr-tile t ; tile of empty positions, t = transparent
;; door-mgr-no-outer-border () ; Leave outermost borders to decoration
;; door-context () ; p-list of customizations per door name
;;
;; door-auto-string "Area " ; Name prefix of auto-generated doors
;; door-free-area-string "Free Area" ; Name of magic free area door
;; door-free-area-color () ; Special color of free area door
;; door-free-area-cleans t ; Let free area door clean empty doors
;;
(setq door-mgr-xpos 4)
(setq door-mgr-ypos 4)
(if (= screen-type 'color)
(progn
(setq door-background (color-make "lightyellow"))
(setq door-foreground black)
))
(setq initial-doors '("Home" (make-free-area-door)))
;;=============================================================================
;; Virtual Panlist variables
;;=============================================================================
;;
;; show-pan-lists t ; Enable pan lists
;; pan-on-click () ; Pan on click (i.e. when you click
;; ; in an edge or corner of the screen), or on enter (i.e. autopan,
;; ; pan as soon as the cursor reaches the edge of the screen).
;; pan-x-step (/ screen-width 4) ; How much to pan (when autopanning)
;; pan-y-step (/ screen-height 4) ; - '' -
;; pan-delay () ; Time in milliseconds before autopanning
;; pan-warp-step 4 ; Movement of cursor from edge on autopan
;; pan-warp-wrapped () ; Move cursor to opposite edge on autopan
;; pan-corner-width 30 ; Diagonal pan when this close to corner
(setq show-pan-lists t)
(setq pan-on-click t)
;;=============================================================================
;;
;; Definition of menus
;;
;;=============================================================================
;;
;; To define a menu, you can use the following constructors:
;;
;; (construct-menu ENTRY ...)
;;
;; (construct-window-menu NAME ACTION)
;; (construct-window-menu-items WINDOW-TYPE ACTION)
;;
;; (construct-machine-menu NAME MACHINE-LIST ACTION)
;; (construct-machine-menu-items MACHINE-LIST ACTION)
;; (construct-xrsh-menu MACHINE-LIST COMMAND)
;;
;; There are examples on how to use most of them below, and more
;; thorough documentation can be found in "vtwm-menu.gwm".
;;
;; Below you can first define a set of useful variables and functions
;; for use when constructing menus. Thereafter you construct all the
;; menus you need. These can in turn be used in the behaviors defined
;; furter down.
;;=============================================================================
;; Variables to use when constructing menus
;;=============================================================================
;; Put the often used machines in this list, "computer.some.whe.re"
(setq machine-list (list
))
;; Put here machines that are not in the same domain, and thus need password
(setq telnet-machine-list (list
))
;; Remove the local host from machine-list, it will be added to the menu anyway
(with (mem (member hostname machine-list))
(if mem
(delete-nth mem machine-list)))
;;=============================================================================
;; Construction of menus
;;=============================================================================
;; Menu with useful global commands
(setq root-pop (construct-menu
"Root Options"
'("Refresh" (refresh))
'("Sleep" (sleep-now))
'("Exec cut"
(execute-string (+ "(? " cut-buffer ")")))
'("Redecorate" (redecorate-all))
'("Deiconify all" (deiconify-all))
'("Unfocus" (focus-window))
;; How to let the user pick a window to do something with
; '("Kill" (kill-picked))
; '("Client Info" (with-picked
; (? "Window: " (window-client-class) "."
; (window-client-name) "."
; (window-name) "@"
; (window-machine-name) "\n")))
'("Toggle IconMgr" (icon-mgr-toggle))
'("Toggle Virtual" (virtual-toggle))
'("Restart" (restart))
'("Reload" (progn
(load "vtwmrc")
(redecorate-all)))
'("Quit" (end))))
;; Menu with useful window commands (and some global)
(setq window-pop (construct-menu
"Window Options"
'("Raise" (raise-window))
'("Lower" (lower-window))
'("Resize" (twm-resize-window))
'("Move" (move-window))
'("Iconify" (toggle-iconify-window))
'("Zoom" (zoom-window))
'("Nail" (virtual-toggle-nail))
'("Focus" (focus-window))
'("Refresh" (refresh window))
'("Kill" (or (delete-window) (kill-window)))
'("Exec cut"
(execute-string (+ "(? " cut-buffer ")")))
'("Redecorate" (re-decorate-window))
'("Client Info"
(? "Window: " (window-client-class) "."
(window-client-name) "."
(window-name) "@"
(window-machine-name) "\n"))
'("Geometry"
(? "Geometry:" window-width "x"
window-height "+"
window-x "+"
window-y "\n"))
'("Restart" (restart))
'("Reload" (progn
(load "vtwmrc")
(redecorate-all)))
'("Quit" (end))))
;; Menu to log in to other machines. First comes the local host, then
;; all host you can log in to with "rsh" (in machine-list), and then
;; those you need to give an additional password (in telnet-machine-list).
(setq login-pop (construct-menu
"Logins"
(construct-machine-menu-items (list hostname)
; This is to get around a bug that turns up
; when gwmchat and bash is used together
(if (match "bash$" (getenv "SHELL"))
(+ '(! "xterm" "-T" name "-e" "csh" "-c")
(list (getenv "SHELL")))
'(! "xterm" "-n" name)))
(construct-machine-menu-items machine-list
'(! "xlogin" host "-n" name))
(construct-machine-menu-items telnet-machine-list
'(! "xterm" "-T" name "-e" "telnet" host))))
;; Examples of simpler alternatives for the same thing:
; (setq login-pop (construct-xrsh-menu machine-list "xterm"))
; (setq login-pop (construct-machine-menu "Logins" machine-list
; '(! "xlogin" host)))
;; Menu for starting xload
(setq xload-pop (construct-xrsh-menu machine-list "xload"))
;; Menu for starting emacs
(setq emacs-pop (construct-xrsh-menu machine-list
'("emacs" "-name" (+ name "-Emacs") "-geometry" "85x50")))
;; Example of simpler alternative:
; (setq emacs-pop (construct-xrsh-menu machine-list "emacs"))
;; Auxilary function and menu for starting an xterm, an emacs and an xload
;; on some machine, in a fresh area on the virtual screen.
(defun remote-start (host name)
(maybe-add-door name 'free)
(goto-door name)
(xrsh-command host (list "xterm" "-n" name
"-geometry" (virtual-coord-string 20 60)))
(xrsh-command host (list "emacs" "-name" (+ name "-Emacs")
"-geometry" (+ "164x55" (virtual-coord-string 10 110))))
(xrsh-command host (list "xload")))
(setq start-pop (construct-machine-menu "Start all" machine-list
'(remote-start host name)))
;; If you rather want one menu with several commands (to run on the
;; local host), then you can do something like this:
; (setq command-pop (construct-menu
; "Command"
; '("Xterm" (! "xterm" "-n" (machine-name hostname)))
; '("Emacs" (! "emacs" "-name"
; (+ (machine-name hostname) "-Emacs")
; "-geometry" "85x50"))
; '("Xload" (! "xload"))
; '("All" (remote-start hostname (machine-name hostname)))
; '("Calc" (! "xcalc"))
; '("Lock" (! "xnlock" "-rv"))))
;; Function to create a windows menu which pops to (i.e. scrolls to,
;; deiconifies, and raises) the selected window. It is a function, so
;; that the menu can be rebuilt with the current windows every time it
;; is used.
(defun windows-pop ()
(construct-window-menu "Windows" '(pop-to-window)))
;;=============================================================================
;;
;; Behaviors
;;
;;=============================================================================
;;=============================================================================
;; Root behavior
;;=============================================================================
;; This one uses several of the menus defined above
(setq root-behavior
(state-make
(on (buttonpress 1 alone) (vtwm-pop-menu login-pop))
(on (buttonpress 1 with-shift) (vtwm-pop-menu emacs-pop))
(on (buttonpress 2 alone) (vtwm-pop-menu start-pop))
(on (buttonpress 2 with-shift) (vtwm-pop-menu xload-pop))
(on (buttonpress 3 alone) (vtwm-pop-menu root-pop))
(on (buttonpress 3 with-shift) (vtwm-pop-menu (windows-pop)))
(on (keyrelease (key-make "Menu") any)
(execute-string (+ "(? " cut-buffer ")")))
))
;;=============================================================================
;; Common behavior for windows and icons
;;=============================================================================
(setq standard-behavior
(state-make
(on (buttonpress 1 alone) (raise-lower-move-window))
(on (buttonpress 1 with-alt) (raise-lower-move-window))
(on (buttonpress 2 alone) (move-window))
(on (buttonpress 2 with-alt) (move-window))
(on (buttonpress 3 alone) (vtwm-pop-menu window-pop))
(on (buttonpress 3 with-alt) (vtwm-pop-menu window-pop))
(on (keyrelease (key-make "Menu") any)
(execute-string (+ "(? " cut-buffer ")")))
))
;;=============================================================================
;; Window behavior
;;=============================================================================
(setq window-behavior
()) ; Nothing more than standard-behavior
;;=============================================================================
;; Window titlebar behavior (in addition to above)
;;=============================================================================
(setq standard-title-behavior
()) ; Nothing more than standard-behavior
;;=============================================================================
;; Icon behavior
;;=============================================================================
(setq icon-behavior
(state-make
(on (buttonpress 1 alone) (pop-to-window))
))
;;=============================================================================
;; Icon Manager behavior
;;=============================================================================
(setq icon-mgr-behavior
(state-make
(on (buttonpress 1 any)
(icon-mgr-with-window
(pop-to-window)))
(on (buttonpress 2 any)
(icon-mgr-with-window
(toggle-iconify-window)))
(on (buttonpress 3 any)
(icon-mgr-with-window
(vtwm-pop-menu window-pop)))
))
;;=============================================================================
;; Grabs (i.e. which events to steal from clients)
;;=============================================================================
(: vtwm-grabs (list
(button any with-alt)
(key "Menu" any)))
;;=============================================================================
;;
;; Miscellaneous
;;
;;=============================================================================
;; Where on the screen to put icons: down the right edge
(set-icon-placement any rows.right-top.placement)
(rows.limits rows.right-top
'start 180
'offset 6
'separator 4)
;; Place xclock, xbiff and all xloads in top of screen
(set-placement XLoad rows.top-right.placement)
(set-placement XClock rows.top-right.placement)
(set-placement XBiff rows.top-right.placement)
(rows.limits rows.top-right
'start 324
'offset 4
'separator 6
'sort (lambda (w1 w2)
(compare (or (member (with (wob w1) window-client-class)
'(XBiff XClock XLoad)) 3)
(or (member (with (wob w2) window-client-class)
'(XBiff XClock XLoad)) 3))))