Wikia

Sawfish

Cycle-groups (only cycle to the top windows of each group)

773pages on
this wiki
Talk0
Browse all patches

Author Edit

Fernando Carmona Varo

Synopsis Edit

This patch adds a new command to cycle to different groups, which is useful if combined with "cycle-group" (cycles to windows of the same group). Also, the flexibility of sawfish groups (by means of window-matching) can be an advantage when using this command.


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

diff --git a/lisp/sawfish/wm/autoload.jl b/lisp/sawfish/wm/autoload.jl
index 92883b7..36786a7 100644
--- a/lisp/sawfish/wm/autoload.jl
+++ b/lisp/sawfish/wm/autoload.jl
@@ -121,6 +121,8 @@
 (autoload-command 'cycle-windows-backwards 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-group 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-group-backwards 'sawfish.wm.commands.x-cycle)
+(autoload-command 'cycle-among-groups 'sawfish.wm.commands.x-cycle)
+(autoload-command 'cycle-among-groups-backwards 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-prefix 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-prefix-backwards 'sawfish.wm.commands.x-cycle)
 (autoload-command 'cycle-class 'sawfish.wm.commands.x-cycle)
diff --git a/lisp/sawfish/wm/commands/x-cycle.jl b/lisp/sawfish/wm/commands/x-cycle.jl
index 8faa5b3..bc72ce3 100644
--- a/lisp/sawfish/wm/commands/x-cycle.jl
+++ b/lisp/sawfish/wm/commands/x-cycle.jl
@@ -348,6 +348,14 @@ Any extra arguments are passed to each call to define-command."
    #:spec "%W")
 
   (define-cycle-command-pair
+   'cycle-among-groups 'cycle-among-groups-backwards
+   (lambda ()
+     "Only cycle the top members of each group."
+     (delete-if-not window-in-cycle-p
+                    (mapcar (lambda (gid) (car (windows-by-group gid t)))
+                            (window-group-ids)))))
+
+  (define-cycle-command-pair
    'cycle-prefix 'cycle-prefix-backwards
    (lambda (w)
      (when (string-match "^([^:]+)\\s*:" (window-name w))
@@ -388,6 +396,8 @@ Any extra arguments are passed to each call to define-command."
 ###autoload (autoload-command 'cycle-windows-backwards 'sawfish.wm.commands.x-cycle)
 ###autoload (autoload-command 'cycle-group 'sawfish.wm.commands.x-cycle)
 ###autoload (autoload-command 'cycle-group-backwards 'sawfish.wm.commands.x-cycle)
+###autoload (autoload-command 'cycle-among-groups 'sawfish.wm.commands.x-cycle)
+###autoload (autoload-command 'cycle-among-groups-backwards 'sawfish.wm.commands.x-cycle)
 ###autoload (autoload-command 'cycle-prefix 'sawfish.wm.commands.x-cycle)
 ###autoload (autoload-command 'cycle-prefix-backwards 'sawfish.wm.commands.x-cycle)
 ###autoload (autoload-command 'cycle-class 'sawfish.wm.commands.x-cycle)
@@ -415,6 +425,14 @@ Cycle through all windows in the same group as the current window.
 Reverse cycle through all windows in the same group as the current window.
 ::end::
 
+::doc:sawfish.wm.commands.x-cycle#cycle-among-groups::
+Cycle through different groups (only the top window of each group).
+::end::
+
+::doc:sawfish.wm.commands.x-cycle#cycle-among-groups-backwards::
+Reverse cycle through different groups (only the top window of each group).
+::end::
+
 ::doc:sawfish.wm.commands.x-cycle#cycle-prefix::
 Cycle through all windows whose names match the leading colon-delimited
 prefix of the current window.

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. I think that this adds a new useful way for switching windows that resembles (key-wise) the behavior of tabs without the need of window overlapping. --Ferk(talk!) 01:54, 3 March 2009 (UTC)

I updated to revision 4428 and now the patch no longer displays "cycle-groups" command in the command list... any idea why? maybe it's not because of the update, but I don't know the reason. --Ferk(talk!) 02:43, 3 March 2009 (UTC)
I just tried it out, and it's showing up here. Flashrider [Christopher Bratusek] 09:13, 3 March 2009 (UTC)
Fixed (I forgot to add an entry to autoload.jl). I think that the patch is now safe to commit if it was desired. The only improvement that I'm missing is that the "top window" of each group is not really the one at the top, but the first one that was created. --Ferk(talk!) 17:13, 3 March 2009 (UTC)
Ok.. now it does cycle to the most-recently-used window of each (most-recently-used ordered) group (just needed to add a nifty switch). For me it's perfect now. --Ferk(talk!) 12:38, 4 March 2009 (UTC)
  • Yes vote: yes. Works, and very good idea, but user-doc is desired. - Teika kazura 04:58, 6 May 2009 (UTC)
    • I changed the name from 'cycle-groups(-backwards)' to 'cycle-among-groups(-...)', because they're confusing with 'cycle-group' which cycles inside the group. Fernando, the author, says the rename is good. (See here)
      I also made one minor change. Mysterious '1' is changed to 't'. (Any non-nil is the same.)
    • As a user doc, I propose the following for news item, but I'd like to here Fernando & others' words, since I'm not familiar with window group notion. Why don't we wait for a while?
        New commands cycle-among-groups and cycle-among-groups-backwards are added.
        They work nicely when combined with cycle-group, which only cycle inside the group.
        For example, if the focus is on Emacs window, cycle-group chooses only other emacs windows,
        and cycle-among-groups goes among windows *other than* emacs.

Yes vote: yes. commited. needs doc-update though Flashrider [Christopher Bratusek] 17:44, 7 May 2009 (UTC)

Around Wikia's network

Random Wiki