summaryrefslogtreecommitdiffhomepage
path: root/patch
diff options
context:
space:
mode:
authorStein Gunnar Bakkeby <[email protected]>2021-01-22 11:12:04 +0100
committerGitHub <[email protected]>2021-01-22 11:12:04 +0100
commit1b3a348d5d177221592fb4eee10e7c351c07b71e (patch)
tree2edfb0da571b85ca4c8ad9348723cb5321e38830 /patch
parentacbf2de1c23085e0a8736498e5c7600f77f7a5f0 (diff)
parent5fd83cb76b4203581fe4dcb382f9e11bec7ad65e (diff)
downloaddwm-flexipatch-1b3a348d5d177221592fb4eee10e7c351c07b71e.tar.gz
dwm-flexipatch-1b3a348d5d177221592fb4eee10e7c351c07b71e.zip
Merge pull request #89 from gx2b/master
Layoutmenu patch
Diffstat (limited to 'patch')
-rw-r--r--patch/bar_layoutmenu.c18
-rw-r--r--patch/bar_layoutmenu.h1
-rw-r--r--patch/include.c5
-rw-r--r--patch/include.h5
-rwxr-xr-xpatch/layoutmenu.sh8
5 files changed, 35 insertions, 2 deletions
diff --git a/patch/bar_layoutmenu.c b/patch/bar_layoutmenu.c
new file mode 100644
index 0000000..1b95069
--- /dev/null
+++ b/patch/bar_layoutmenu.c
@@ -0,0 +1,18 @@
+void
+layoutmenu(const Arg *arg) {
+ FILE *p;
+ char c[3], *s;
+ int i;
+
+ if (!(p = popen(layoutmenu_cmd, "r")))
+ return;
+ s = fgets(c, sizeof(c), p);
+ pclose(p);
+
+ if (!s || *s == '\0' || c == '\0')
+ return;
+
+ i = atoi(c);
+ setlayout(&((Arg) { .v = &layouts[i] }));
+}
+
diff --git a/patch/bar_layoutmenu.h b/patch/bar_layoutmenu.h
new file mode 100644
index 0000000..4c23763
--- /dev/null
+++ b/patch/bar_layoutmenu.h
@@ -0,0 +1 @@
+static void layoutmenu(const Arg *arg);
diff --git a/patch/include.c b/patch/include.c
index 27ff539..8e1d590 100644
--- a/patch/include.c
+++ b/patch/include.c
@@ -83,6 +83,9 @@
#if BAR_WINTITLEACTIONS_PATCH
#include "bar_wintitleactions.c"
#endif
+#if BAR_LAYOUTMENU_PATCH
+#include "bar_layoutmenu.c"
+#endif
/* Other patches */
#if ASPECTRESIZE_PATCH
@@ -328,4 +331,4 @@
#endif
#if TILE_LAYOUT
#include "layout_tile.c"
-#endif \ No newline at end of file
+#endif
diff --git a/patch/include.h b/patch/include.h
index c13d73b..5ebc442 100644
--- a/patch/include.h
+++ b/patch/include.h
@@ -80,6 +80,9 @@
#if BAR_WINTITLEACTIONS_PATCH
#include "bar_wintitleactions.h"
#endif
+#if BAR_LAYOUTMENU_PATCH
+#include "bar_layoutmenu.h"
+#endif
/* Other patches */
#if ASPECTRESIZE_PATCH
@@ -318,4 +321,4 @@
#endif
#if TILE_LAYOUT
#include "layout_tile.h"
-#endif \ No newline at end of file
+#endif
diff --git a/patch/layoutmenu.sh b/patch/layoutmenu.sh
new file mode 100755
index 0000000..0bb0456
--- /dev/null
+++ b/patch/layoutmenu.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+cat <<EOF | xmenu
+[]= Tiled Layout 0
+><> Floating Layout 1
+[M] Monocle Layout 2
+EOF
+