X-Git-Url: http://git.subgeniuskitty.com/dwm/.git/blobdiff_plain/ba83593450d1a7724a2631dbd2c6436b30dc1643..9813966c84eef470fcd8c14d42218ece1928e36e:/dwm.c diff --git a/dwm.c b/dwm.c index 14fe6cc..a94b759 100644 --- a/dwm.c +++ b/dwm.c @@ -178,6 +178,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 manage(Window w, XWindowAttributes *wa); static void mappingnotify(XEvent *e); static void maprequest(XEvent *e); @@ -1068,6 +1069,24 @@ killclient(const Arg *arg) } } +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] == '\0') + return; + + i = atoi(c); + setlayout(&((Arg) { .v = &layouts[i] })); +} + void manage(Window w, XWindowAttributes *wa) {