[sawfish] toggle-or-exec cleanup:
- From: Christopher Bratusek <chrisb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sawfish] toggle-or-exec cleanup:
- Date: Tue, 1 Mar 2011 13:10:14 +0000 (UTC)
commit fbfdddd7aba57e781c691ceea2e8b50d46815af2
Author: Teika kazura <teika lavabit com>
Date: Tue Mar 1 13:13:22 2011 +0900
toggle-or-exec cleanup:
- jump-or-exec-leave is deleted, and toggle-or-exec instead uses iconify-window.
- Instead, iconify-on-leave-fun, a hook function, is re-implemented in wm/state/iconify.jl.
- Minor improvements in related doc.
lisp/sawfish/wm/commands/jump-or-exec.jl | 37 +------------------------
lisp/sawfish/wm/state/iconify.jl | 10 ++++++-
man/sawfish.texi | 45 +++++++++++++++++++----------
3 files changed, 39 insertions(+), 53 deletions(-)
---
diff --git a/lisp/sawfish/wm/commands/jump-or-exec.jl b/lisp/sawfish/wm/commands/jump-or-exec.jl
index 9f039b6..088f44f 100644
--- a/lisp/sawfish/wm/commands/jump-or-exec.jl
+++ b/lisp/sawfish/wm/commands/jump-or-exec.jl
@@ -25,32 +25,10 @@
;; Provides key bindings to focus a given window, or starts the
;; application if absent.
;;
-;; toggle-or-exec was merged into jump-or-exec. It's basically
-;; the same, but it turns windows into drop-down-terminal like ones, that means
-;; then you press the key while on the corresponding window, it will be hidden.
-;; Optionally you may add a window-matcher, wich will also hide the window when
-;; you leave it (not done by default).
-;;
-;; Examples:
-;;
-;; => application dolphin matched on it's WM_NAME
-;; => will be iconified when key pressed while it's focused
-;; ( bind-keys global-keymap "Home"
-;; `( toggle-or-exec "Dolphin" "dolphin ~" )
-;;
-;; => 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"
-;; `( toggle-or-exec "Konsole" "konsole" #:match-class t )
-;;
-;; ( add-window-matcher '( ( WM_CLASS . "^Konsole/konsole$" ) )
-;; '( ( iconify-on-leave .t ) ) )
(define-structure sawfish.wm.commands.jump-or-exec
(export jump-or-exec
- jump-or-exec-leave
toggle-or-exec)
(open rep
@@ -58,7 +36,6 @@
rep.regexp
sawfish.wm.misc
sawfish.wm.windows
- sawfish.wm.events
sawfish.wm.state.iconify
sawfish.wm.util.display-window
sawfish.wm.commands)
@@ -90,19 +67,7 @@
(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 (toggle-or-exec regex prog #!key match-class)
(jump-or-exec regex prog
#:match-class match-class
- #:onfocused jump-or-exec-leave))
-
- (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))
- (let ((default-window-animator 'none)) ;; no animator
- (iconify-window (current-event-window)))))
-
- (add-hook 'leave-notify-hook jump-or-exec-hook))
+ #:onfocused iconify-window)))
diff --git a/lisp/sawfish/wm/state/iconify.jl b/lisp/sawfish/wm/state/iconify.jl
index 823c35c..768c7ce 100644
--- a/lisp/sawfish/wm/state/iconify.jl
+++ b/lisp/sawfish/wm/state/iconify.jl
@@ -269,4 +269,12 @@ all workspaces and viewports."
(add-hook 'map-notify-hook ws-set-client-state t)
(call-after-state-changed '(iconified) ws-set-client-state)
- (add-window-menu-toggle (_ "_Sticky") 'toggle-window-sticky window-sticky-p))
+ (add-window-menu-toggle (_ "_Sticky") 'toggle-window-sticky window-sticky-p)
+
+ (define (iconify-on-leave-fun w mode)
+ (when (and (eq mode 'normal)
+ (windowp w)
+ (window-get w 'iconify-on-leave))
+ (iconify-window w)))
+
+ (add-hook 'leave-notify-hook iconify-on-leave-fun))
diff --git a/man/sawfish.texi b/man/sawfish.texi
index 6f5e6d5..42ea5dd 100644
--- a/man/sawfish.texi
+++ b/man/sawfish.texi
@@ -2917,6 +2917,16 @@ Return an image object representing the icon currently associated with
Return the icon name associated with @var{window}.
@end defun
+When a window has a property @code{iconify-on-leave} set to non-nil,
+it gets iconified when the mouse pointer leaves it. It can be set
+from the configurator.
+
+ lisp
+;; Example:
+;; ( add-window-matcher '( ( WM_CLASS . "^Konsole/konsole$" ) )
+;; '( ( iconify-on-leave . t ) ) )
+ end lisp
+
@node Window Stickiness, Ignored Windows, Iconifying Windows, Windows
@section Window Stickiness
@cindex Window stickiness
@@ -7276,8 +7286,8 @@ See also @xref{Applications Menu}, which is a popup to execute applications.
@node Application Invocation, Common Applications,, External Applications
@section Application Invocation
-See also the function @code{system} which invokes a command from a shell.
-(@pxref{Shell Commands,,, librep, The Librep Manual})
+See also the lisp function @code{system} which invokes a command from
+a shell. (@pxref{Shell Commands,,, librep, The Librep Manual})
@defun jump-or-exec regex prog #!key match-class onfocused
Jump to a window, or if it doesn't exist, start a program. Main use of
@@ -7309,35 +7319,35 @@ argument. This can't be a string.
;; Jump to a window with the class "Gnome-run-dialog".
(bind-keys global-keymap "W-F2"
- '(jump-or-exec "Gnome-run-dialog" "gnome-run-dialog" #:match-class t ))
+ '(jump-or-exec "Gnome-run-dialog" "/usr/local/bin/gnome-run-dialog" #:match-class t ))
@end lisp
@end defun
@defun toggle-or-exec regex prog #!key match-class
-This function is a wrapper around @code{jump-or-exec}, which turns windows into
-quake-like "toggle-windows". That means, if the matching window is focussed, it
-will be iconified (without animation). Else it works in the same way.
+This function adds to @code{jump-or-exec} by turning a window to
+``quake''-like "toggle-windows". That means, if this function is invoked
+on a matching window, that window will be iconified. Else it works in
+the same way as @code{jump-or-exec}.
-There is also a companion window-matcher, @code{iconify-on-leave}. That way the
-window will also be iconified, when the pointer leaves it.
+You may also want to use a window property
+ code{iconify-on-leave} (@pxref{Iconifying Windows}.)
@lisp
;; Examples:
-;; => application dolphin matched on it's WM_NAME
-;; => will be iconified when key pressed while it's focused
+;; Application "dolphin", matched by its name (i.e. WM_NAME.)
+;; Press "Home" key, and
+;; * if no instance of dolphin is running, it's invoked.
+;; * if one is there, the focus jumps to it.
+;; * if it's already focused, it will be iconified.
+;;
;; ( bind-keys global-keymap "Home"
;; `( toggle-or-exec "Dolphin" "dolphin ~" )
-;; => 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
+;; "konsole", matched by its window-class (= WM_CLASS).
;; ( bind-keys global-keymap "F12"
;; `( toggle-or-exec "Konsole" "konsole" #:match-class t )
-;;
-;; ( add-window-matcher '( ( WM_CLASS . "^Konsole/konsole$" ) )
-;; '( ( iconify-on-leave .t ) ) )
@end lisp
@end defun
@@ -7848,6 +7858,9 @@ Has the window been placed in a position yet? The
@item iconified
Is the window iconified? @xref{Iconifying Windows}.
+ item iconify-on-leave
+Iconify this window then the mouse pointer leaves. @xref{Iconifying Windows}.
+
@item gravity
When set, overrides the window gravity field of the window's size
hints. May be one of the symbols: @code{north-west}, @code{north},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]