Wikia

Sawfish

Slide-window-hook

773pages on
this wiki
Talk0
Browse all patches

Author Edit

Andrea Vettorello

Synopsis Edit

This patch adds a new hook `before-slide-hook' which is called every time a window is moved using the keyboard. The code is executed before the actual move. I need an hook like this to fix stop-focus.jl mode, in particular it's used to update the mouse pointer position when moving windows with the keyboard. I've updated the documentation accordingly.


Patch testing Edit

  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 Edit

Index: lisp/sawfish/wm/commands/slide-window.jl
===================================================================
--- lisp/sawfish/wm/commands/slide-window.jl	(revision 4311)
+++ lisp/sawfish/wm/commands/slide-window.jl	(working copy)
@@ -40,7 +40,11 @@
   (defvar slide-window-increment 16
     "Number of pixels to move window in `slide-' commands.")
 
+  (defvar before-slide-hook '()
+    "Window hook called before a window is moved with the keyboard.")
+
   (define (slide-window w right down)
+    (call-window-hook 'before-slide-hook w)
     (unless (window-get w 'fixed-position)
       (let ((coords (window-position w)))
 	(move-window-to w (+ (car coords) right) (+ (cdr coords) down)))))
Index: sawmill.texi
===================================================================
--- sawmill.texi	(revision 4311)
+++ sawmill.texi	(working copy)
@@ -4,9 +4,9 @@
 @footnotestyle end
 
 @set EDITION 0.13
-@set VERSION 1.3.4
-@set UPDATED 18 Nov 2008
-@set UPDATE-MONTH Nov 2008
+@set VERSION 1.3.5
+@set UPDATED 16 Dec 2008
+@set UPDATE-MONTH Dec 2008
 
 @ifinfo
 @direntry
@@ -5939,7 +5939,11 @@
 @code{right}, @code{left}, @code{bottom} and @code{top} for resizing.
 @end defvr
 
+@defvr {Window Hook} before-slide-hook
+Called before a window move when using key binding.
+@end defvr
 
+
 @defvr {Hook} after-restacking-hook
 Called after any window restacking operation, including (but possibly
 not limited to @code{restack-windows}, @code{x-raise-window} and

Community's reasons for inclusion or rejection Edit

Patch submitters, please vote also! Yes, obviously your vote will be positive, but it's the place to give your explanation why this patch is good for all Sawfish users, and why it is correct - good reasons for inclusion.

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: ~~~~.

  • Please vote with: Yes vote: yes., No vote: no., Try vote: let's try in experimental., Wtf vote: pondering. or Suspend wait for next release.

Yes vote: yes. Patch is harmless, or at least I'm using it extensively by various months without noticing side effects. - Aav 13:58, 16 December 2008 (UTC)

  • Yes vote: yes. Generally yes. ... might this also be used to bring that script here: Center-mouse-on-window-move ?
    • Probably yes. To fix the sloppy focus mode (enter-only, stop-focus) I've first considered Center-mouse-on-window-move when moving windows using keyboard, but it didn't worked. My mangled version of stop-focus doesn't need all the warp pointer hacks, I'll post it in the mailing-list if someone want to try it, but it needs this one liner patch to works.- Aav 17:21, 17 December 2008 (UTC)

Around Wikia's network

Random Wiki