Wikia

Sawfish

Warp-if-necessary when unmaximizing

773pages on
this wiki
Talk0
Browse all patches

Author Edit

Fernando Carmona Varo

Synopsis Edit

This is a very simple patch but maybe a bit hard to make a decision about it too, since it's related to focus management and maybe changing the behavior could disturb someone accustomed to it.

It has not been much time since I started using the focus enter-only mode. And I've found it is a quite nice way to work. I like the fact that the mouse follows the focus when I change windows to prevent focus loss. However, sometimes when you unmaximize a window the focus is lost. If you were previously working on the maximized window you often won't be able to know where the focus will end up.. I think this is kind of uncomfortable.

I've added a "warp-if-necessary" at the end of the unmaximizing function. This will warp the mouse if it is out of the window and the "warp-to-window-enabled" option is enabled. However, I'm thinking that maybe some people accustomed to unmaximizing using the mouse might find uncomfortable to have the mouse warped when they click the maximized button, and yet they maybe still want enter-only focus and warping in the other cases. So, I'm thinking of maybe set a condition for the warping and only perform the action if the last-event was not a "Click" (by means of... (unless(string-match "Click" (event-name(last-event))) ...) However, as I normally maximize/unmaximize using the keyboard, I'm not sure if it would really be uncomfortable for such persons. So I'll just put here the patch and wait for your comments.

In the worst case, this could be easily made a script too, since there's a handy hook in there.

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/state/maximize.jl
===================================================================
--- lisp/sawfish/wm/state/maximize.jl	(revision 4269)
+++ lisp/sawfish/wm/state/maximize.jl	(working copy)
@@ -63,7 +63,8 @@
 	  sawfish.wm.util.display-window
 	  sawfish.wm.util.stacking
 	  sawfish.wm.frames
-	  sawfish.wm.misc)
+	  sawfish.wm.misc
+	  sawfish.wm.focus)
 
   (define-structure-alias maximize sawfish.wm.state.maximize)
 
@@ -404,6 +405,7 @@
 		  (not (window-maximized-horizontally-p w))
 		  (not (window-maximized-fullscreen-p w)))
 	 (discard-unmaximized-geometry w))))
+    (warp-pointer-if-necessary w)
     (call-window-hook 'window-unmaximized-hook w (list direction))
     (call-window-hook 'window-state-change-hook w (list '(maximized))))
 

Community's reasons for inclusion or rejection Edit

Patch submitters, please vote also! Yes, obviosuly 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.. This is very usefull if you want to keep the focus on unmaximize. Furthermore warp-to-window-enabled is disabled by default. So it shouldn't "disturb" many people. Flashrider [Christopher Bratusek] 06:11, 12 August 2008 (UTC)
  • Yes vote: yes. a very nice patch. I missed this functionality for a long time as sometimes I don't know where is my focus after I unmaximize. One question though - is there any way in sawfish-ui to (setq warp-to-window-enabled t) ? I had to do this in sawfish-client Janek Kozicki 14:35, 28 August 2008 (UTC)
  • Try vote: let's try in experimental. I'm running it currently, I think that it can go to experimental. Added this patch to experimental branch. Janek Kozicki 16:24, 17 September 2008 (UTC)
  • Wtf vote: pondering. After using those two patches for some longer time I discovered that actually personally I want to have "Warp-if-necessary when unmaximizing" enabled but "Warp-if-necessary when cycling" disabled and also I want warping when uniconifying (!) disabled. That means yet more options in the GUI... Currently I have it enabled and warping mouse when cycling and uniconifying is mildly annoying for me :) In fact I want this enabled ONLY when I unmaximize :) I hope that Chris' patch will help a lot with cluttered GUI, as we will end up adding more and more options here. Janek Kozicki 21:11, 30 September 2008 (UTC)
I think adding more options is not a way to solve the problem, and IMHO, warping pointer is an ugly hack. I'm using a modified stop-focus mode (don't recall how different to the one I've posted on the mailing list) and minus a corner case when killing windows (where the damn desktop get focused), I cover all the points raised on the AHWM Sloppy Focus page.--Aav 07:16, 1 October 2008 (UTC)
  • Yes vote: yes. This patch is an improvement, because if you change the this of a windows via keyboard, another window might get focussed (and raised, too), using this here, there's one case less for that. And why don't you want the cursor beeing warped to an uniconified window? Don't you work in it, when uniconifying? Either way, that is an additional task. commited rev4336 Flashrider [Christopher Bratusek] 09:20, 27 December 2008 (UTC)

Around Wikia's network

Random Wiki