Added main program, updated README.md
This commit is contained in:
parent
31c9dbf6d5
commit
d4d54307ce
2 changed files with 37 additions and 1 deletions
18
mwm.c
Normal file
18
mwm.c
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#include <X11/Xlib.h>
|
||||
|
||||
#define stok(s) XKeysymToKeycode(d, XStringToKeysym(s))
|
||||
#define on(k, a) if (e.xkey.keycode == stok(k)) { a; continue; }
|
||||
#define grab(k, m) XGrabKey (d, stok(k), m, r, 1, 1, 1)
|
||||
|
||||
int main (int argc, char **argv) {
|
||||
Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e;
|
||||
XSelectInput (d, r, SubstructureRedirectMask);
|
||||
|
||||
grab ("KEY", MODIFIER);
|
||||
|
||||
while (!XNextEvent (d, &e)) {
|
||||
if (e.type == KeyPress) {
|
||||
on (KEY, ACTIONS);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue