[sawfish/sawfish-2.90] improved previous commit on jump-or-exec



commit 4e1f96c3d373be308df62133e46bfd5b3f0f28ab
Author: Christopher Roy Bratusek <zanghar freenet de>
Date:   Mon Oct 25 22:45:26 2010 +0200

    improved previous commit on jump-or-exec

 ChangeLog                                |    3 ++-
 lisp/sawfish/wm/commands/jump-or-exec.jl |   21 +++++++++------------
 2 files changed, 11 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dbabb06..baad327 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,7 +7,8 @@
 	* lisp/sawfish/wm/edge/flip.jl
 	* lisp/sawfish/wm/edge/hot-spots.jl
 	* lisp/sawfish/wm/edge/infinite-desktop.jl: don't auto-enable infinit-desktop by just loading the module
-	                                            export hook-functions
+	                                            export hook-functions and also check on window-class before
+						    calling `onfocused' function
 
 2010-10-24  Christopher Bratusek <zanghar freenet de>
 	* src/flippers.c: add recreate-flippers function
diff --git a/lisp/sawfish/wm/commands/jump-or-exec.jl b/lisp/sawfish/wm/commands/jump-or-exec.jl
index f7df49c..43b5506 100644
--- a/lisp/sawfish/wm/commands/jump-or-exec.jl
+++ b/lisp/sawfish/wm/commands/jump-or-exec.jl
@@ -46,20 +46,21 @@
 ;; => application dolphin matched on it's WM_NAME 
 ;;  => will be iconified when key pressed while it's focused
 ;;  ( bind-keys global-keymap "Home" 
-;;    `( jump-or-exec "Dolphin" "dolphin ~" #:iconify-on-leave t ) 
+;;    `( jump-or-exec "Dolphin" "dolphin ~" #:onfocused jump-or-exec-leave ) 
 ;;
 ;; => application konsole matched on it's WM_CLASS
 ;;  => will be iconified when key pressed while it's focused
 ;;  => will also be iconified when the cursor leaves it
 ;;  ( bind-keys global-keymap "F12"
-;;    `( jump-or-exec "Konsole" "konsole" #:match-class t #:iconify-on-leave t ) 
+;;    `( jump-or-exec "Konsole" "konsole" #:match-class t #:onfocused jump-or-exec-leave ) 
 ;;
 ;;  ( add-window-matcher '( ( WM_CLASS . "^Konsole/konsole$" ) )
 ;;    '( ( iconify-on-leave .t ) ) )
 
 (define-structure sawfish.wm.commands.jump-or-exec
 
-    (export jump-or-exec)
+    (export jump-or-exec
+	    jump-or-exec-leave)
 
     (open rep
           rep.system
@@ -71,20 +72,12 @@
 	  sawfish.wm.util.display-window
 	  sawfish.wm.commands)
 
-  (define (jump-or-exec re prog #!key match-class onfocused iconify-on-leave)
+  (define (jump-or-exec re prog #!key match-class onfocused)
     "jump to a window matched by re, or start program otherwise."
     (catch 'return
       (let ((wind (if match-class
                     (get-window-by-class-re re)
                     (get-window-by-name-re re))))
-	(if iconify-on-leave
-	  (let ((curwin (input-focus)))
-	    (if (or (string-match re (window-class curwin))
-	            (string-match re (window-name curwin)))
-	        (progn
-		  (let ((default-window-animator 'none))
-		    (iconify-window (input-focus))
-		    (throw 'return))))))
         (if (functionp onfocused) ; check if already focused
             (let ((curwin (input-focus)))
               (if curwin
@@ -102,6 +95,10 @@
 
   (define-command 'jump-or-exec jump-or-exec #:class 'default)
 
+  (define (jump-or-exec-leave)
+    (let ((default-window-animator 'none))
+      (iconify-window (input-focus))))
+
   (define (jump-or-exec-hook)
     (if (and (not (eq (current-event-window) 'root)) ;; may error on startup else
 	     (window-get (current-event-window) 'iconify-on-leave))



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