aboutsummaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorgonzo <gonzo@toniatuh.com>2023-05-17 20:43:21 +0200
committergonzo <gonzo@toniatuh.com>2023-05-17 20:43:21 +0200
commit788731079849b41c6e0cb2c4baa2665aa3bc74c0 (patch)
treee2684234eac75062885da6e67fe24c26600e7ca2 /dwm.c
parentb206a544652e7f1c06172b4c059c057cf946d9ef (diff)
downloaddwm-788731079849b41c6e0cb2c4baa2665aa3bc74c0.tar.gz
cycle layouts
Diffstat (limited to 'dwm.c')
-rw-r--r--dwm.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/dwm.c b/dwm.c
index 5dcb278..1db2f5e 100644
--- a/dwm.c
+++ b/dwm.c
@@ -160,6 +160,7 @@ static void configure(Client *c);
static void configurenotify(XEvent *e);
static void configurerequest(XEvent *e);
static Monitor *createmon(void);
+static void cyclelayout(const Arg *arg);
static void destroynotify(XEvent *e);
static void detach(Client *c);
static void detachstack(Client *c);
@@ -672,6 +673,23 @@ createmon(void)
}
void
+cyclelayout(const Arg *arg) {
+ Layout *l;
+ for(l = (Layout *)layouts; l != selmon->lt[selmon->sellt]; l++);
+ if(arg->i > 0) {
+ if(l->symbol && (l + 1)->symbol)
+ setlayout(&((Arg) { .v = (l + 1) }));
+ else
+ setlayout(&((Arg) { .v = layouts }));
+ } else {
+ if(l != layouts && (l - 1)->symbol)
+ setlayout(&((Arg) { .v = (l - 1) }));
+ else
+ setlayout(&((Arg) { .v = &layouts[LENGTH(layouts) - 2] }));
+ }
+}
+
+void
destroynotify(XEvent *e)
{
Client *c;