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 f93ec1eba0
commit aa9dbd1dca
4 changed files with 19 additions and 11 deletions

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: calmwm.h,v 1.136 2011/09/03 09:17:16 okan Exp $
* $OpenBSD: calmwm.h,v 1.137 2011/09/03 09:20:58 okan Exp $
*/
#ifndef _CALMWM_H_
@ -68,8 +68,9 @@
#define CWM_EXEC_WM 0x0002
/* cycle */
#define CWM_CYCLE 0
#define CWM_RCYCLE 1
#define CWM_CYCLE 0x0001
#define CWM_RCYCLE 0x0002
#define CWM_INGROUP 0x0004
#define KBTOGROUP(X) ((X) - 1)

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: client.c,v 1.86 2011/07/14 11:39:53 okan Exp $
* $OpenBSD: client.c,v 1.87 2011/09/03 09:20:58 okan Exp $
*/
#include <sys/param.h>
@ -567,7 +567,7 @@ match:
}
void
client_cycle(struct screen_ctx *sc, int reverse)
client_cycle(struct screen_ctx *sc, int flags)
{
struct client_ctx *oldcc, *newcc;
int again = 1;
@ -579,18 +579,19 @@ client_cycle(struct screen_ctx *sc, int reverse)
return;
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));
newcc = oldcc;
while (again) {
again = 0;
newcc = (reverse ? client_mruprev(newcc) :
newcc = (flags & CWM_RCYCLE ? client_mruprev(newcc) :
client_mrunext(newcc));
/* 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;
/* Is oldcc the only non-hidden window? */

View File

@ -15,7 +15,7 @@
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*
* $OpenBSD: conf.c,v 1.92 2011/09/03 09:17:16 okan Exp $
* $OpenBSD: conf.c,v 1.93 2011/09/03 09:20:58 okan Exp $
*/
#include <sys/param.h>
@ -359,6 +359,8 @@ static struct {
{ "nogroup", kbfunc_client_nogroup, 0, {0} },
{ "cyclegroup", kbfunc_client_cyclegroup, 0, {.i = CWM_CYCLE} },
{ "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}},
{ "maximize", kbfunc_client_maximize, KBFLAG_NEEDCLIENT, {0} },
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },

View File

@ -1,4 +1,4 @@
.\" $OpenBSD: cwmrc.5,v 1.38 2011/06/25 13:12:56 okan Exp $
.\" $OpenBSD: cwmrc.5,v 1.39 2011/09/03 09:20:58 okan Exp $
.\"
.\" Copyright (c) 2004,2005 Marius Aamodt Eriksen <marius@monkey.org>
.\"
@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: June 25 2011 $
.Dd $Mdocdate: September 3 2011 $
.Dt CWMRC 5
.Os
.Sh NAME
@ -289,6 +289,10 @@ Reverse cycle through groups.
Forward cycle through windows.
.It rcycle
Reverse cycle through windows.
.It cycleingroup
Forward cycle through windows in current group.
.It rcycleingroup
Reverse cycle through windows in current group.
.It snapdist
Minimum distance to snap-to adjacent edge.
.It delete