Adding togglelayout patch

pull/74/head
bakkeby 3 years ago
parent b513992a8f
commit bce5504cba

@ -0,0 +1,32 @@
From 1cca39d31ca5cafe47545a5759e2a4be23f47eb0 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Sun, 30 May 2021 13:52:29 +0200
Subject: [PATCH 2/2] togglelayout - keyboard shortcuts to set a given layout
will toggle to the previous layout if the given layout is already active
---
dwm.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/dwm.c b/dwm.c
index 466177c..df25a2d 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1538,11 +1538,9 @@ setfullscreen(Client *c, int fullscreen)
void
setlayout(const Arg *arg)
{
- if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt]) {
- selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
- selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
- }
- if (arg && arg->v)
+ selmon->pertag->sellts[selmon->pertag->curtag] ^= 1;
+ selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
+ if (arg && arg->v && arg->v != selmon->lt[selmon->sellt ^ 1])
selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt] = (Layout *)arg->v;
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
--
2.19.1

@ -0,0 +1,29 @@
From fbdaa1e189d54138341434255d7c7162a4daed87 Mon Sep 17 00:00:00 2001
From: bakkeby <bakkeby@gmail.com>
Date: Sun, 30 May 2021 13:47:25 +0200
Subject: [PATCH] togglelayout - keyboard shortcuts to set a given layout will
toggle to the previous layout if the given layout is already active
---
dwm.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dwm.c b/dwm.c
index 4465af1..2604ff6 100644
--- a/dwm.c
+++ b/dwm.c
@@ -1500,9 +1500,8 @@ setfullscreen(Client *c, int fullscreen)
void
setlayout(const Arg *arg)
{
- if (!arg || !arg->v || arg->v != selmon->lt[selmon->sellt])
- selmon->sellt ^= 1;
- if (arg && arg->v)
+ selmon->sellt ^= 1;
+ if (arg && arg->v && arg->v != selmon->lt[selmon->sellt ^ 1])
selmon->lt[selmon->sellt] = (Layout *)arg->v;
strncpy(selmon->ltsymbol, selmon->lt[selmon->sellt]->symbol, sizeof selmon->ltsymbol);
if (selmon->sel)
--
2.19.1
Loading…
Cancel
Save