summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config.def.h35
-rw-r--r--tabbed.c30
2 files changed, 51 insertions, 14 deletions
diff --git a/config.def.h b/config.def.h
index ec85d23..45ebbfa 100644
--- a/config.def.h
+++ b/config.def.h
@@ -39,23 +39,23 @@ static Bool npisrelative = False;
ResourcePref resources[] = {
{ "font", STRING, &font },
{ "color0", STRING, &normbgcolor },
- { "color4", STRING, &normfgcolor },
+ { "color7", STRING, &normfgcolor },
{ "color4", STRING, &selbgcolor },
- { "color7", STRING, &selfgcolor },
- { "color2", STRING, &urgbgcolor },
- { "color3", STRING, &urgfgcolor },
+ { "color15", STRING, &selfgcolor },
+ { "color3", STRING, &urgbgcolor },
+ { "color15", STRING, &urgfgcolor },
};
-#define MODKEY ControlMask
+#define MODKEY ControlMask|Mod1Mask
static const Key keys[] = {
/* modifier key function argument */
- { MODKEY|ShiftMask, XK_Return, focusonce, { 0 } },
- { MODKEY|ShiftMask, XK_Return, spawn, { 0 } },
+ { MODKEY, XK_Return, focusonce, { 0 } },
+ { MODKEY, XK_Return, spawn, { 0 } },
- { MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } },
- { MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } },
- { MODKEY|ShiftMask, XK_j, movetab, { .i = -1 } },
- { MODKEY|ShiftMask, XK_k, movetab, { .i = +1 } },
+ { MODKEY, XK_l, rotate, { .i = +1 } },
+ { MODKEY, XK_h, rotate, { .i = -1 } },
+ { MODKEY|ShiftMask, XK_h, movetab, { .i = -1 } },
+ { MODKEY|ShiftMask, XK_l, movetab, { .i = +1 } },
{ MODKEY, XK_Tab, rotate, { .i = 0 } },
{ MODKEY, XK_grave, spawn, SETPROP("_TABBED_SELECT_TAB") },
@@ -71,9 +71,18 @@ static const Key keys[] = {
{ MODKEY, XK_0, move, { .i = 9 } },
{ MODKEY, XK_q, killclient, { 0 } },
-
{ MODKEY, XK_u, focusurgent, { 0 } },
{ MODKEY|ShiftMask, XK_u, toggle, { .v = (void*) &urgentswitch } },
-
{ 0, XK_F11, fullscreen, { 0 } },
+
+ { ControlMask, XK_Alt_L, showbar, { .i = 1 } },
+ { ControlMask, XK_Alt_R, showbar, { .i = 1 } },
+};
+
+static Key keyreleases[] = {
+ /* modifier key function argument */
+ { MODKEY, XK_Alt_L, showbar, { .i = 0 } },
+ { MODKEY, XK_Alt_R, showbar, { .i = 0 } },
+ { MODKEY, XK_Control_L, showbar, { .i = 0 } },
+ { MODKEY, XK_Control_R, showbar, { .i = 0 } },
};
diff --git a/tabbed.c b/tabbed.c
index 6ff4bac..0c44653 100644
--- a/tabbed.c
+++ b/tabbed.c
@@ -129,6 +129,7 @@ static Bool gettextprop(Window w, Atom atom, char *text, unsigned int size);
static void initfont(const char *fontstr);
static Bool isprotodel(int c);
static void keypress(const XEvent *e);
+static void keyrelease(const XEvent *e);
static void killclient(const Arg *arg);
static void manage(Window win);
static void maprequest(const XEvent *e);
@@ -167,6 +168,7 @@ static void (*handler[LASTEvent]) (const XEvent *) = {
[Expose] = expose,
[FocusIn] = focusin,
[KeyPress] = keypress,
+ [KeyRelease] = keyrelease,
[MapRequest] = maprequest,
[PropertyNotify] = propertynotify,
};
@@ -722,6 +724,22 @@ keypress(const XEvent *e)
}
void
+keyrelease(const XEvent *e)
+{
+ const XKeyEvent *ev = &e->xkey;
+ unsigned int i;
+ KeySym keysym;
+
+ keysym = XkbKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0, 0);
+ for (i = 0; i < LENGTH(keyreleases); i++) {
+ if (keysym == keyreleases[i].keysym &&
+ CLEANMASK(keyreleases[i].mod) == CLEANMASK(ev->state) &&
+ keyreleases[i].func)
+ keyreleases[i].func(&(keyreleases[i].arg));
+ }
+}
+
+void
killclient(const Arg *arg)
{
XEvent ev;
@@ -771,6 +789,16 @@ manage(Window w)
}
}
+ for (i = 0; i < LENGTH(keyreleases); i++) {
+ if ((code = XKeysymToKeycode(dpy, keyreleases[i].keysym))) {
+ for (j = 0; j < LENGTH(modifiers); j++) {
+ XGrabKey(dpy, code, keyreleases[i].mod |
+ modifiers[j], w, True,
+ GrabModeAsync, GrabModeAsync);
+ }
+ }
+ }
+
c = ecalloc(1, sizeof *c);
c->win = w;
@@ -1127,7 +1155,7 @@ setup(void)
XMapRaised(dpy, win);
XSelectInput(dpy, win, SubstructureNotifyMask | FocusChangeMask |
ButtonPressMask | ExposureMask | KeyPressMask |
- PropertyChangeMask | StructureNotifyMask |
+ KeyReleaseMask | PropertyChangeMask | StructureNotifyMask |
SubstructureRedirectMask);
xerrorxlib = XSetErrorHandler(xerror);