[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[STUMP] [PATCH] Add g{next,prev}-with-window commands.
From: |
John Li |
Subject: |
[STUMP] [PATCH] Add g{next,prev}-with-window commands. |
Date: |
Tue, 5 Aug 2008 04:35:59 -0400 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
---
I find these two commands useful. Having gnext, gprev,
gnext-with-window, and gprev-with-window bound to the top-map makes
navigating stumpwm groups really nice and smooth (I use s-Left,Right
and s-C-Left,Right).
I took the liberty of adding these to the default groups-map. I think
it makes sense for them to be available by default.
NEWS | 2 ++
bindings.lisp | 2 ++
group.lisp | 26 +++++++++++++++++++++++++-
stumpwm.texi.in | 12 ++++++++++++
4 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/NEWS b/NEWS
index 5192634..774ae15 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,8 @@ This file documents user visible changes between versions of
StumpWM
** added info command
+** added g{next,prev}-with-window commands
+
* Changes since 0.9.3
** new %interactivep% variable
see defcommand in the manual.
diff --git a/bindings.lisp b/bindings.lisp
index 0991011..65b02c1 100644
--- a/bindings.lisp
+++ b/bindings.lisp
@@ -157,8 +157,10 @@ (defvar *help-map* nil
(define-key m (kbd "C-n") "gnext")
(define-key m (kbd "SPC") "gnext")
(define-key m (kbd "C-SPC") "gnext")
+ (define-key m (kbd "N") "gnext-with-window")
(define-key m (kbd "p") "gprev")
(define-key m (kbd "C-p") "gprev")
+ (define-key m (kbd "P") "gprev-with-window")
(define-key m (kbd "o") "gother")
(define-key m (kbd "'") "gselect")
(define-key m (kbd "\"") "grouplist")
diff --git a/group.lisp b/group.lisp
index 7d488ef..a6a1d38 100644
--- a/group.lisp
+++ b/group.lisp
@@ -237,9 +237,21 @@ (defun find-group (screen name)
;; together.
(defun group-forward (current list)
+ "Switch to the next group in the list, if one exists. Returns the
+new group."
(let ((ng (next-group current list)))
(when ng
- (switch-to-group ng))))
+ (switch-to-group ng)
+ ng)))
+
+(defun group-forward-with-window (current list)
+ "Switch to the next group in the list, if one exists, and moves the
+current window of the current group to the new one."
+ (let ((next (group-forward current list))
+ (win (group-current-window current)))
+ (when (and next win)
+ (move-window-to-group win next)
+ (really-raise-window win))))
(defcommand gnew (name) ((:string "Group Name: "))
"Create a new group with the specified name. The new group becomes the
@@ -267,6 +279,18 @@ (defcommand gprev () ()
(group-forward (current-group)
(reverse (sort-groups (current-screen)))))
+(defcommand gnext-with-window () ()
+ "Cycle to the next group in the group list, taking the current
+window along."
+ (group-forward-with-window (current-group)
+ (sort-groups (current-screen))))
+
+(defcommand gprev-with-window () ()
+ "Cycle to the previous group in the group list, taking the current
+window along."
+ (group-forward-with-window (current-group)
+ (reverse (sort-groups (current-screen)))))
+
(defcommand gother () ()
"Go back to the last group."
(let ((groups (screen-groups (current-screen))))
diff --git a/stumpwm.texi.in b/stumpwm.texi.in
index e76304c..824ba43 100644
--- a/stumpwm.texi.in
+++ b/stumpwm.texi.in
@@ -491,6 +491,16 @@ Create a new group.
@itemx C-t g C-SPC
Go to the next group in the list.
address@hidden C-t g N
+Go to the next group in the list and bring the current window along.
+
address@hidden C-t g p
address@hidden C-t g C-p
+Go to the previous group in the list.
+
address@hidden C-t g P
+Go to the previous group in the list and bring the current window along.
+
@item C-t g '
Select a group by name or by number.
@@ -958,6 +968,8 @@ Groups in StumpWM are more commonly known as @dfn{virtual
desktops} or
!!! gnewbg
!!! gnext
!!! gprev
+!!! gnext-with-window
+!!! gprev-with-window
!!! gother
!!! gmerge
!!! groups
--
1.5.6.3
- [STUMP] [PATCH] Add g{next,prev}-with-window commands.,
John Li <=