[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

13. Hooks

StumpWM exports a number of hooks you can use to add customizations; like hooks in Emacs, you add to a hook with the add-hook function. for example:

 
(stumpwm:add-hook 'stumpwm:*new-window-hook* 'my-new-window-custos)

adds your my-new-window-custos function to the list of functions called when a new window appears.

Macro: add-hook HOOK FN

Add function to the hook hook-variable. For example, to display a message whenever you switch frames:

 
(defun my-rad-fn (from-frame to-frame)
  (stumpwm:message "Mustard!"))

(stumpmwm:add-hook stumpwm:*focus-frame-hook* 'my-rad-fn)
Macro: remove-hook HOOK FN

Remove the specified function from the hook.

The following hooks are available:

Hook: *new-window-hook*

A hook called whenever a window is added to the window list. This includes a genuinely new window as well as bringing a withdrawn window back into the window list.

Hook: *destroy-window-hook*

A hook called whenever a window is destroyed or withdrawn.

Hook: *focus-window-hook*

A hook called when a window is given focus. It is called with 2 arguments: the current window and the last window (could be nil).

Hook: *place-window-hook*

A hook called whenever a window is placed by rule. Arguments are window group and frame

Hook: *start-hook*

A hook called when stumpwm starts.

Hook: *internal-loop-hook*

A hook called inside stumpwm's inner loop.

Hook: *focus-frame-hook*

A hook called when a frame is given focus. The hook functions are called with 2 arguments: the current frame and the last frame.

Hook: *new-frame-hook*

A hook called when a new frame is created. the hook is called with the frame as an argument.

Hook: *message-hook*

A hook called whenever stumpwm displays a message. The hook function is passed any number of arguments. Each argument is a line of text.

Hook: *top-level-error-hook*

Called when a top level error occurs. Note that this hook is run before the error is dealt with according to *top-level-error-action*.

Hook: *focus-group-hook*

A hook called whenever stumpwm switches groups. It is called with 2 arguments: the current group and the last group.

Hook: *key-press-hook*

A hook called whenever a key under *top-map* is pressed. It is called with 3 argument: the key, the (possibly incomplete) key sequence it is a part of, and command value bound to the key.

Hook: *root-click-hook*

A hook called whenever there is a mouse click on the root window. Called with 4 arguments, the screen containing the root window, the button clicked, and the x and y of the pointer.

Hook: *mode-line-click-hook*

Called whenever the mode-line is clicked. It is called with 4 arguments, the mode-line, the button clicked, and the x and y of the pointer.


[ < ] [ > ]   [ << ] [Plus haut] [ >> ]         [Top] [Table des matières] [Index] [ ? ]

Ce document a été généré par Eric Reinbold le 9 Octobre 2008 en utilisant texi2html 1.78.