Sawfish
Line 10: Line 10:
 
This patch adds 2 features that work in tandem:
 
This patch adds 2 features that work in tandem:
   
1. display-wininfo displayes the workspace where the window (if the display-wininfo-show-workspace variable is not nil)
+
1. display-wininfo displays the workspace where the window (if the display-wininfo-show-workspace variable is not nil)
   
 
2. the option to indicate if one should switch to a different workspace when cycling windows (like when using Alt-Tab). This option is enabled only if cycle-switch-workspaces is nil.
 
2. the option to indicate if one should switch to a different workspace when cycling windows (like when using Alt-Tab). This option is enabled only if cycle-switch-workspaces is nil.

Revision as of 02:30, 23 July 2008

Browse all patches

Author

Daniel M German

Synopsis

This patch adds 2 features that work in tandem:

1. display-wininfo displays the workspace where the window (if the display-wininfo-show-workspace variable is not nil)

2. the option to indicate if one should switch to a different workspace when cycling windows (like when using Alt-Tab). This option is enabled only if cycle-switch-workspaces is nil.

I have checked and only x-cycle uses display-wininfo, so this patch should have no side effects.

Patch

Index: lisp/sawfish/wm/commands/x-cycle.jl
===================================================================
--- lisp/sawfish/wm/commands/x-cycle.jl	(revision 4225)
+++ lisp/sawfish/wm/commands/x-cycle.jl	(working copy)
@@ -122,6 +122,11 @@
   (defvar cycle-raise-windows t
     "Raise windows while they're temporarily selected during cycling.")
 
+  (defcustom cycle-switch-workspaces t
+    "Switch temporarily to the workspace where the window is (except for windows that really want focus)."
+    :group (focus cycle)
+    :type boolean)
+
   (defcustom cycle-keymap (make-keymap)
     "Keymap containing bindings active only during window cycling operations."
     :group bindings
@@ -193,21 +198,33 @@
 	  (setq win (forwards win (fluid x-cycle-current) count))
 	(setq win (car win)))
       (fluid-set x-cycle-current win)
-      (when (not (window-get win 'sticky))
-	(select-workspace (nearest-workspace-with-window
-			   win current-workspace)))
-      (move-viewport-to-window win)
-      (when (window-get win 'iconified)
-	(show-window win))
-      (when cycle-raise-windows
-	(fluid-set x-cycle-stacking (stacking-order))
-	(raise-window* win))
-      (when cycle-show-window-names
-	(cycle-display-message))
-      (when (window-really-wants-input-p win)
-	(set-input-focus win))
-      (allow-events 'sync-keyboard)))
 
+      (if cycle-switch-workspaces
+	  (progn
+	    (when (not (window-get win 'sticky))
+	      ;; switch workspace if we have to
+	      (select-workspace (nearest-workspace-with-window
+				 win current-workspace))
+	      
+	      )
+	    (move-viewport-to-window win)
+	    (when (window-get win 'iconified)
+	      (show-window win))
+	    (when cycle-raise-windows
+	      (fluid-set x-cycle-stacking (stacking-order))
+	      (raise-window* win))
+	    (when cycle-show-window-names
+	      (cycle-display-message))
+	    (when (window-really-wants-input-p win)
+	      (set-input-focus win))
+	    )
+	; otherwise show only the name
+	(cycle-display-message)
+       )  ; end of if
+      (allow-events 'sync-keyboard)
+      ) ; end of let
+    ) ; end of define
+      
   (define (cycle-begin windows step)
     "Cycle through all windows in order of recent selections."
     (let ((tail-command nil)
Index: lisp/sawfish/wm/util/display-wininfo.jl
===================================================================
--- lisp/sawfish/wm/util/display-wininfo.jl	(revision 4225)
+++ lisp/sawfish/wm/util/display-wininfo.jl	(working copy)
@@ -32,7 +32,9 @@
 	  sawfish.wm.images
 	  sawfish.wm.misc
 	  sawfish.wm.util.x
-	  sawfish.wm.windows)
+	  sawfish.wm.windows
+	  sawfish.wm.workspace
+	  )
 
 ;;; variables
 
@@ -42,6 +44,8 @@
 
   (defconst icon-size (32 . 32))
 
+  (defvar display-wininfo-show-workspace nil)
+
   ;; window currently displayed, or nil
   (define info-window nil)
 
@@ -79,8 +83,18 @@
   ;; Returns a list of strings describing window W in some way
   (define (window-info w)
     (list (concat (and (window-get w 'iconified) ?[)
-		  (window-name w)
-		  (and (window-get w 'iconified) ?]))))
+                  (window-name w)
+                  (and (window-get w 'iconified) ?])
+		  ; potentially include the workspace where the window is
+		  (if (and
+		       display-wininfo-show-workspace
+		       (not (window-in-workspace-p w current-workspace)))
+		      (concat " <" (number->string (car (window-workspaces w))) ">")
+		    ""
+		    )
+                  )
+          )
+    )
 
 ;;; entry point
 

Community's reasons for inclusion or rejection

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

  • Yes vote: yes., No vote: no. or Wtf vote: pondering. - no votes yet...