[Top][All Lists]

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

[STUMP] [PATCH] Added frame-windowlist command.

From: Ben Spencer
Subject: [STUMP] [PATCH] Added frame-windowlist command.
Date: Mon, 27 Apr 2009 10:34:49 +0100
User-agent: Mutt/1.5.18 (2008-05-17)

 tile-window.lisp |   13 +++++++++++++
 window.lisp      |   16 ++++++++++------
 2 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/tile-window.lisp b/tile-window.lisp
index 76aa43f..b95576a 100644
--- a/tile-window.lisp
+++ b/tile-window.lisp
@@ -432,3 +432,16 @@ frame. Possible values are:
                                          (floor (- (frame-height frame) height)
                                                 (window-height-inc window)))))
       (maximize-window window))))
+(defcommand frame-windowlist (&optional (fmt *window-format*)) (:rest)
+  "Allow the user to select a window from the list of windows in the current
+frame and focus the selected window.  The optional argument @var{fmt} can be
+specified to override the default window formatting."
+  (let* ((group (current-group))
+        (frame (tile-group-current-frame group)))
+    (if (null (frame-windows group frame))
+       (message "No Managed Windows")
+       (let ((window (select-window-from-menu (frame-sort-windows group frame) 
+         (if window
+             (group-focus-window group window)
+             (throw 'error :abort))))))
diff --git a/window.lisp b/window.lisp
index 4535c92..baf9ee6 100644
--- a/window.lisp
+++ b/window.lisp
@@ -826,6 +826,15 @@ needed."
   (dformat 3 "Kill client~%")
   (xlib:kill-client *display* (xlib:window-id window)))
+(defun select-window-from-menu (windows fmt)
+  "Allow the user to select a window from the list passed in @var{windows}.  
address@hidden argument specifies the window formatting used.  Returns the 
+  (second (select-from-menu (current-screen)
+                           (mapcar (lambda (w)
+                                     (list (format-expand *window-formatters* 
fmt w) w))
+                                   windows))))
 ;;; Window commands
 (defcommand delete-window (&optional (window (current-window))) ()
@@ -928,12 +937,7 @@ override the default window formatting."
   (if (null (group-windows (current-group)))
       (message "No Managed Windows")
       (let* ((group (current-group))
-             (window (second (select-from-menu
-                              (current-screen)
-                              (mapcar (lambda (w)
-                                        (list (format-expand 
*window-formatters* fmt w) w))
-                                      (sort-windows group))))))
+             (window (select-window-from-menu (sort-windows group) fmt)))
         (if window
             (group-focus-window group window)
             (throw 'error :abort)))))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]