Permalink
Browse files

Added frame-windowlist command.

  • Loading branch information...
1 parent f820eb4 commit e6d6062bd665f014e935a7f2e5b3b395858dd18f @dangerousben committed with sabetts Apr 27, 2009
Showing with 23 additions and 6 deletions.
  1. +13 −0 tile-window.lisp
  2. +10 −6 window.lisp
View
@@ -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) fmt)))
+ (if window
+ (group-focus-window group window)
+ (throw 'error :abort))))))
View
@@ -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}. The
+@var{fmt} argument specifies the window formatting used. Returns the window
+selected."
+ (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)))))

0 comments on commit e6d6062

Please sign in to comment.