diff --git a/config.h b/config.h index 8100644..be7257b 100755 --- a/config.h +++ b/config.h @@ -10,7 +10,7 @@ #define MENUFGCOL 0x797979 #define MENUBGCOL 0x000000 #define SMENUFGCOL 0x000000 -#define SMENUBGCOL 0x797979 +#define SMENUBGCOL 0x1f9b92 #define SHORTCUTMOD Mod4Mask #define MODBITS (1<<6) diff --git a/event.c b/event.c index d6fa2a1..d6f9425 100755 --- a/event.c +++ b/event.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -287,6 +288,7 @@ newwindow(XCreateWindowEvent *e) } if (kbLaunch) { + usleep(100000); quickreshape(c, c->screen->width/5, c->screen->height/5, 3*c->screen->width/5, 3*c->screen->height/5); kbLaunch = 0; } diff --git a/key.c b/key.c index 2c5e7ad..40c0e8b 100755 --- a/key.c +++ b/key.c @@ -39,6 +39,7 @@ keysetup(void) int tabcode = XKeysymToKeycode(dpy, XK_Tab); int dcode = XKeysymToKeycode(dpy, DESTROY_KEY); int icode = XKeysymToKeycode(dpy, ICON_KEY); + int ucode = XKeysymToKeycode(dpy, UNHIDE_KEY); int mcode = XKeysymToKeycode(dpy, MAX_KEY); int vcode = XKeysymToKeycode(dpy, MOVE_KEY); int rcode = XKeysymToKeycode(dpy, RESIZE_KEY); @@ -59,6 +60,7 @@ keysetup(void) XGrabKey(dpy, tabcode, Mod1Mask, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, dcode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, icode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); + XGrabKey(dpy, ucode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, rcode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, vcode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); XGrabKey(dpy, mcode, SHORTCUTMOD, screens[i].root, 0, GrabModeSync, GrabModeAsync); @@ -90,6 +92,7 @@ keypress(XKeyEvent *e) int tabcode = XKeysymToKeycode(dpy, XK_Tab); int dcode = XKeysymToKeycode(dpy, DESTROY_KEY); int icode = XKeysymToKeycode(dpy, ICON_KEY); + int ucode = XKeysymToKeycode(dpy, UNHIDE_KEY); int mcode = XKeysymToKeycode(dpy, MAX_KEY); int vcode = XKeysymToKeycode(dpy, MOVE_KEY); int rcode = XKeysymToKeycode(dpy, RESIZE_KEY); @@ -115,8 +118,10 @@ keypress(XKeyEvent *e) alttab(e->state&ShiftMask); if(e->keycode == dcode && (e->state&SHORTCUTMOD) == (MODBITS)) delete(current, 0); - if(e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS)) + if (e->keycode == icode && (e->state&SHORTCUTMOD) == (MODBITS)) hide(current); + if (e->keycode == ucode && (e->state&SHORTCUTMOD) == (MODBITS)) + unhide(0, 1); if (e->keycode == vcode && (e->state&SHORTCUTMOD) == (MODBITS)) move(current, Button3); if (e->keycode == rcode && (e->state&SHORTCUTMOD) == (MODBITS)) @@ -173,11 +178,18 @@ keypress(XKeyEvent *e) /* switch virts */ if (e->keycode == rightcode && (e->state&SHORTCUTMOD) == (MODBITS)) - if (numvirtuals > 1 && virt < numvirtuals - 1) - switch_to(virt + 1); + if (numvirtuals > 1) + if (virt < numvirtuals - 1) + switch_to(virt + 1); + else + switch_to(0); + if (e->keycode == leftcode && (e->state&SHORTCUTMOD) == (MODBITS)) - if (numvirtuals >1 && virt > 0) - switch_to(virt - 1); + if (numvirtuals >1) + if (virt > 0) + switch_to(virt - 1); + else + switch_to(numvirtuals - 1); XAllowEvents(dpy, SyncKeyboard, e->time); } @@ -191,6 +203,8 @@ keyrelease(XKeyEvent *e) void quickreshape(Client *c, int x, int y, int dx, int dy) { + if (c == 0) + return; XMoveResizeWindow(dpy, c->parent, x,y, dx, dy); c->x = x + BORDER; c->y = y + BORDER; diff --git a/menu.c b/menu.c index ae9592a..290b8f9 100755 --- a/menu.c +++ b/menu.c @@ -410,6 +410,7 @@ switch_to_c(int n, Client *c) void switch_to(int n) { + static char virtmsg[32]; if(n == virt) return; currents[virt] = current; @@ -422,6 +423,17 @@ switch_to(int n) switch_to_c(n, clients); current = currents[virt]; + if(fork() == 0) + { + close(ConnectionNumber(dpy)); + if(dpy != '\0') + putenv(dpy); + signal(SIGINT, SIG_DFL); + signal(SIGTERM, SIG_DFL); + signal(SIGHUP, SIG_DFL); + sprintf(virtmsg, "virtual: switched to %s", b2items[virt]); + execlp("notify-send", "notify-send", "-c virtual", virtmsg, (char*)0); + } } void