[Sawfish] Activate workspace if 'focus-windows-when-mapped set patch

[ Thread Index | Date Index | More lists.tuxfamily.org/sawfish Archives ]


Hi,

If i set focus-windows-when-mapped or 'focus-when-mapped (see
screen shots) and the new window appears on a other workspace (e.g. set
by windows-rules) as the current workspace the new window get the focus
but it don't select the workspace with the window. This patch also
select the workspace with the window if focus-windows-when-mapped or
'focus-when-mapped selectet.

I hope i am right. Comments welcome.

-- 
Regards,
Fuchur

GPG Fingerprint: CA3B 8204 5B3E 6D48 6D53  C116 E5BC 70D5 B8D7 B2B0
--- sawfish/lisp/sawfish/wm/focus.jl.orgi	2012-03-30 20:03:48.000000000 +0200
+++ sawfish/lisp/sawfish/wm/focus.jl	2012-03-30 20:05:55.000000000 +0200
@@ -299,11 +299,23 @@
   (define (focus-out-fun w) (focus-invoke-mode w 'focus-out))
   (define (focus-add-window w) (focus-invoke-mode w 'add-window))
 
+  (define (activate-workspace w)
+    (require 'sawfish.wm.state.transient)
+    (require 'sawfish.wm.workspace)
+    (unless (window-get w 'sticky)
+      (if (or focus-windows-when-mapped
+              (window-get w 'focus-when-mapped))
+          (when (not (eq (car (window-in-workspace-p w current-workspace))
+                         (car (window-workspaces w))))
+            (select-workspace (car (window-workspaces w)))
+            (set-input-focus w)))))
+
   (add-hook 'enter-notify-hook focus-enter-fun t)
   (add-hook 'leave-notify-hook focus-leave-fun t)
   (add-hook 'focus-in-hook focus-in-fun t)
   (add-hook 'focus-out-hook focus-out-fun t)
   (add-hook 'map-notify-hook focus-add-window)
+  (add-hook 'after-add-window-hook activate-workspace)
 
   (call-after-state-changed
    '(never-focus)

Attachment: Bildschirmfoto-Fenster-Regel-Eigenschaften-1.png
Description: PNG image

Attachment: Bildschirmfoto-Fenster-Regel-Eigenschaften.png
Description: PNG image

Attachment: Bildschirmfoto-Sawfish-Einstellungen.png
Description: PNG image

Attachment: signature.asc
Description: PGP signature



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/