diff -r 0d86faf4b05c dwm.c --- a/dwm.c Sun Jul 25 09:58:25 2010 +0100 +++ b/dwm.c Wed Aug 18 20:13:38 2010 +0100 @@ -133,6 +133,7 @@ unsigned int sellt; unsigned int tagset[2]; Bool showbar; + Bool popupbar; Bool topbar; Client *clients; Client *sel; @@ -221,6 +222,7 @@ static int textnw(const char *text, unsigned int len); static void tile(Monitor *); static void togglebar(const Arg *arg); +static void popupbar(Bool show); static void togglefloating(const Arg *arg); static void toggletag(const Arg *arg); static void toggleview(const Arg *arg); @@ -261,6 +263,7 @@ [Expose] = expose, [FocusIn] = focusin, [KeyPress] = keypress, + [KeyRelease] = keypress, [MappingNotify] = mappingnotify, [MapRequest] = maprequest, [PropertyNotify] = propertynotify, @@ -978,6 +981,12 @@ KeyCode code; XUngrabKey(dpy, AnyKey, AnyModifier, root); + + XGrabKey(dpy, XKeysymToKeycode(dpy, XK_Super_L), AnyModifier, root, + True, GrabModeAsync, GrabModeAsync); + XGrabKey(dpy, XKeysymToKeycode(dpy, XK_Super_R), AnyModifier, root, + True, GrabModeAsync, GrabModeAsync); + for(i = 0; i < LENGTH(keys); i++) { if((code = XKeysymToKeycode(dpy, keys[i].keysym))) for(j = 0; j < LENGTH(modifiers); j++) @@ -1059,11 +1068,21 @@ ev = &e->xkey; keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); + if(keysym == XK_Super_L || keysym == XK_Super_R) { + popupbar(ev->type == KeyPress); + return; + } + if(ev->type == KeyRelease) { + return; + } + for(i = 0; i < LENGTH(keys); i++) if(keysym == keys[i].keysym && CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) && keys[i].func) keys[i].func(&(keys[i].arg)); + + popupbar(selmon->popupbar); } void @@ -1673,6 +1692,24 @@ } void +popupbar(Bool show) { + if(selmon->showbar) return; + + if(show != selmon->popupbar) { + selmon->popupbar = show; + if(show) { + selmon->by = selmon->topbar ? selmon->wy : selmon->wy + selmon->wh; + } + else { + selmon->by = -bh; + } + XMoveResizeWindow(dpy, selmon->barwin, selmon->wx, selmon->by, selmon->ww, bh); + } + + if(show) XRaiseWindow(dpy, selmon->barwin); +} + +void togglefloating(const Arg *arg) { if(!selmon->sel) return;