Add {r,}cycleingroup to cycle through clients belonging to the same

group as the active client (as opposed to all unhidden clients); from
Alexander Polakov, with a tiny tweak requested by oga.

ok oga@
This commit is contained in:
okan 2011-09-03 09:20:58 +00:00
parent b51f8e6a99
commit 142a36a0c0
4 changed files with 15 additions and 7 deletions

View File

@ -68,8 +68,9 @@
#define CWM_EXEC_WM 0x0002 #define CWM_EXEC_WM 0x0002
/* cycle */ /* cycle */
#define CWM_CYCLE 0 #define CWM_CYCLE 0x0001
#define CWM_RCYCLE 1 #define CWM_RCYCLE 0x0002
#define CWM_INGROUP 0x0004
#define KBTOGROUP(X) ((X) - 1) #define KBTOGROUP(X) ((X) - 1)

View File

@ -567,7 +567,7 @@ match:
} }
void void
client_cycle(struct screen_ctx *sc, int reverse) client_cycle(struct screen_ctx *sc, int flags)
{ {
struct client_ctx *oldcc, *newcc; struct client_ctx *oldcc, *newcc;
int again = 1; int again = 1;
@ -579,18 +579,19 @@ client_cycle(struct screen_ctx *sc, int reverse)
return; return;
if (oldcc == NULL) if (oldcc == NULL)
oldcc = (reverse ? TAILQ_LAST(&sc->mruq, cycle_entry_q) : oldcc = (flags & CWM_RCYCLE ? TAILQ_LAST(&sc->mruq, cycle_entry_q) :
TAILQ_FIRST(&sc->mruq)); TAILQ_FIRST(&sc->mruq));
newcc = oldcc; newcc = oldcc;
while (again) { while (again) {
again = 0; again = 0;
newcc = (reverse ? client_mruprev(newcc) : newcc = (flags & CWM_RCYCLE ? client_mruprev(newcc) :
client_mrunext(newcc)); client_mrunext(newcc));
/* Only cycle visible and non-ignored windows. */ /* Only cycle visible and non-ignored windows. */
if (newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE)) if ((newcc->flags & (CLIENT_HIDDEN|CLIENT_IGNORE))
|| ((flags & CWM_INGROUP) && (newcc->group != oldcc->group)))
again = 1; again = 1;
/* Is oldcc the only non-hidden window? */ /* Is oldcc the only non-hidden window? */

2
conf.c
View File

@ -359,6 +359,8 @@ static struct {
{ "nogroup", kbfunc_client_nogroup, 0, {0} }, { "nogroup", kbfunc_client_nogroup, 0, {0} },
{ "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} }, { "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} },
{ "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} }, { "rcyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_RCYCLE} },
{ "cycleingroup", kbfunc_client_cycle, KBFLAG_NEEDCLIENT, {.i = CWM_CYCLE|CWM_INGROUP} },
{ "rcycleingroup", kbfunc_client_cycle, KBFLAG_NEEDCLIENT, {.i = CWM_RCYCLE|CWM_INGROUP} },
{ "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, {0}}, { "grouptoggle", kbfunc_client_grouptoggle, KBFLAG_NEEDCLIENT, {0}},
{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} }, { "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} },
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} }, { "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },

View File

@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\" .\"
.Dd $Mdocdate: June 24 2011 $ .Dd $Mdocdate: June 25 2011 $
.Dt CWMRC 5 .Dt CWMRC 5
.Os .Os
.Sh NAME .Sh NAME
@ -289,6 +289,10 @@ Reverse cycle through groups.
Forward cycle through windows. Forward cycle through windows.
.It rcycle .It rcycle
Reverse cycle through windows. Reverse cycle through windows.
.It cycleingroup
Forward cycle through windows in current group.
.It rcycleingroup
Reverse cycle through windows in current group.
.It snapdist .It snapdist
Minimum distance to snap-to adjacent edge. Minimum distance to snap-to adjacent edge.
.It delete .It delete