added evil key support to dmenu
This commit is contained in:
parent
09813fcf2c
commit
b6cd6ed266
17
main.c
17
main.c
|
@ -15,6 +15,8 @@
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
|
|
||||||
|
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask))
|
||||||
|
|
||||||
typedef struct Item Item;
|
typedef struct Item Item;
|
||||||
struct Item {
|
struct Item {
|
||||||
Item *next; /* traverses all items */
|
Item *next; /* traverses all items */
|
||||||
|
@ -31,6 +33,7 @@ static int ret = 0;
|
||||||
static int nitem = 0;
|
static int nitem = 0;
|
||||||
static unsigned int cmdw = 0;
|
static unsigned int cmdw = 0;
|
||||||
static unsigned int promptw = 0;
|
static unsigned int promptw = 0;
|
||||||
|
static unsigned int numlockmask = 0;
|
||||||
static Bool running = True;
|
static Bool running = True;
|
||||||
static Item *allitems = NULL; /* first of all items */
|
static Item *allitems = NULL; /* first of all items */
|
||||||
static Item *item = NULL; /* first of pattern matching items */
|
static Item *item = NULL; /* first of pattern matching items */
|
||||||
|
@ -187,7 +190,7 @@ kpress(XKeyEvent * e) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(e->state & Mod1Mask) {
|
if(CLEANMASK(e->state) & Mod1Mask) {
|
||||||
switch(ksym) {
|
switch(ksym) {
|
||||||
default: return;
|
default: return;
|
||||||
case XK_h:
|
case XK_h:
|
||||||
|
@ -347,10 +350,11 @@ main(int argc, char *argv[]) {
|
||||||
char *selbg = SELBGCOLOR;
|
char *selbg = SELBGCOLOR;
|
||||||
char *selfg = SELFGCOLOR;
|
char *selfg = SELFGCOLOR;
|
||||||
fd_set rd;
|
fd_set rd;
|
||||||
int i;
|
int i, j;
|
||||||
struct timeval timeout;
|
struct timeval timeout;
|
||||||
Item *itm;
|
Item *itm;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
XModifierKeymap *modmap;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
|
||||||
timeout.tv_usec = 0;
|
timeout.tv_usec = 0;
|
||||||
|
@ -408,6 +412,15 @@ main(int argc, char *argv[]) {
|
||||||
if(select(ConnectionNumber(dpy) + 1, &rd, NULL, NULL, &timeout) < 1)
|
if(select(ConnectionNumber(dpy) + 1, &rd, NULL, NULL, &timeout) < 1)
|
||||||
goto UninitializedEnd;
|
goto UninitializedEnd;
|
||||||
maxname = readstdin();
|
maxname = readstdin();
|
||||||
|
/* init modifier map */
|
||||||
|
modmap = XGetModifierMapping(dpy);
|
||||||
|
for (i = 0; i < 8; i++) {
|
||||||
|
for (j = 0; j < modmap->max_keypermod; j++) {
|
||||||
|
if(modmap->modifiermap[i * modmap->max_keypermod + j] == XKeysymToKeycode(dpy, XK_Num_Lock))
|
||||||
|
numlockmask = (1 << i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XFreeModifiermap(modmap);
|
||||||
/* style */
|
/* style */
|
||||||
dc.norm[ColBG] = getcolor(normbg);
|
dc.norm[ColBG] = getcolor(normbg);
|
||||||
dc.norm[ColFG] = getcolor(normfg);
|
dc.norm[ColFG] = getcolor(normfg);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user