Updated README.md, mwm.c.

This commit is contained in:
Luis Lavaire 2024-11-17 19:46:01 -06:00
parent 1c9aa60401
commit ddf7df2dea
3 changed files with 18 additions and 17 deletions

View file

@ -12,10 +12,8 @@ For the true minimalist:
- Includes just what is strictly needed.
- Not standards compliant (because, honestly, who gives a fuck?).
- All windows are full-screen, just one is visible at any given time.
-
`mwm` just loops through X key press events and lets you bind
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).
Two macros are available for assigning keybindings: `grab` and `K`.
Read the source for an example on how to use them (my own setup).
Dead simple.

4
build.sh Executable file
View file

@ -0,0 +1,4 @@
#! /bin/sh
rm -f mwm; tcc -lX11 mwm.c -o mwm

19
mwm.c
View file

@ -12,22 +12,21 @@ int main () {
Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e;
XSelectInput (d, r, SubstructureRedirectMask);
grab ("q", "n", "l", "space", "Return", "Right", "Left", "Up", "Down");
grab ("n", "q", "w", "t", "l", "u", "i", "o", "p");
while (!XNextEvent (d, &e)) {
E (KeyPress,
K("n", XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0))
K("q", XKillClient(d, e.xkey.subwindow))
K("l", system("rotK &"))
K("space", system("chromium &"))
K("Return", system("xterm &"))
K("Right", system("vol 5%+ &"))
K("Left", system("vol 5%- &"))
K("Up", system("bri +100 &"))
K("Down", system("bri -100 &")))
K("w", system("chromium --enable-features=WebContentsForceDark &"))
K("t", system("xterm &"))
K("l", system("rotK"))
K("u", system("vol 5%-"))
K("i", system("vol 5%+"))
K("o", system("bri -100"))
K("p", system("bri +100")))
E (MapRequest,
XMapWindow(d, e.xmaprequest.window);
E (MapRequest, XMapWindow(d, e.xmaprequest.window);
XSetInputFocus(d, e.xmaprequest.window, 2, 0))
E (ConfigureRequest,