[sawfish] added jump-or-exec
- From: Christopher Bratusek <chrisb src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [sawfish] added jump-or-exec
- Date: Fri, 15 Jan 2010 19:48:34 +0000 (UTC)
commit 30e904b30b12e46490ea616e003798f9c08c337c
Author: Christopher Roy Bratusek <chris nanolx org>
Date: Fri Jan 15 20:48:08 2010 +0100
added jump-or-exec
ChangeLog | 5 ++
lisp/sawfish/wm/commands/jump-or-exec.jl | 66 ++++++++++++++++++++++++++++++
man/news.texi | 9 ++++
3 files changed, 80 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4a969a8..178a416 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-01-15 Christopher Bratusek <zanghar freenet de>
+ * lisp/sawfish/wm/commands/jump-or-exec.jl: added a modified version of jump-or-exec,
+ which supports both matching against WM_NAME
+ and WM_CLASS
+
2010-01-12 Teika Kazura <teika lavabit com>
* lisp/sawfish/wm/state/maximize.jl
* man/news.texi
diff --git a/lisp/sawfish/wm/commands/jump-or-exec.jl b/lisp/sawfish/wm/commands/jump-or-exec.jl
new file mode 100644
index 0000000..995daf1
--- /dev/null
+++ b/lisp/sawfish/wm/commands/jump-or-exec.jl
@@ -0,0 +1,66 @@
+;;; jump-or-exec.jl --- flexible application shortcut keys (v0.2)
+
+;; Copyright (C) 2002 Damien Elmes <resolve repose cx>
+
+;; This file is part of sawfish.
+
+;; sawfish is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; sawfish is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with sawfish; see the file COPYING. If not, write to
+;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+
+;;; Description
+
+;; This function either focusses a given window, or starts
+;; the application instead.
+;;
+;; Examples:
+;;
+;; NOTE: the `t' tells jump-or-exec to match on WM_CLASS
+;; ( bind-keys global-keymap "W-F2"
+;; `( jump-or-exec "Gnome-run-dialog" "gnome-run-dialog" t ) )
+;;
+;; NOTE: a missing `t' or a `nil' (the later is required if making
+;; use of the `onfocused' arguement) tells jump-or-exec to
+;; match on WM_NAME
+;; ( bind-keys global-keymap "W-F10"
+;; `( jump-or-exec "Geany" "geany" nil ) )
+
+(define-structure sawfish.wm.commands.jump-or-exec
+
+ (export jump-or-exec)
+
+ (open rep
+ rep.system
+ rep.regexp
+ sawfish.wm.misc
+ sawfish.wm.windows
+ sawfish.wm.util.display-window)
+
+(define (jump-or-exec re prog #!optional class onfocused)
+ "jump to a window matched by re, or start program otherwise."
+ (catch 'return
+ (let ((wind (if class
+ (get-window-by-class-re re)
+ (get-window-by-name-re re))))
+ (if (functionp onfocused) ; check if already focused
+ (let ((curwin (input-focus)))
+ (if curwin
+ (if (string-match re (window-name curwin))
+ (progn
+ (funcall onfocused wind)
+ (throw 'return))))))
+ (if (windowp wind)
+ (display-window wind)
+ (if (functionp prog)
+ (funcall prog)
+ (system (concat prog "&"))))))))
diff --git a/man/news.texi b/man/news.texi
index 24fab59..2222972 100644
--- a/man/news.texi
+++ b/man/news.texi
@@ -23,6 +23,15 @@ window.
The functinon @code{maximize-discard} has existed, and now it's
exported.
+
+ item New command @code{jump-or-exec} [Christopher Bratusek]
+
+The thirdparty module jump-or-exec has been merged. It provides
+ code{jump-or-exec}, a command which may be used to focus a window,
+or if it does not exist, start the application. Unlike the original
+version this one also supports matching a window by it's WM_CLASS,
+which makes it more flexible for applications like musicplayer or
+browsers, which tend to change their WM_NAME relatively often.
@end itemize
@end itemize
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]