X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=dwm.c;h=ec37588b1316baa359101196890fcbdeec2e7644;hb=9463d5354bc57d0c0086b7328196d7af60ed706d;hp=1c52d805466ebaaf5e1c50ff7b74cc7e8462070b;hpb=c56533615f84df801f10dedc4d6ff267e0e8df0a;p=dwm.git diff --git a/dwm.c b/dwm.c index 1c52d80..ec37588 100644 --- a/dwm.c +++ b/dwm.c @@ -224,13 +224,11 @@ static Client *stack = NULL; static Cursor cursor[CurLast]; static Display *dpy; static DC dc = {0}; +static Layout *lt = NULL; static Window root, barwin; - /* configuration, allows nested code to access above variables */ #include "config.h" -static Layout *lt = layouts; - /* compile-time check if all tags fit into an uint bit array. */ struct NumTags { char limitexceeded[sizeof(uint) * 8 < LENGTH(tags) ? -1 : 1]; }; @@ -363,8 +361,11 @@ checkotherwm(void) { void cleanup(void) { Arg a = {.i = ~0}; + Layout foo = { "", NULL }; + close(STDIN_FILENO); view(&a); + lt = &foo; while(stack) unmanage(stack); if(dc.font.set) @@ -1322,6 +1323,7 @@ setup(void) { sw = DisplayWidth(dpy, screen); sh = DisplayHeight(dpy, screen); bh = dc.font.height + 2; + lt = layouts; updategeom(); /* init atoms */ @@ -1476,7 +1478,9 @@ togglefloating(const Arg *arg) { void togglelayout(const Arg *arg) { - if(++lt == &layouts[LENGTH(layouts)]) + if(arg->v) + lt = (Layout *)arg->v; + else if(++lt == &layouts[LENGTH(layouts)]) lt = &layouts[0]; if(sel) arrange();