diff options
Diffstat (limited to 'dwm.c')
-rw-r--r-- | dwm.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -205,6 +205,7 @@ static void grabkeys(void); static void incnmaster(const Arg *arg); static void keypress(XEvent *e); static void killclient(const Arg *arg); +static void layoutmenu(const Arg *arg); static void loadxrdb(void); static void manage(Window w, XWindowAttributes *wa); static void mappingnotify(XEvent *e); @@ -1139,6 +1140,24 @@ loadxrdb() } 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] })); +} + +void manage(Window w, XWindowAttributes *wa) { Client *c, *t = NULL, *term = NULL; @@ -2447,3 +2466,4 @@ main(int argc, char *argv[]) XCloseDisplay(dpy); return EXIT_SUCCESS; } + |