Sawfish
Browse all patches

Author[]

Teika kazura

Synopsis[]

This patch adds a new hook `cycle-hook' which is called each time you cycle windows. The timing corresponds to the release of tab key in Windows.

I have updated the patch recently. Formerly it was a plain hook, but it is now a window hook. The manual is written too.

Patch testing[]

  1. Copy/paste the patch listed below into some file, eg. TEST.diff.
  2. If you don't have sawfish sources yet, have one, as described get it from GIT repo.
  3. Go into the directory where sawfish sources reside, eg. cd sawfish
  4. Test if the patch applies cleanly with this command:
    patch -p1 --ignore-whitespace --dry-run < TEST.diff
    in case of problems try also: -p0 or -p2
  5. If it applies cleanly, then remove the --dry-run from above command and run it again, otherwise ask on the mailing list.
  6. Compile sawfish: ./autogen.sh && make
  7. Install it for testing, but it depends on your linux distribution.
    1. It is always better to install sawfish as your distribution package, but it is different for each distribution.
    2. So you may try make install, which will install sawifish in /usr/local/share/sawfish/ (if you have write access). But then make sure that you run the correct version and delete it from that directory afterwards, to avoid any conflicts.
  8. Se also

PS: edit this template if you feel that those instructions can be improved.

Patch[]

Index: lisp/sawfish/wm/commands/x-cycle.jl
===================================================================
--- lisp/sawfish/wm/commands/x-cycle.jl	(revision 7)
+++ lisp/sawfish/wm/commands/x-cycle.jl	(working copy)
@@ -127,6 +127,8 @@
     :group bindings
     :type keymap)
 
+  (defvar cycle-hook '()
+    "Window hook called after each step of window cycling.")
 ;; variables
 
@@ -206,7 +208,9 @@
 	(cycle-display-message))
       (when (window-really-wants-input-p win)
 	(set-input-focus win))
-      (allow-events 'sync-keyboard)))
+      (allow-events 'sync-keyboard)
+      (call-window-hook 'cycle-hook win))
+    )
 
   (define (cycle-begin windows step)
     "Cycle through all windows in order of recent selections."
Index: man/sawmill.texi
===================================================================
--- man/sawmill.texi	(revision 7)
+++ man/sawmill.texi	(working copy)
@@ -5561,6 +5561,7 @@
 * Window Destruction Hooks::
 * Window Mapping Hooks::
 * Window Motion Hooks::
+* Window Cycling Hooks::
 * X Hooks::
 * Pointer Motion Hooks::
 * Workspace Hooks::
@@ -5682,7 +5683,7 @@
 @end defvr
 
 
-@node Window Motion Hooks, X Hooks, Window Mapping Hooks, Standard Hooks
+@node Window Motion Hooks, Window Cycling Hooks, Window Mapping Hooks, Standard Hooks
 @section Window Motion Hooks
 @cindex Window Motion Hooks
 @cindex Hooks, Window Motion
@@ -5733,8 +5734,16 @@
 @code{x-lower-window}.  The hook functions take no arguments.
 @end defvr
 
+@node Window Cycling Hooks, X Hooks, Window Motion Hooks, Standard Hooks
+@section Window Cycling Hooks
+@cindex Window Cycling Hooks
+@cindex Hooks, Window Cycling
 
-@node X Hooks, Pointer Motion Hooks, Window Motion Hooks, Standard Hooks
+@defvr {Window Hook} cycle-hook
+Called after each step of window cycling. (See @ref{Cycling Between Windows}.)
+@end defvr
+
+@node X Hooks, Pointer Motion Hooks, Window Cycling Hooks, Standard Hooks
 @section X Hooks
 @cindex X Hooks
 @cindex Hooks, X

Community's reasons for inclusion or rejection[]

When voting anonymously please write your name, so that it can be associated with your posts on the mailing list. If you are logged in you can sign yourself by typing four tilda characters: ~~~~.

  • Use one of Yes vote: yes., No vote: no. or Wtf vote: pondering..
  • Yes vote: yes. Author's vote. Because it is a hook, it has no side effect. No reason to turn it away. - Teika kazura 04:42, 19 July 2008 (UTC)
  • Yes vote: yes. I think this is nice to have, improving extensibility. -Ferk(talk!) 02:32, 21 July 2008 (UTC)
  • Wtf vote: pondering. a name like after-cycle-step-hook would be better (it is more explicit and allows future hooks in cycling without collisions). Then yes. GSR 21:28, 4 August 2008 (UTC)

Commited as after-cycle-step-hook (svn r4263). Source file has ^L in patch range, so it whined and the jl part was done by hand. GSR 01:04, 6 August 2008 (UTC)