From b6991981549cee71365f248e891a6be5c3896be0 Mon Sep 17 00:00:00 2001 From: Luis Lavaire Date: Thu, 14 Nov 2024 13:26:36 -0600 Subject: [PATCH] Updated README.md, mwm.c. --- README.md | 11 +++++------ mwm.c | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 25397d6..0d1aa92 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,18 @@ For the true minimalist: -- ~20 LOC. -- No default keybindings. +- ~40 LOC. +- No default keybindings (just edit the source). - No title bars, no status bars, no buttons, no borders, no menus, etc. - No mouse control. - No virtual desktops. - No configuration files. - Absolutely adabptable to your needs. - Includes just what is strictly needed. +- Not standards compliant (because, honestly, who gives a fuck?). `mwm` just loops through X key press events and lets you bind -actions to key presses. It provides two macros: `grab` and `on`. -You first `grab` the key (e.g.: `grab("Return", Mod4Mask)`), then you bind -an action to it (e.g.: `on("Return", system("xterm &"))`). More than -one action can be provided (e.g.: `on("Tab", XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 0, 0)))`). +actions to key presses. It provides two macros: `grab` and `K`. +Read the source for an example on how to use it (my own setup). Dead simple. diff --git a/mwm.c b/mwm.c index 01ae1ad..a61b16f 100644 --- a/mwm.c +++ b/mwm.c @@ -4,7 +4,7 @@ #define stk(s) XKeysymToKeycode(d, XStringToKeysym(s)) #define K(k, x) if (e.xkey.keycode == stk(k)) { x; } #define E(_, x) if (e.type == _) { x; } -#define gks(...) const char *l[] = { __VA_ARGS__ }; \ +#define grab(...) const char *l[] = { __VA_ARGS__ }; \ for (size_t i = 0; i < sizeof(l) / sizeof(*l); ++i) \ XGrabKey (d, stk(l[i]), Mod4Mask, r, 1, 1, 1); @@ -12,7 +12,7 @@ int main () { Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e; XSelectInput (d, r, SubstructureRedirectMask); - gks ("q", "n", "l", "space", "Return", "Right", "Left", "Up", "Down"); + grab ("q", "n", "l", "space", "Return", "Right", "Left", "Up", "Down"); while (!XNextEvent (d, &e)) { E (KeyPress,