summary refs log tree commit diff
path: root/kbfunc.c
diff options
context:
space:
mode:
Diffstat (limited to 'kbfunc.c')
-rw-r--r--kbfunc.c25
1 files changed, 22 insertions, 3 deletions
diff --git a/kbfunc.c b/kbfunc.c
index cbccc56..d858b7b 100644
--- a/kbfunc.c
+++ b/kbfunc.c
@@ -430,7 +430,9 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
 		/* Only cycle visible and non-ignored windows. */
 		if ((newcc->flags & (CLIENT_SKIP_CYCLE)) ||
 		    ((flags & CWM_CYCLE_INGROUP) &&
-		    (newcc->gc != oldcc->gc)))
+		    (newcc->gc != oldcc->gc)) ||
+		    ((flags & CWM_CYCLE_INCLASS) &&
+		    strcmp(newcc->res_class, oldcc->res_class) != 0))
 			again = 1;
 
 		/* Is oldcc the only non-hidden window? */
@@ -450,7 +452,16 @@ kbfunc_client_cycle(void *ctx, struct cargs *cargs)
 		newcc->ptr.x = newcc->geom.w / 2;
 		newcc->ptr.y = newcc->geom.h / 2;
 	}
-	client_ptr_warp(newcc);
+
+	/* When no client is active, warp pointer to last active. */
+	if (oldcc->flags & (CLIENT_ACTIVE))
+		client_ptr_warp(newcc);
+	else if (oldcc->flags & (CLIENT_SKIP_CYCLE))
+		client_ptr_warp(newcc);
+	else {
+		client_raise(oldcc);
+		client_ptr_warp(oldcc);
+	}
 }
 
 void
@@ -479,6 +490,14 @@ kbfunc_group_only(void *ctx, struct cargs *cargs)
 }
 
 void
+kbfunc_group_last(void *ctx, struct cargs *cargs)
+{
+	struct screen_ctx	*sc = ctx;
+
+	group_only(ctx, sc->group_last->num);
+}
+
+void
 kbfunc_group_toggle(void *ctx, struct cargs *cargs)
 {
 	group_toggle(ctx, cargs->flag);
@@ -660,7 +679,7 @@ kbfunc_menu_exec(void *ctx, struct cargs *cargs)
 				/* lstat(2) in case d_type isn't supported. */
 				if (lstat(tpath, &sb) == -1)
 					continue;
-				if (!S_ISREG(sb.st_mode) && 
+				if (!S_ISREG(sb.st_mode) &&
 				    !S_ISLNK(sb.st_mode))
 					continue;
 			}