home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gwm18a.zip / doc / standard.tex (.txt) < prev    next >
LaTeX Document  |  1995-07-03  |  60KB  |  1,128 lines

  1. \chapter{The Standard GWM Packages}
  2. \sloppy
  3. This chapter describes the {\WOOL} packages available on the standard GWM
  4. distribution. The name of the involved files are listed in the title of each
  5. package.
  6. {\GWM} does not try to enforce any policy in writing profiles, but for the
  7. sake of simplicity and maintainability, all the {\WOOL} packages delivered
  8. with {\GWM} will try to be compliant with a set of rules described in
  9. section~\ref{standard-styleguide}, page~\pageref{standard-styleguide}, which
  10. should assure the compatibility between them.
  11. {\bf Note:} Distributed code is normally indented under emacs by Alan M.
  12. Caroll's \verb|amc-lisp.el| emacs-lisp package, which is now included in the
  13. {\GWM} distribution in the \verb|contrib/lisp-modes/| subdirectory.
  14. You can have a look at my personal profile in the file
  15. \verb|data/profile-colas.gwm| if you are looking for actual examples.
  16. \section{The Standard Profile\hfill{\tt .profile.gwm}}
  17. \label{standard-profile}
  18. The standard profile can be customized to your taste by creating a
  19. \verb".profile.gwm" file in your home directory, or by copying the one in
  20. the {\GWM} distribution directory in your home directory and editing 
  21. it.\footnote{The standard profile is the default one, which you get if you do
  22. not have a \verb".gwmrc.gwm" file in your home directory. It is a
  23. real-estate overlapping environment. It is defined in the \verb".gwmrc.gwm"
  24. file in the {\GWM} distribution directory.}
  25. \subsection{mouse buttons}
  26. The default behavior for clicking of the mouse buttons is, in a window
  27. decoration or an icon:
  28. \begin{description}
  29. \item[left button] Moves the window. Releasing the button actually moves the
  30. window, pressing another one while still holding down the left button
  31. cancels the move operation
  32. \item[middle button in a window] Resizes the window. The size of the window
  33. will be displayed in the upper-left corner of the screen. Releasing the
  34. button actually resizes the window, pressing another one while still holding
  35. down the middle button cancels the resize operation
  36. \item[middle button in an icon] de-iconifies the icon
  37. \item[right button] brings up a pop-up menu for additional functions, such
  38. as iconification and destruction
  39. \end{description} 
  40. These functions are enabled only in the {\GWM}-added decoration around the
  41. window, or anywhere in the window if the {\bf alternate} (or {\bf meta} or
  42. {\bf left} key on some keyboards) modifier key is depressed when clicking,
  43. in the \verb"uwm" style of interaction.
  44. Moreover, if you click in the icon in the upper left of the frame around the
  45. xterm windows with the left or right button, the window will be iconified,
  46. and with the middle button, it will be iconified and the icon moved just
  47. underneath the pointer. You can still move the icon elsewhere by
  48. dragging it while the middle button is down.
  49. Whether you want the window to be raised on top of others when performing a
  50. move, resize, or (de-)iconify operation can be toggled by setting to \verb|t|
  51. or \verb|()| the global values \verb|raise-on-move|, \verb|raise-on-resize|,
  52. and \verb|raise-on-iconify|.\label{raise-on-move}
  53. \subsection{customization}
  54. Customization is achieved by creating a \verb".profile.gwm" file in
  55. your home directory (or anywhere in your \verb"GWMPATH"). In this file
  56. you can set the variables to modify the standard profile to suit your
  57. taste. Note that you must set variables used in decorations {\bf
  58. before} loading this decoration by a \verb"set-window" or
  59. \verb"set-icon-window" call.
  60. Your \verb".profile.gwm" will be loaded once for each screen
  61. managed, and since pixmaps, colors, cursors and menus are screen-dependent
  62. objects, try to define them as \verb"names" in the \verb"screen." namespace
  63. (\seep{namespace-make}).
  64. \subsubsection{Mouse bindings}
  65. The standard mouse button bindings can be redefined by re-defining the default
  66. {\bf states} (\seep{state-make}) for a click in a window decoration, an icon
  67. and the root window, which are respectively the global variables {\bf
  68. window-behavior}, {\bf icon-behavior}, {\bf root-behavior}. These states will
  69. be used to build the {\bf fsms} of the windows, icons and root window. The
  70. state {\bf standard-behavior} is included in both window and icon behaviors,
  71. so that you can add transitions to it if you want to have them in both
  72. contexts. You may then need to redefine the events grabbed by {\GWM}, in the
  73. {\bf grabs} variables; all events in these lists are ``stolen'' from the
  74. application and redirected to {\GWM}.  There are three grabs variables: {\tt
  75. root-grabs}, {\tt window-grabs}, and {\tt icon-grabs}, pointing to the lists
  76. of event to be ``grabbed'' from all applications, only from windows, and only
  77. for icons.  That is why you can move a window by clicking anywhere in it with
  78. the left button while depressing the {\tt Alt} key: the standard grabs
  79. consists of the list:
  80. {\exemplefont\begin{verbatim}
  81.         (list (button any with-alt)
  82.               (button select-button (together with-shift with-alt)))
  83. \end{verbatim}}
  84. If you only want to change button bindings, change the value of {\tt
  85. select-button}, {\tt action-button}, and {\tt menu-button}, which are
  86. initially bound to 1, 2, and 3 respectively.
  87. You need to call the {\tt reparse-standard-behaviors} function after modifying
  88. any of these states to take your changes into account. For instance, to add
  89. iconification on the ``F1'' function key only on windows, you would write in
  90. your .profile.gwm file:
  91. {\exemplefont\begin{verbatim}
  92.         (setq window-behavior
  93.             (state-make
  94.                (on (keyrelease "F1" alone) (iconify-window))
  95.                standard-behavior))           ; include previous actions
  96.         (reparse-standard-behaviors)         ; commit changes
  97.         (setq window-grabs                   ; grab F1 from clients
  98.             (+ window-grabs (list (keyrelease "F1" alone))))
  99. \end{verbatim}}
  100. \subsubsection{global switches}
  101. The following global variables (which are names in the \verb"screen."
  102. namespace for all pixmaps, colors, cursor and menus) controlling the way the
  103. standard profile operates can be set in your \verb".profile.gwm" file:
  104. \begin{description}
  105. \itemtt{cursor} to the cursor displayed in any decoration or icon
  106. \itemtt{root-cursor} to the cursor displayed on the root window. The
  107. available cursors in the distribution are:
  108. \begin{description} 
  109. \itemtt{arrow} a big arrow
  110. \itemtt{arrowhole} same with a hole inside
  111. \itemtt{arrow3d} a 3d-looking triangular shape. Especially nice on a clear
  112. background.
  113. \end{description}
  114. For instance, to use the ``{\tt arrow3d}'' cursor, just say:
  115. {\exemplefont\begin{verbatim}
  116.         (setq root-cursor (cursor-make "arrow3d"))
  117. \end{verbatim}}
  118. \itemtt{screen-tile} to the pixmap used to tile the root window with.
  119. Provided bitmaps are \verb"back.xbm" (default) and \verb"grainy.xbm"
  120. \itemtt{autoraise} if set to \verb"t", (defaults to \verb"()"), {\GWM} will
  121. raise on top of others the window which has the input focus
  122. \itemtt{xterm-list} the list of machines the user wants to launch a remote
  123. xterm on (via the \verb"rxterm"\footnote{{\tt rxterm}, {\tt rxload}
  124. and {\tt rx} are Bourne shell scripts used to start remote xterms,
  125. xloads or any other X command. The rxterm script is included in the
  126. distribution, in the {\tt gwm} subdirectory, install it and make rx
  127. and rxload as links to it} command)
  128. \itemtt{xload-list} the list of machines the user wants to launch a remote
  129. xload on (via the \verb"rxload" command) 
  130. \itemtt{icon-pixmap} the pixmap to be displayed in the upper left
  131. corner of window to iconify it 
  132. \itemtt{to-be-done-after-setup} the list (\verb"progn"-prefixed) of things
  133. to be executed after all windows already present have been decorated.  
  134. \itemtt{look-3d} to \verb"t" to specify that window decoration packages that
  135. support it should adopt a tridimensional look. The default for this variable
  136. is \verb"()" on monochrome displays and \verb"t" on color and grayscale ones.
  137. \end{description}
  138. \subsubsection{Window and icon decoration}
  139. Moreover, you can decide to change the decoration (look and feel)
  140. of a client or an associated icon by using the following functions.
  141. For most following functions, when a \verb|window-description| is expected, it
  142. means a X resource specification of the form:
  143. \begin{verbatim}
  144. client-class.client.name.window-name.machine-name
  145. \end{verbatim}
  146. where *-notation, or ``any'' to means any value for a field is accepted. Note
  147. that all fields are optional, except for client-class.
  148. Thus, you can say that you want all xterm icons to be xterm-icons, except for
  149. the one named Console, on machine avahi, for which you want to use
  150. a simple icon by:
  151. {\exemplefont\begin{verbatim}
  152.         (set-icon-window XTerm xterm-icon)
  153.         (set-icon-window XTerm*Console.avahi simple-icon)
  154. \end{verbatim}}
  155. {\bf Note:} for all functions, to set defaults for a screen type or a client
  156. class, use the \verb"any" keyword.
  157. {\bf Note:} Since version {\bf 1.7}, the values affected to \verb|set-window|
  158. et al.\ functions are evaluated at {\bf decoration time}, not while reading the
  159. profile as it was the case before.
  160. \begin{description}
  161. \itemtt{(set-window [screen-type] window-description decoration)}
  162. \label{set-window} will tell {\GWM} to use the decoration described in {\tt
  163. decoration} for all clients of client description {\tt window-description} in the
  164. current screen of type \verb"screen-type". {\tt decoration} can be either:
  165. \begin{itemize} 
  166. \item a real decoration made with a {\tt window-make} call
  167. \item a function returning a decoration when called without parameters 
  168. \item the file name (as a string or atom) of one of the standard decorations 
  169. as listed in the section \ref{standard-decorations}. The file will be loaded
  170. and should set the {\tt decoration} atom to either a real decoration or a
  171. function returning a decoration 
  172. \end{itemize}
  173. For instance, these declarations say that xterms on this screen, if it is a
  174. monochrome one will be decorated by the \verb"simple-ed-win" style, but if
  175. the screen is a color or grayscale one, will use the \verb"simple-win"
  176. decoration, and will use the ``no-decoration'' style for windows not otherwise
  177. describe (The {\tt no-decoration} window description adds no visible
  178. decoration to a window).
  179. {\exemplefont\begin{verbatim}
  180.         (set-window mono XTerm simple-ed-win)
  181.         (set-window any XTerm simple-win)
  182.         (set-window any no-decoration)
  183. \end{verbatim}}
  184. To choose decorations on other criteria than just class, define a function
  185. that will return a {\WOOL} expression which will give the good decoration when
  186. evaluated. For instance, to put a \verb"simple-ed-win" decoration on all
  187. XTerms, except those less than 200 pixels wide, use this in your .profile.gwm:
  188. {\exemplefont\begin{verbatim}
  189.         (defun decide-which-xterm-deco ()
  190.             '(if (< window-width 200) (no-frame)
  191.                  (simple-ed-win)))
  192.         (set-window any XTerm decide-which-xterm-deco)
  193. \end{verbatim}}
  194. For an example of an alternative choosing function, see
  195. \seep{match-windowspec}.
  196. \itemtt{(set-icon [screen-type] window-description bitmap-file)} \label{set-icon}
  197. will associate to a client a simple icon made of the the X11 bitmap stored
  198. in \verb"bitmap-file" (with the current value of \verb"foreground" and
  199. \verb"background" at the time of the call to \verb"set-icon") and the name
  200. of the icon underneath it. 
  201. If a list is given as the last argument, it is evaluated and the pixmap is
  202. taken as the result of the evaluation.
  203. Suppose that you designed a picture of a mailbox named ``mail-icon.xbm'',
  204. saved it somewhere in your GWMPATH, and want to use it for the icon of the
  205. client \verb"xmh". You would add in your \verb".profile.gwm" one of the two
  206. forms:
  207. {\exemplefont\begin{verbatim}
  208.         (set-icon XMh mail-icon.xbm)
  209.         (set-icon XMh (pixmap-make black "mail-icon.xbm" white))
  210. \end{verbatim}}
  211. The icon can also be a color pixmap in the XPM format, loaded then with the
  212. ``pixmap-load'' function. In this case, gwm supports the non-rectangular shape
  213. that may be specified in the icon file (the transparent colors of XPM),
  214. allowing for a great flexibility in icon design.
  215. {\bf Note:} the icon bitmap can only be set for icon decorations
  216. supporting it, such as the (default) \verb"simple-icon" decoration style.
  217. \itemtt{(set-icon-window [screen-type] window-description icon-file)}\label{set-icon-window} This
  218. call will associate more complex icons to a given client, such as those
  219. listed in section~\ref{standard-icons}, p~\pageref{standard-icons}. For
  220. instance to have \verb"xterm" icons look like a mini computer display, add
  221. in your \verb".profile.gwm":
  222. {\exemplefont\begin{verbatim}
  223.         (set-icon-window XTerm term-icon)
  224. \end{verbatim}}
  225. The \verb"term-icon" argument can be either a client window decoration, a
  226. function returning a decoration or a file name, as for the \see{set-window}
  227. function. On startup, {\GWM} does a:
  228. {\exemplefont\begin{verbatim}
  229.         (set-icon-window any any simple-icon)
  230. \end{verbatim}}
  231. \end{description}
  232. \subsubsection{Desktop space management\hfil{\tt placements.gwm}}
  233. \label{set-placement}
  234. The standard profile supports functions to automatically place your windows
  235. or icons on the screen. These functions manage only some type of clients (or
  236. all of them if affected to the \verb"any" client), and they are called
  237. with one argument set to {\bf t} on opening the window, and to {\bf ()} on
  238. closing (destruction) it. They are associated to clients by the calls:
  239. \begin{description}
  240. \itemtt{(set-placement [screen-type] window-description function-name)} for the
  241. main windows of a client. 
  242. \itemtt{(set-icon-placement [screen-type] window-description function-name)} for
  243. its associated icons.
  244. \end{description}
  245. The currently pre-defined placement functions are:
  246. \begin{description}
  247. \itemtt{()} does nothing, the window just maps where it was created
  248. by the client (this is the default value)
  249. \itemtt{user-positioning} asks the user to place it interactively
  250. \itemtt{rows.XXX.placement} automatically aligns the windows or icons on the
  251. sides of the screen. Replace {\tt XXX} by one of the eight names in the 
  252. following figure:
  253. \centerline{\texpsfig{places1.id}{261}{117}}
  254. You can set the space where the {\tt XXX} row lives by issuing calls to the
  255. control function \verb"rows.limits" with the syntax:
  256. \begin{verbatim}
  257.         (rows.limits rows.XXX [key value] ...)
  258. \end{verbatim}
  259. where {\tt key} is an atom setting a value (in pixels). Key can be either {\tt
  260. start}, {\tt end}, {\tt offset}, and {\tt separator} as shown in the following
  261. figure for {\tt XXX = top-left}:
  262. \centerline{\texpsfig{places2.id}{195}{90}}
  263. {\tt key} can also be {\tt sort}, in which case the icon in this row will
  264. always be kept sorted by the function given in argument. This function will
  265. take two windows as argument, and must return -1, 1, or 0 if the first window
  266. must be before, after, or if they have the same precedence. As an example, a
  267. {\tt sort-icons} function is provided; if you set it as a row sorting
  268. function, it will sort windows according to their weight as set in the
  269. property list {\tt icon-order} indexed on the class of the
  270. application\footnote{for instance, the default order is set by {\tt (setq
  271. icon-order '(Xmh 10 XPostit 5 XRn 20 XClock 2 XBiff 1 XLoad 20))}}. Windows
  272. having the same weight are sorted by window name. If an application is not
  273. found in this list, the value of the variable {\tt icon-order-default} is used
  274. (default 100). Of course, you are free to redesign other sort functions.
  275. \end{description}
  276. For instance you can manage your \verb"xterm" windows by:
  277. {\exemplefont\begin{verbatim}
  278.         (set-placement XTerm user-positioning)
  279.         (set-icon-placement any XTerm rows.right-top.placement)
  280.         (rows.limits rows.right-top 'start 100 'separator 2)
  281.         (rows.limits rows.top-left 'sort sort-icons)
  282. \end{verbatim}}
  283. You can define your own window placement functions and use them by the
  284. \verb"set-placement" call. They will be called with one argument, {\bf t}
  285. when the window (or icon) is first created, and {\bf ()} when the window is
  286. destroyed. This is why we needed an interpretive extension language! An example
  287. of another placement routine is given in the user-contributed package
  288. \seeref{near-mouse.gwm}.
  289. {\exemplefont\begin{verbatim}
  290.         (defun do-what-I-mean (flag) ...great code...)
  291.         (set-icon-placement any any do-what-I-mean)
  292. \end{verbatim}}
  293. \subsubsection{Menus}
  294. The displayed menus can be redefined by setting the following global
  295. variables to menus made with the chosen menu package. The default package
  296. is the \seeref{std-popups} package.
  297. \begin{description}
  298. \itemtt{window-pop} for the menu triggered in windows
  299. \itemtt{icon-pop} for the menu triggered in icons
  300. \itemtt{root-pop} for the menu triggered in the root window
  301. \end{description}
  302. You can look at their standard implementation in the \verb"def-menus.gwm"
  303. distribution file.
  304. \section{Jay Berkenbilt's Virtual Screen\hfill{\tt vscreen.gwm}}
  305. \label{vscreen}
  306. This little ``virtual screen'' package, made by Emanuel Jay Berkenbilt, MIT
  307. \verb|<qjb@ATHENA.MIT.EDU>| provides a way to use the physical screen of your
  308. workstation as a viewport on a larger root window. You move the screen by keys
  309. (default is {\sc Ctrl-Alt} arrows), can ask for a map of the screen to be
  310. displayed (item \verb|VS Show| in root menu), and to move back to origin (item
  311. \verb|VS Restore| in root menu). This quick-and-dirty package doesn't pretend
  312. to compete with {\sc Vtwm}, but it is a good start.
  313. The current upper left of the screen is shown a cross in the map. Clicking in
  314. the map will make it disappear, and the map is a snapshot of the current
  315. situation which is not automatically updated.
  316. You can customize it by setting the following variables:
  317. \begin{description}
  318. \itemtt{vscreen.menupos} position of the \verb|VS Show/Restore| entry in root 
  319. menu, to draw a map of the screen and to move back the screen to origin.
  320. \itemtt{vscreen.windowmenupos} position of the \verb|VS UnNail/Nail| Entry in
  321. window menu to make window move along the virtual screen.
  322. \itemtt{vscreen.modifiers} modifiers to press with arrow keys to move the
  323. screen around
  324. \itemtt{vscreen.no-bindings} set to \verb|t| if you do not want to bind arrow
  325. keys to \verb|vscreen.move-windows| functions.
  326. \itemtt{vscreen.right-left} amount the virtual screen is moved by on a
  327. horizontal key stroke. Defaults to half a screen.
  328. \itemtt{vscreen.down-up} amount the virtual screen is moved by on a
  329. vertical key stroke. Defaults to half a screen.
  330. \itemtt{vscreen.nailed-windows} a list of windows to be carried along with the
  331. screen. This list is a list of windowspecs (property lists)
  332. \seesnp{match-windowspec}.
  333. \end{description}
  334. \section{Anders Holst's Virtual Screen\hfill{\tt virtual.gwm}}
  335. \label{virtual}
  336. This virtual screen package consists of the files {\tt virtual.gwm},
  337. {\tt virtual-door.gwm}, {\tt virtual-pan.gwm}, and {\tt
  338. load-virtual}. It is essentially built upon Jay Berkenbilt's virtual
  339. screen package, {\tt vscreen.gwm}, described above. The main
  340. differences are: 
  341. \begin{itemize} 
  342. \item The map looks neater, and you can specify different colors for 
  343.     different kinds of windows.
  344. \item It is updated automatically when the window configuration changes.
  345. \item The map obeys some mouse events: You can move the real screen by
  346.     clicking the left button on the map, or move specific windows by
  347.     dragging them on the map with the middle button. Just in case the
  348.     map would not get updated automatically in some obscure situation,
  349.     you can update it by clicking the right button.
  350. \item The file ``virtual-door.gwm'' provides doors to places on the virtual
  351.     screen.
  352. \item The file ``virtual-pan.gwm'' provides either autopanning or ``pan on
  353.     click'', dependent of the value of the variable `pan-on-click'. 
  354. \item This package {\em does\/} pretend to compete with {\sc Vtwm}.
  355. \end{itemize}
  356. To use this package, load {\tt load-virtual.gwm} somewhere at the end of
  357. your ``*rc.gwm'' or ``.profile.gwm''. It will load the other three files
  358. mentioned above and set up necessary environment. Check the files {\tt
  359. virtual.gwm}, {\tt virtual-door.gwm}, and {\tt virtual-pan.gwm}
  360. individually for customization variables.
  361. \section{Adaptation of virtual.gwm\hfill{\tt std-virtual.gwm}}
  362. \label{std-virtual}
  363. To use {\tt virtual.gwm} in a standard profile, load {\tt std-virtual.gwm}
  364. which implements a simple rooms style on top of virtual.gwm. before this you
  365. can set up a list of room names (strings) that can be lists of room name,
  366. color of the background, and optional context variables to customize the door
  367. buttons (see {\tt virtual-door.gwm}). For instance:
  368. \begin{verbatim}
  369. (setq std-virtual.doors '(
  370.     ("Home" screen-background)
  371.     ("Comp" "LightBlue3")
  372.     ("Mail" 
  373.       (pixmap-make (color-make "seagreen3") "grainy" (color-make "seagreen2"))
  374.       background (color-make "seagreen3"))    
  375.     ("WWW" lightgrey door-icon (pixmap-load "netscape-small.xpm"))
  376.     ("Text" "LightYellow3")
  377.     ("Games" grey)
  378. (load "std-virtual.gwm")
  379. \end{verbatim}
  380. Icons then are visible in every room, and de-iconifying it via the middle
  381. button moves you to the de-iconified window room, or you can by menu
  382. de-iconify in the current room. Among them are the standard attributes such as
  383. background, foreground, font, tile, and some specific ones such as {\tt
  384. door-icon} for an icon pixmap to be displayed, and {\tt door-action} for wool
  385. code to be executed when entering the room.
  386. \section{Duane Voth's rooms\hfill{\tt dvrooms.gwm}}
  387. \label{dvroom}
  388. {\bf Duane Voth} (\verb"duanev@mcc.com") made a mini {\em rooms\/} 
  389. package to manage groups of windows. To use it, put in your .profile.gwm
  390. the line
  391. \begin{verbatim}
  392.         (load "dvrooms")
  393. \end{verbatim}
  394. before any calls to any \verb"(set-..." call.
  395. Then, with the standard profile, you can add new rooms by the root pop-up menu,
  396. or by explicitly calling the \verb"new-dvroom-manager" function in your
  397. profile, with the name of the room as arguments.
  398. {\exemplefont\begin{verbatim}
  399.         (new-dvroom-manager "mail")
  400.         (new-dvroom-manager "dbx")
  401. \end{verbatim}}
  402. The name of the room itself is the same editable plug as the one used for
  403. the \verb"simple-ed-win" window decoration, so that you can edit it
  404. by double-clicking or control-alt clicking with the left button.
  405. Only one room is ``open'' (non-iconified) at a time (unless
  406. \verb|dvroom.icon-box| is non-nil), and calling the
  407. functions \verb"add-to-dvroom" or \verb"remove-from-dvroom" (from the
  408. window menu or from {\WOOL}) on a window will add or remove it from the group
  409. of windows that will be iconified or de-iconified along with the room manager.
  410. Opening a room will close the previously open one, iconifying all its managed
  411. windows. New rooms start as icons.
  412. This package will recognize as a room manager any window with the name 
  413. \verb"rmgr". You can then create new rooms by other Unix processes.
  414. An X property GWM\_ROOM is maintained on windows added to rooms containing the
  415. name of the room manager, so that rooms are not lost on restarting {\GWM}.
  416. Context used:
  417. \begin{description}
  418. \itemtt{dvroom.font} font of the name of the room
  419. \itemtt{dvroom.background} background color
  420. \itemtt{dvroom.foreground} color of the text of the name
  421. \itemtt{dvroom.borderwidth} borderwidth of the room
  422. \itemtt{dvroom.x, dvroom.y} initial position of the room
  423. \itemtt{dvroom.name} string used to build the name of the room. Defaults
  424. to \verb|"Room #"| (a number will be concatenated to it).
  425. \itemtt{edit-keys.return, edit-keys.backspace, edit-keys.delete} keys used
  426. for editing, see \verb"simple-ed-win", p~\pageref{simple-ed-win}
  427. \itemtt{dvroom.auto-add} if set to \verb|t| (default \verb|()|), new windows
  428. are automatically added to the current active dvroom, if there is one.
  429. \itemtt{dvroom.icon-box} if set to \verb|t|, dvrooms are no more exclusive
  430. (i.e., opening one do not close the others anymore).
  431. \end{description}
  432. Dwight Shih \verb|<dwight@s1.gov>| added the functions:
  433. \begin{description}
  434. \itemtt{roll-rooms-up, roll-rooms-down}, to sequentially open the next room.
  435. This is very handy to bind to a function key for instance.
  436. \itemtt{magic-dvroom-attach}, which look for all the window with name in the
  437. form \verb|<Room>::<Name>| and incorporates them into the dvroom
  438. \verb|<Room>|, if any exists.
  439. \itemtt{dvroom-remapping} unmap all windows belonging to a dvroom.
  440. \end{description}
  441. \section{Group Iconification\hfill{\tt icon-groups.gwm}}
  442. \label{icon-groups}
  443. Loading the {\tt icon-groups} package redefines the {\tt iconify-window}
  444. function to use only one icon for all windows of the same group. Iconifying
  445. the group leader will iconify all the windows in the group, whereas
  446. iconifying a non-leader member of the group will only unmap it and map the
  447. common icon if it is not already present.
  448. You can specify which groups you do not want iconified this way by setting
  449. their class in the list \verb|icon-groups.exclude|. For instance, if you want
  450. to iconify your XPostits this way, but not you emacs or xmh windows, add this
  451. in your .profile.gwm:
  452. {\exemplefont\begin{verbatim}
  453.         (load "icon-groups")
  454.         (setq icon-groups.exclude '(Xmh Emacs))
  455. \end{verbatim}}
  456. It will also add two more items in the menu:
  457. \begin{description}
  458. \itemtt{Iconify Group} to iconify all the windows belonging to the group of the
  459. current window.
  460. \itemtt{Iconify Others} to iconify all the windows belonging to the group of 
  461. the current window, but not the current window.
  462. \end{description}
  463. \section{Opaque move\hfill{\tt move-opaque.gwm}}
  464. \label{move-opaque}
  465. Loading the {\tt move-opaque} package redefines the {\tt move-window} function
  466. to move the whole window, not just an outline of it. You can control which
  467. windows will be moved this way by setting two context variables:
  468. \begin{description}
  469. \itemtt{move-opaque.condition} will be evaluated, and if the result is
  470. non-nil, the window will be moved in an ``opaque'' way, otherwise the standard
  471. outline dragging will be used. Default is to move only the windows whose pixel
  472. area is less than the \verb"move-opaque.cutoff-area" value, which could be
  473. specified by:
  474. {\exemplefont\begin{verbatim}
  475.         (setq move-opaque.condition
  476.             '(< (* window-width window-height) 
  477.                 move-opaque.cutoff-area)
  478. \end{verbatim}}
  479. \itemtt{move-opaque.cutoff-area} which defaults to 250000, used when
  480. discriminating windows by size.
  481. \end{description}       
  482. \section{Delta\hfill{\tt deltabutton.gwm}}
  483. \label{deltabutton}
  484. The \verb|deltabutton| function is used to perform two different action on the
  485. press of a button, depending on whether the user release the button without
  486. moving the mouse more than \verb|deltabutton.delta| pixels (defaults to 4) in
  487. any direction. To use deltabutton, you must have loaded the
  488. \verb|deltabutton.gwm| file, and in a transition of a fsm triggered by a
  489. buttonpress event, this function will wait for the button to be released, and
  490. return \verb|t| if the pointer has moved more than \verb|deltabutton.delta|
  491. pixels, or \verb|()| if not.
  492. For instance, to raise a window if you click on it, and to move it only if you
  493. move the mouse more than 4 pixels, declare in your .profile.gwm:
  494. {\exemplefont\begin{verbatim}
  495.         (load 'deltabutton)
  496.         (setq standard-behavior
  497.            (state-make
  498.               (on (buttonpress select-button alone) 
  499.                   (if (deltabutton)
  500.                       (progn (raise-window)(move-window))
  501.                     (raise-window)))
  502.               standard-behavior))
  503.         (reparse-standard-behaviors)
  504. \end{verbatim}}
  505. \section{Floating windows\hfill{\tt float.gwm}}
  506. \label{float}
  507. Rod Whitby \verb|<rwhitby@adl.austek.oz.au>| made this package to
  508. interactively make some windows ``float'' always on top of others, or always
  509. ``sink'' to the back of the screen.  Loading this package will add a multiple
  510. menu item to the window menu to make the current window float Up, Down, or to
  511. make it a normal window back again (item ``No'').
  512. \section{Unconfined-move\hfill{\tt unconf-move.gwm}}
  513. \label{unconf-move}
  514. Rod Whitby \verb|<rwhitby@adl.austek.oz.au>| made this package to
  515. be able to still move and resize windows out of screen boundaries even when
  516. you confined them by \seensp{confine-windows}. With this package loaded,
  517. unconfined move is obtained by moving/resizing with Control-Alt mouse buttons,
  518. while Alt mouse buttons keep moving/resizing in confined mode.
  519. \section{Suntools-keys\hfill{\tt suntools-keys.gwm}}
  520. \label{suntools-keys}
  521. Rod Whitby \verb|<rwhitby@adl.austek.oz.au>| made this package to
  522. provide some suntools-like keyboard shortcuts to window management functions:
  523. \begin{description}
  524. \itemtt{L5 or F5} raise window to top, or lower it if it is already on top.
  525. \itemtt{L7 or F7} iconify/ de-iconify window.
  526. \end{description}
  527. \section{Mike Newton's Keys\hfill{\tt mon-keys.gwm}}
  528. \label{mon-keys}
  529. Mike Newton \verb|<newton@gumby.cs.caltech.edu>| has contributed another
  530. package to add keyboard shortcuts to window management functions.
  531. \begin{description}
  532. \itemtt{Button 1 (alone or w/ Alt)} raise or move
  533. \itemtt{Button 3 (w/ Alt-Control)} iconify or raise
  534. \itemtt{F1 (alone)} choose next window
  535. \itemtt{F2 (alone)} choose previous
  536. \itemtt{F1 (w/ alt)} circulate down (no focus change)
  537. \itemtt{F2 (w/ alt)} circulate up (no focus change)
  538. \itemtt{F3 (alone)} open / close
  539. \itemtt{F4 (various)} change window sizes (not Emacs!)
  540. \itemtt{F5 (alone)} raise 
  541. \itemtt{F11 or F9 (alone, in root)} emergency -- map everything
  542. \itemtt{F12 or F10 (alone)} exec cut buffer, printing results
  543. \end{description}       
  544. \section{Standard pop-up menus\hfill{\tt std-popups.gwm}}
  545. \label{std-popups}
  546. This package implements a very simple pop-up menu package. The variables
  547. \verb"window-pop-items", \verb"icon-pop-items", and \verb"root-pop-items"
  548. contains a list of menu item which be used after reading user
  549. \verb".profile.gwm" to build the actual menus\footnote{the actual menu will be
  550. build by loading the package whose name is defined by the value of the
  551. variable \verb"menu.builder", thus alternative menu packages are thus free to
  552. redefine this value.},
  553. which will be named \verb"window-pop", \verb"icon-pop", and
  554. \verb"root-pop"\footnote{if the user defines any of this variables in his
  555. profile, it overrides the building of the corresponding menu from the lists.}.
  556. You can then insert or delete items in this list at will. Nil entries in this
  557. list will just be skipped by the actual menu creation routine. You may want to
  558. use the function \seeref{insert-at}. Dvrooms and vscreen are example of
  559. packages adding menu items in the standard menus.
  560. Menu items can be created with the help of the following functions:
  561. \begin{description}
  562. \itemtt{\verb"(pop-label-make <Label>)"} 
  563. to create an inactive label on top of the menu, 
  564. where \verb"Label" is the string to be displayed as the title of the menu.
  565. \itemtt{\verb|(item-make <Label> <Expr>)|} 
  566. to create a label triggering a {\WOOL} function call where \verb"Label" is the
  567. string to be displayed as the item of the menu, and \verb"Expr" is {\WOOL}
  568. code which will be evaluated when releasing the button in the item.
  569. \itemtt{\verb|(multi-item-make <item-desc>)|} where \verb"item-desc" can be of
  570. the form:
  571. \begin{description}
  572. \item[\verb|<Label>|] creates an insensitive label with this \verb|<Label>| as
  573. text.
  574. \item[\verb|(<Label> <Expr>)|] creates a button with text
  575. \verb|Label| triggering the evaluation of the wool expression \verb|Expr|.
  576. \item[()] leaves an extensible space.
  577. \end{description}
  578. \end{description}
  579. {\bf Note:} in fact, in the preceding functions, any \verb|<Label>| can be in
  580. fact either a string, an already built pixmap which will be used as-is, or
  581. {\WOOL} code that will be evaluated and must return a pixmap which will be
  582. used to build the menu item.
  583. For instance, the default window menu is the list:
  584. {\exemplefont\begin{verbatim}
  585.         '((item-make "iconify" (iconify-window))
  586.             (item-make "Exec cut" 
  587.                        (execute-string (+ "(? " cut-buffer ")")))
  588.             (item-make "client info" (print-window-info))
  589.             (item-make "redecorate" (re-decorate-window))
  590.             (item-make "kill" (if (not (delete-window))
  591.                                   (kill-window)))
  592.             ))
  593. \end{verbatim}}
  594. Moreover, you can control the appearance of the label and the items of the 
  595. menu by the following variables:
  596. \begin{description}
  597. \itemtt{pop-item.font} font of the items
  598. \itemtt{pop-item.foreground} color of their text
  599. \itemtt{pop-item.background} color of their background. Due to the simple menu
  600. item  highlighting code in this package, all items must have the same colors
  601. \itemtt{pop-label.font} font of the labels on top of menus
  602. \itemtt{pop-label.foreground} color of their text
  603. \itemtt{pop-label.background} color of their background
  604. \end{description}
  605. \subsubsection{Default action}
  606. Menus can have a default action, i.e.\ wool code which is triggered if the user
  607. lets go the mouse button before the menu appears. Default actions should be as
  608. harmless as possible, of course. They can be set by 
  609. \begin{verbatim}
  610. (menu-default-action <Menu> <Expr>)
  611. \end{verbatim}
  612. where \verb|<Menu>| is the menu (\verb"window-pop", \verb"icon-pop", or
  613. \verb"root-pop"), and \verb|<Expr>| is the code to be executed.
  614. \begin{verbatim}
  615. (menu-default-item <Menu> number)
  616. \end{verbatim}
  617. sets the item in which the mouse cursor is when popping up the menu (defaults
  618. to first item).
  619. \section{FrameMaker support\hfill{\tt framemaker.gwm}}
  620. \label{framemaker}
  621. This file, that you can copy in your private gwm directory and modify, attempts
  622. to provide some support for framemaker (v3.0) windows, i.e:
  623. \begin{itemize}
  624. \item allow clean de-iconification of dialog boxes by framemaker (such as
  625. paragraph format). \seesnp{map-on-raise}
  626. \item fixes framemaker window placement to make them appear near the mouse
  627. \item provide relevant icon names for framemaker dialogs (they had none)
  628. \item redefine windows title colors
  629. \end{itemize}
  630. \section{Gosling Emacs mouse support\hfill{\tt emacs-mouse.gwm}}
  631. \label{emacs-mouse}
  632. This package implements a way to use the mouse with the {\bf Gosling} emacs,
  633. sold by {\bf Interpress}. You will need to load the emacs macros contained
  634. in the {\tt gwm.ml} file included in the distribution in your emacs. Then,
  635. in a window decorated with the {\tt simple-ed-win} package, pressing
  636. {\bf Control} and:
  637. \begin{description}
  638. \item[left mouse button] will set the emacs text cursor under the mouse
  639. pointer
  640. \item[middle mouse button] will set the mark under the mouse pointer
  641. \item[right mouse button] will pop a menu of commonly-used emacs functions
  642. (execute macro, cut, copy, paste, go to a C function definition, re-do last
  643. search)
  644. \end{description}
  645. Clicking in the mode lines will do a full screen recursive edit on the
  646. buffer if not in a target and in the targets:
  647. \begin{description}
  648. \item[{\tt [EXIT]}] will delete the window if it is not the only one on
  649. the screen, or do an {\tt exit-emacs}
  650. \item[{\tt [DOWN]}] will scroll one page down the file
  651. \item[{\tt [ UP ]}] will scroll one page up the file
  652. \end{description}
  653. This package is included rather as an example of things that can be done
  654. to work with old non-windowed applications than as a recommended way of
  655. developing code.
  656. \section{The customize function}
  657. \label{customize}
  658. {\usagefont\begin{verbatim}
  659. (customize deco screen window-description
  660.            variable1 value1 variable2 value2...)
  661. \end{verbatim}}\usageupspace
  662. Most following sample window and icon decorations can be  tailored in a
  663. global way by setting global variables in your \verb|.profile.gwm| before
  664. using the decoration, but these variable can be set individually to
  665. decorations by use of the customize function. For instance, since the
  666. simple-icon documentation tells you that title is added to icons according to
  667. the value of the \verb|simple-icon.legend| global variable, you can say that
  668. you do not want legends under your icons, except for xclocks by:
  669. {\exemplefont\begin{verbatim}
  670.         (set-icon-window XClock simple-icon)
  671.         (setq simple-icon.legend ())
  672.         (customize simple-icon any XClock 
  673.                    legend t)
  674. \end{verbatim}}
  675. Customize works by defining the customization items in the environnement of
  676. the decoration. Thus, 
  677. {\exemplefont\begin{verbatim}
  678.         (customize simple-win any XClock tile t)
  679. \end{verbatim}}
  680. will set the background tile of decoration items to t (transparent), which in
  681. the case of simple-window will only leave the label apparent.
  682. {\bf Note:} In current version, only \verb|simple-win|, \verb|simple-icon|,
  683. and \verb|term-icon| decorations support the \verb|customize| function.
  684. The customization arguments can be given as a single list argument. In other
  685. words, both following calls are equivalent:
  686. {\exemplefont\begin{verbatim}
  687.         (customize simple-icon any XClock legend t 
  688.                    background (color-make "green"))
  689.         (customize simple-icon any XClock 
  690.                    (legend t 
  691.                     background (color-make "green")))
  692.                     
  693. \end{verbatim}}
  694. {\bf Note:} Moreover, customization values can be also given to decorations
  695. which support the customize protocol as arguments (do not forget to quote the
  696. variable names, the decoration functions evaluate their arguments). Thus we
  697. can define a new decoration \verb"clock-deco", and use it afterwards just as
  698. another decoration with the same results as the preceding examples:
  699. {\exemplefont\begin{verbatim}
  700.         (require 'simple-icon)     ; simple-icon must be defined
  701.         (setq clock-deco 
  702.               (simple-icon legend t 
  703.                            background (color-make "green")))
  704.         (set-icon-window XClock clock-deco)                 
  705. \end{verbatim}}
  706. {\bf Warning:} consecutive calls to \verb|customize| on the same
  707. window descriptions
  708. overrides descriptions, but do not append to them. In the following case:
  709. {\exemplefont\begin{verbatim}
  710.         (customize simple-win any XClock background (color-make "green"))
  711.     (customize simple-win any XClock legend "bottom")
  712. \end{verbatim}}
  713. the second line will make the system forget the first line.
  714. %%%%%%%%%%%%%  PICK
  715. % This section should perhaps be somewhere just before the current
  716. % section 3.14 (Sample window decorations).
  717. \section{Pick a window with the mouse\hfill{\tt pick.gwm}}
  718. This file provides a quite handy way for the user to select a window
  719. with the mouse. The main function is {\tt (with-picked EXPR)} which first
  720. lets the user select a window, and then runs EXPR on the selected
  721. window. This can be used from eg.\ a root menu, to implement the style
  722. of first selecting in the menu what to do, and then what window to do
  723. it to. 
  724. You can also use the more basic function {\tt (pick-window)} which
  725. returns the wob number of the picked window. This function considers
  726. the variable {\tt cursor}, as the cursor to show during picking.
  727. \section{Sample window decorations\hfill{\tt *-win.gwm}}
  728. \label{standard-decorations}
  729. These are standard window decorations which can be used via the
  730. \verb"set-window" function of the standard profile. They can be found in
  731. files whose names end in {\tt -win.gwm} in the distribution directory of
  732. {\GWM}.
  733. \subsection{Simple window\hfill{\tt simple-win.gwm}}
  734. \label{simple-win}
  735. \centerline{\texpsfig{simple-win.id}{144}{77}}
  736. This is a really simple window decoration with only a title bar on top of
  737. the window. The name of the window is centered in the bar. The title bar and
  738. the name of the window can change appearance when they become ``active'' (i.e.\ 
  739. have the keyboard focus).
  740. This style is customizable by setting the following variables at the top
  741. of your .profile, before any call to \verb"set-window":
  742. \begin{description}
  743. \itemtt{simple-win.font simple-win.active.font} 
  744. fonts used for printing the title
  745. \itemtt{simple-win.label.borderwidth simple-win.active.label.borderwidth} 
  746. borderwidth of the title plug in the bar
  747. \itemtt{simple-win.background simple-win.active.background} 
  748. background color of the title bar
  749. \itemtt{simple-win.label.background simple-win.active.label.background} 
  750. background color of the title plug
  751. \itemtt{simple-win.label.foreground simple-win.active.label.foreground} 
  752. pen color to draw window name in the title plug
  753. \itemtt{simple-win.label.border simple-win.active.label.border} 
  754. color of the border of the title plug in the bar
  755. \itemtt{simple-win.label}
  756. a lambda of one argument, the title of the window, that should return the
  757. title to use in the label
  758. \itemtt{simple-win.legend} a string to know where to put the window title. Can
  759. be "top", "left", "right", "bottom", top being the default.
  760. \itemtt{simple-win.lpad simple-win.rpad}
  761. lpad (left padding) and rpad (right padding) are two numbers specifing the
  762. number of elastic spaces to put before and after the label. The default is 1
  763. and 1, centering the label.
  764. \end{description}
  765. As you can see, each variable comes in pair, one for ``inactive'' state, the
  766. other for ``active'' state. For each of them, the ``active'' one can bet set
  767. to \verb|()|, which means just use the same value as the ``inactive'' value.
  768. Since this decoration supports the \verb|customize| function, all the above
  769. values can also be set via the customize function, or as arguments to the
  770. function \verb|simple-win| itself. In these cases, not that you must use the
  771. name of the variables without the \verb|simple-win.| prefix, e.g.\ you could
  772. have all simple-win windows with title font written in black, except for
  773. XClock by the calls:
  774. {\exemplefont\begin{verbatim}
  775.         (setq simple-win.active.label.foreground black)
  776.         (customize simple-icon any XClock
  777.                    active.label.foreground (color-make "green"))
  778. \end{verbatim}}
  779. Or we can remove the Netscape: prefix on netscape titles by:
  780. {\exemplefont\begin{verbatim}
  781.         (customize simple-win any Netscape
  782.             label (lambdaq (s) (match "Netscape: \\(.*\\)$" s 1)))
  783. \end{verbatim}}
  784. \subsection{Simple editable window\hfill{\tt simple-ed-win.gwm}}
  785. \label{simple-ed-win}
  786. \centerline{\texpsfig{simple-ed-win.id}{221}{101}}
  787. This decoration has a titlebar on top of it, including an iconification
  788. plug and an editable name plug. Moreover the whole border changes color to
  789. track input focus changes.The look of this
  790. frame can be altered by setting the following variables:
  791. \begin{description}
  792. \itemtt{icon-pixmap} to a pixmap used as an iconification button.
  793. \itemtt{simple-ed-win.borderwidth} to the width in pixels of the 
  794. sensitive border of the window
  795. \itemtt{simple-ed-win.font} to the font used for printing the title.
  796. \itemtt{simple-ed-win.active} to the color of the top bar and border
  797.  for the window having the keyboard focus (defaults to darkgrey).
  798. \itemtt{simple-ed-win.inactive} to the color of the top bar and border
  799. when the window do not have the keyboard focus (defaults to grey).
  800. \itemtt{simple-ed-win.label.background} background color of the name.
  801. \itemtt{simple-ed-win.label.foreground} color of text of the name.
  802. \end{description}
  803. When you click in the icon button at the left of the titlebar (whose pixmap
  804. can be redefined by setting the global variable \verb"icon-pixmap" to a
  805. pixmap) with the left button, the window is iconified. If you click with the
  806. middle button, you will be able to drag the outline of the icon and release
  807. it where you want it to be placed.
  808. If you double-click a mouse button, or do a click with the {\bf control} and
  809. {\bf alternate} keys depressed, in the editable name plug at the right of
  810. the titlebar, you will be able to edit the name of the window (and the
  811. associated icon name) by a simple keyboard-driven text editor whose keys
  812. are are given as strings in the following variables:
  813. \begin{description}
  814. \itemtt{edit-keys.return} to end edition (defaults to \verb|"Return"|).
  815. \itemtt{edit-keys.delete} to wipe off all the text (defaults to 
  816. \verb|"Delete"|).
  817. \itemtt{edit-keys.backspace} to erase last character (defaults to 
  818. \verb|"Backspace"|).
  819. \itemtt{{\em any key}} to be appended to the text.
  820. \end{description}
  821. The plug will invert itself during the time where it is editable. You quit
  822. editing by pressing {\bf Return}, double-clicking in the plug or exiting the
  823. window.
  824. This decoration style also supports the \verb"emacs-mouse" package.
  825. \subsection{Frame\hfill{\tt frame-win.gwm}}
  826. \label{frame-win}
  827. \centerline{\texpsfig{frame-win.id}{154}{75}}
  828. This decoration consists in a frame around the window. The look of this
  829. frame can be altered by setting the following variables:
  830. \begin{description}
  831. \itemtt{look-3d} to {\tt t} to have a ``3D-looking'' frame (left figure) 
  832. instead of the 2d-looking one (right figure).
  833. \itemtt{frame.top-text} to an object which will be evaluated to yield the
  834. text to be put on top of the frame
  835. \itemtt{frame.bottom-text} to an object which will be evaluated to yield the
  836. text to be put on the bottom of the frame, for instance:
  837. {\exemplefont\begin{verbatim}
  838.         (setq frame.bottom-text '(machine-name))
  839. \end{verbatim}}
  840. \itemtt{frame.pixmap-file} to the prefix of the 8 bitmaps (or pixmaps) files
  841. used to build the frame. The suffixes will be {\tt .tl .t .tr .r .br .b .bl
  842. .l}, clockwise from upper left corner.
  843. \itemtt{frame.pixmap-format} to the format of the files: \verb"'bitmap"
  844. (default) or \verb"'pixmap"
  845. \itemtt{frame.bar-width} to the width of the four bars (should match the
  846. pixmap files)
  847. \itemtt{frame.inner-border-width} to the inner border width
  848. \end{description}
  849. \section{Sample icons\hfill{\tt *-icon.gwm}}
  850. \label{standard-icons}
  851. These are standard icon windows descriptions which can be used via the
  852. \verb"set-icon-window" function of the standard profile. They can be found in
  853. files whose names end in {\tt -icon.gwm} in the distribution directory of
  854. {\GWM}.
  855. \subsection{Simple icon\hfill{\tt simple-icon.gwm}}
  856. \label{simple-icon}
  857. This icon consists in an (optional) image and the icon-name of the
  858. window below it. The image is by priority order:
  859. \begin{description}
  860. \item[the user pixmap] set by the \seeref{set-icon} call
  861. \item[the window] the client has set in its hints to the window manager to
  862. use as an icon
  863. \item[the pixmap] the client has set in its hints to the window manager to
  864. use for its icon
  865. \end{description}
  866. Used context variables:
  867. \begin{description}
  868. \itemtt{simple-icon.font} for the font used to display the icon name.
  869. \itemtt{simple-icon.legend} boolean flag telling to add the icon name under
  870. the icon for the application. Defaults to \verb"()". Can be be "top" "bottom"
  871. "right" "left" according to which side you want it. \verb|t| is a shortcut for
  872. "bottom".
  873. \itemtt{simple-icon.foreground} pen color of the icon name
  874. \itemtt{simple-icon.background} background color of the icon
  875. \itemtt{simple-icon.borderwidth} borderwidths used
  876. \itemtt{simple-icon.borderpixel} color of the borders
  877. \itemtt{stretch} allows the legend to expand past the icon graphic itself
  878. without being clipped by it. \verb|stretch| can have the value \verb|t| for
  879. centered, "top" "bottom" "right" "left" for the direction to extend to.
  880. \itemtt{simple-icon.label}
  881. a lambda of one argument, the name of the icon, that should return the
  882. title to use in the label. See simple-win for examples.
  883. \end{description}
  884. This decoration supports the \seeref{customize} function.
  885. \subsection{Terminal display icon\hfill{\tt term-icon.gwm}}
  886. \label{term-icon}
  887. \centerline{\texpsfig{term-icons.id}{151}{26}}
  888. This icon looks like a small computer display with the window name inside
  889. it. Note that the icon resizes itself to adjust to the dimensions of the
  890. displayed name.
  891. Used context variables:
  892. \begin{description}
  893. \itemtt{term-icon.font} for the font used to display the icon-name.
  894. \itemtt{term-icon.foreground} for the color of text and decorations (defaults
  895. to black)
  896. \itemtt{term-icon.background} for the background color (defaults
  897. to white)
  898. \itemtt{term-icon.borderwidth} defaults to 0
  899. \itemtt{term-icon.borderpixel} defaults to black
  900. \end{description}
  901. This decoration supports the \seeref{customize} function.
  902. \section{Utilities\hfill{\tt utils.gwm}}
  903. \label{utils}
  904. This package implements some useful functions for the {\WOOL} programmer. It
  905. is automatically loaded by the standard profile.  List this file to see the
  906. current ones.
  907. \subsection{Standalone Buttons: {\tt place-3d-button}}
  908. \label{place-3d-button}
  909. {\usagefont\begin{verbatim}
  910. (place-3d-button text pencolor maincolor wool-expression)
  911. (place-button text pencolor ulb normal pressed lrb 
  912.               wool-expression)
  913. \end{verbatim}}\usageupspace
  914. Will create and place as an independent window (of client class \verb|Gwm|,
  915. client name \verb|button|, and window name \verb|text|) a 3d-looking window
  916. with visual feedback when pressed, which will execute the
  917. \verb|wool-expression| when pressing any button in it. \verb|pencolor| is the
  918. color of the text, and \verb|maincolor| must be one of the shaded colors in
  919. the \verb|/usr/lib/X11/rgb.txt| file\footnote{for instance, \verb|pink| is
  920. such a color, since the color table contains the entries \verb|pink1|,
  921. \verb|pink2|, \verb|pink3|, and \verb|pink4| in clear-to-dark order. The full
  922. list of such colors is in the \verb|shaded-colors| list.}.
  923. If you want to tailor colors yourself, use the \verb|place-button| form, where
  924. you must choose the upper-left and lower-right border colors as well as the
  925. background colors of the button when normal and depressed.
  926. \verb|place-3d-button| calls in fact {\tt (place-button text pencolor
  927. maincolor1 maincolor2 maincolor3 maincolor4 wool-expression)}
  928. To have a demo of this feature, you can execute the \verb|(demo-button)|
  929. function, which will make a button cycling through all the colors in the
  930. \verb|shaded-colors| list.
  931. You can implement different behaviors depending on button pressed and modifier
  932. by looking at the value of \verb|(current-event-modifier)| and
  933. \verb|(current-event-code)| in the \verb|wool-expression| body. Look at the
  934. end of the file \verb|profile-colas.gwm| for examples.
  935. The following code will create a button that will toggle iconification of all
  936. the big postits on my screen, the button being in the thistle range of colors.
  937. {\exemplefont\begin{verbatim}
  938.       (place-3d-button "Post Big"
  939.         black 'thistle
  940.         '(for window (list-of-windows) 
  941.           (if (= window-name 'PostItNoteBig)
  942.             (if window-is-mapped (iconify-window)
  943.               (progn (map-window)(raise-window))
  944.       ))))
  945. \end{verbatim}}
  946. \centerline{\texpsfig{PostBig.id}{356}{82}}
  947. \subsection{Matching windows by regular expressions: {\tt match-windowspec}}
  948. \label{match-windowspec}
  949. {\usagefont\begin{verbatim}
  950. (match-windowspec windowspec)
  951. \end{verbatim}}\usageupspace
  952. Where \verb|windowspec| is a property list with \verb|'client-class|,
  953. \verb|'client-name|,  and \verb|'window-name| as possible tags. Windowspecs 
  954. can themselves contain regular expressions.
  955. {\exemplefont\begin{verbatim}
  956.         ((list 'client-class "XTerm" 'window-name ".*build"))
  957. \end{verbatim}}
  958. will match (return \verb|t|) all xterms whose window name ends in \verb|build|.
  959. This code was provided by Jay Berkenbilt \verb|<qjb@ATHENA.MIT.EDU>|.
  960. \subsection{insert-at}
  961. \label{insert-at}
  962. {\usagefont\begin{verbatim}
  963. (insert-at element list position)
  964. \end{verbatim}}\usageupspace
  965. Utility function to insert an element \verb"element" in a list \verb"list" at
  966. position \verb"position". The  list is physically modified in place. Useful to
  967. insert items in menu lists.
  968. \section{User-contributed utilities}
  969. \label{user-contrib-utils}
  970. Some user-provided useful little hacks or programming helps have been
  971. included too.
  972. \subsection{Near-mouse\hfill{\tt near-mouse.gwm}}
  973. \label{near-mouse.gwm}
  974. This placement function was provided by Eyvind Ness \verb|<eyvind@hrp.no>|.
  975. Saying:
  976. {\exemplefont\begin{verbatim}
  977.         (require 'near-mouse)
  978.         (set-placement XPostit near-mouse)
  979. \end{verbatim}}
  980. will make all newly created XPostit windows pop up near the mouse.
  981. \section{Programming Styleguide for the standard distribution}
  982. \label{standard-styleguide}
  983. The styleguide to write decorations is to be written. Until then, look at
  984. existing files such as {\tt .gwmrc.gwm, .profile.gwm, simple-ed-win.gwm} to
  985. see what is the current style. We will appreciate all feedback to these
  986. conventions, which are not settled yet.
  987. The main idea is that a decoration package \verb"foo" should, when loaded,
  988. define a \verb"foo" function which, once executed will return the appropriate
  989. decoration, using the pre-defined behaviors.
  990. All persistent variables of the packages should be prefixed by the package
  991. name, as in \verb"foo.bar".
  992. Do not forget to define in fact one decoration per screen or be cautious not
  993. to mix colors, pop-ups, pixmaps and cursors from screen to screen. Use 
  994. \verb"defname screen." to declare screen-specific variables.
  995. The user should be allowed to customize the decoration by setting global
  996. variables in its \verb".profile.gwm" file, which will be interpreted during
  997. the loading of your package.
  998. The fsm you make for your package should be constructed from the behaviors
  999. defined in \verb".gwmrc.gwm", such as standard-behavior,
  1000. standard-title-behavior, window-behavior, icon-behavior, root-behavior, or
  1001. already built fsms such as fsm, window-fsm, icon-fsm, root-fsm.
  1002. All values you want to attach to windows or wobs should be put as properties
  1003. in the property-list of the wobs, by calls to 
  1004. \verb"(## 'key wob value)"
  1005. The main idea is, if you must modify {\tt .gwmrc.gwm} to code your window
  1006. decoration, mail us your desiderata and/or enhancements, so that we should
  1007. be able to keep the same .gwmrc for all decorations.
  1008. I maintain mailing lists for people to exchange ideas about {\GWM}. Mail me
  1009. a request if you are interested at \verb"gwm@mirsa.inria.fr".
  1010. \subsection{The {\tt simple-win} example}
  1011. In the distribution, you can look at the \verb|simple-win.gwm| file to see how
  1012. to define a proper decoration. In this file you will see how to define a
  1013. decoration that supports multiple screens, and some user customization via the
  1014. \verb|customize| function. The trick is not to forget to put at build time all
  1015. necessary information (in the \verb|property| field of the window) for using
  1016. later during normal operation, where all code is triggered by the decoration
  1017. \verb|fsm|s.
  1018. \section{Other profiles}
  1019. Other nice profiles have also been developed in parallel to the standard
  1020. profile, but they have not been integrated yet, i.e.\ they need their own
  1021. {\tt .gwmrc.gwm}.
  1022. \subsection{The MWM emulation package\hfill{\tt mwm.gwm}}
  1023. \centerline{\texpsfig{mwm-wins.sid}{350}{89}}
  1024. {\bf Frederic Charton} made this profile emulating the {\bf M}otif
  1025. {\bf W}indow {\bf M}anager. To use it, you must give the command line 
  1026. option {\bf -f mwm} to {\GWM}.
  1027. You can customize it by copying in your
  1028. \verb"gwm" directory (in you GWMPATH) the files:
  1029. \begin{description}
  1030. \itemtt{mwmrc.gwm} all the resources settable in ``.mwmrc'' for {\sc Mwm}
  1031. are also settable here, except for the menus.
  1032. \itemtt{mwm-menusrc.gwm} description of the menus.
  1033. \itemtt{mwmprofile.gwm} miscellaneous wool customizations (needs {\WOOL}
  1034. knowledge)
  1035. \end{description}
  1036. and editing it. You may want to get the {\sc Mwm} manual for the description
  1037. of all the available functions. For instance, to set the input focus management
  1038. from ``click to type'' (default) to ``real estate'' (input focus is always
  1039. to the window underneath the pointer), edit \verb"mwmrc.gwm" and change
  1040. the line \verb"(: keyboardFocusPolicy 'explicit)" to 
  1041. \verb"(: keyboardFocusPolicy 'pointer)".
  1042. {\bf Warning:} This profile is still mono-screen, i.e.\ to manage 2 screens
  1043. on your machine, you must run 2 gwms, for instance by:
  1044. {\exemplefont\begin{verbatim}
  1045.         gwm -1 -f mwm unix:0.0 &
  1046.         gwm -1 -f mwm unix:0.1 &
  1047. \end{verbatim}}
  1048. \subsection{The TWM emulation package\hfill{\tt twm.gwm}}
  1049. \centerline{\texpsfig{twm-wins.sid}{273}{155}}
  1050. {\bf Arup Mukherjee} (\verb"arup@grasp.cis.upenn.edu") made a {\sc
  1051. Twm} emulator. To use it, you must give the command line 
  1052. option {\bf -f twm} to {\GWM}.
  1053. {\bf Note:} This package seems to be made obsolete by the {\tt vtwm} package
  1054. by {\bf Anders Holst} (\verb"aho@nada.kth.se"), see below.
  1055. You can customize it by copying in your \verb"gwm"
  1056. directory (in you GWMPATH) and editing the files:
  1057. \begin{description}
  1058. \itemtt{twmrc.gwm} Contains numerous options (mainly colors) that can be
  1059. set from here. The file is well commented, and most of the color
  1060. variables have self-explanatory names. You can also specify from here
  1061. whether or not the icon manager code is to be loaded.
  1062. It also contains definitions for the three variables
  1063. \verb"emacs-list", \verb"xterm-list", and \verb"xload-list". 
  1064. The specified hostnames are
  1065. used to build menus from which you can have gwm execute the respective
  1066. command on a host via the ``rsh'' mechanism (note that your .rhosts
  1067. files must be set up correctly for this to work). Note that unlike
  1068. with the standard profile, the rxterm and rxload scripts are {\bf NOT}
  1069. used.
  1070. \itemtt{twm-menus.gwm} The contents of all the menus are specified
  1071. here. To change more than the xterm, xload, or emacs lists, you should
  1072. modify this file.
  1073. \itemtt{twm.gwm} The only things that one might wish to customize here are the
  1074. behaviors (which specify the action of a given button on a given
  1075. portion of the screen)
  1076. \end{description}
  1077. %%%%%%%%%%%%%  VTWM
  1078. % Proposed section is 3.19.3
  1079. \subsection{The VTWM emulation package\hfill{\tt vtwm.gwm}}
  1080. This profile, written by {\bf Anders Holst} (\verb"aho@nada.kth.se"),
  1081. is a thorough extension and revision of the TWM profile. It tries to
  1082. provide most of the look and options you have in the the real {\sc
  1083. Vtwm} and {\sc Tvtwm} window managers. To use it, give the command
  1084. line option {\bf -f vtwm}.
  1085. All user customization is done in the file {\tt vtwmrc.gwm}. This
  1086. includes colors and general appearance, menus, and behaviors. Copy
  1087. {\tt vtwmrc.gwm} to your home directory and make the appropriate
  1088. changes. The file is thoroughly commented, and should be
  1089. self-explaining.
  1090. This profile uses the virtual screen package {\tt virtual.gwm} (see
  1091. section~\ref{virtual}). You can move around on the virtual screen by
  1092. clicking in the map, in the ``doors'', on the pan lists in the edges
  1093. of the screen, or by the arrows together with some suitable modifiers
  1094. ({\sc Alt} is default). 
  1095. The profile also provides one or multiple icon managers, optionally
  1096. together with normal icons. See the examples in {\tt vtwmrc.gwm} to
  1097. see how multiple icon managers are set up. (These icon managers can be
  1098. used in other profiles as well, by loading the file {\tt
  1099. load-icon-mgr.gwm}. Look in this file for details.)
  1100. The VTWM profile honors the use of the standard functions {\tt
  1101. set-window}, {\tt set-icon}, {\tt set-icon-window}, {\tt
  1102. set-placement} and {\tt set-icon-placement}. (However, if you use some
  1103. other window than {\tt wtwm-window}, you should consider setting the
  1104. variable {\tt icon-mgr-window-feedback} to {\tt nil} since this other
  1105. windows does not tell the icon manager when it gets the input
  1106. focus.) 
  1107. \subsection{The fast profile\hfill{\tt fast.gwm}}
  1108. \label{fast}
  1109. This is a minimal profile, without any window titles, comparable to the
  1110. obsolete window manager {\bf uwm}. Useful for quickly restarting a simple
  1111. window manager while debugging, or for just browsing the code as an example.
  1112. \section{Troubleshooting}
  1113. To debug a {\WOOL} program, you can:
  1114. \begin{itemize}
  1115. \item use the \verb"trace" function to trace code execution or evaluate an
  1116. expression at each expression evaluation.
  1117. \item read, execute, and print {\WOOL} code by selecting it and using
  1118. the {\bf Exec cut} (for execute cut buffer) menu function.
  1119. \item use the \verb"-s" command line option to synchronize X calls, if you want
  1120. to know where you issue a non-legal X call.
  1121. \item compile {\GWM} with the -DDEBUG compile option, which will turn on many
  1122. checks (stack overflow, malloc checks, etc \ldots ) in case you manage to make
  1123. {\GWM} crash.  
  1124. \item If gwm appears to freeze, it might be because of a bus
  1125. error. Running gwm under a debugger such as \verb|gdb| or \verb|dbx| to see
  1126. where it crashes.
  1127. \end{itemize}
  1128.