Re: Updatind core .jl files



On Wed, Jul 23, 2008 at 7:43 PM, Daniel German <dmg uvic ca> wrote:
> Hi Andrea,
>
>> But what if the user has decided to not display wininfo?
>>
>
> I have updated the patch. If the user does not want to display wininfo and
> the user does not want to momentarily switch workspaces, and the window
> being switched to is in another workspace, then the wininfo is
> displayed  (I hope
> I made myself clear here).

I've slightly modified your patch cause cycling without win-info
raises windows but doesn't focus them.

Still I'm not completely satisfied with this change: selecting the
"Switch temporarily to the workspace where the window is"
(cycle-switch-workspaces) option alone on sawfish-ui has no effect
unless is coupled with "Include windows on all workspaces when
cycling." (cycle-all-workspaces).

>> Ok, but it doesn't work here (could I've messed something myself):
>> workspace name isn't displayed by display-wininfo, and if I disable
>> your cycle-switch-workspaces var it breaks cycle-show-window-names, as
>> it always shows windows info.
>>
>
> Mmm, I use the first value returned by (car (window-workspaces w)). Some windows
> have no such property (the root of Nautilus returns ()). In this case I don't
> display any workspace info. I don't name my workspaces, I only use their
> default numbers. Perhaps this is the problem?

Probably I should have played more attention to the couple of warnings
when I applied the patch yesterday...


-- 
Andrea
diff --git a/lisp/sawfish/wm/commands/x-cycle.jl b/lisp/sawfish/wm/commands/x-cycle.jl
index 8792721..289382d 100644
--- a/lisp/sawfish/wm/commands/x-cycle.jl
+++ b/lisp/sawfish/wm/commands/x-cycle.jl
@@ -122,6 +122,14 @@
   (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 +201,46 @@
 	  (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)))
 
+      ;; weird combinations of variables might mean that sometimes
+      ;; we display window names, and we sometimes do not.
+      ;; so clean up before the next window is cycled
+      (remove-message)
+      (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
+	(progn 
+	  ; when raise windows and window in workspace
+	  ; raise it
+	  (when (and cycle-raise-windows
+              (window-in-workspace-p win current-workspace))
+	      (fluid-set x-cycle-stacking (stacking-order))
+	      (raise-window* win))
+
+	  ; display message if
+	  ; wanted or window is in another workspace
+	  ; as there would be no other visual clue
+	  (when (or cycle-show-window-names
+		    (not (window-in-workspace-p win current-workspace)))
+	    (cycle-display-message))
+          (when (window-really-wants-input-p win)
+            (set-input-focus win))))
+        (allow-events 'sync-keyboard)))
+      
   (define (cycle-begin windows step)
     "Cycle through all windows in order of recent selections."
     (let ((tail-command nil)
diff --git a/lisp/sawfish/wm/util/display-wininfo.jl b/lisp/sawfish/wm/util/display-wininfo.jl
index ec80f53..c69a5df 100644
--- a/lisp/sawfish/wm/util/display-wininfo.jl
+++ b/lisp/sawfish/wm/util/display-wininfo.jl
@@ -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,9 +83,14 @@
   ;; 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
 
   ;; What must be shown?


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]