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. - Includes just what is strictly needed.
- Not standards compliant (because, honestly, who gives a fuck?). - Not standards compliant (because, honestly, who gives a fuck?).
- All windows are full-screen, just one is visible at any given time. - 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 Two macros are available for assigning keybindings: `grab` and `K`.
actions to key presses. It provides two macros: `grab` and `K`. Read the source for an example on how to use them (my own setup).
Read the source for an example on how to use it (my own setup).
Dead simple. Dead simple.

4
build.sh Executable file
View file

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

25
mwm.c
View file

@ -12,26 +12,25 @@ int main () {
Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e; Display *d = XOpenDisplay(0); Window r = DefaultRootWindow(d); XEvent e;
XSelectInput (d, r, SubstructureRedirectMask); 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)) { while (!XNextEvent (d, &e)) {
E (KeyPress, E (KeyPress,
K("n", XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0)) K("n", XCirculateSubwindowsUp(d, r); XSetInputFocus(d, e.xkey.window, 2, 0))
K("q", XKillClient(d, e.xkey.subwindow)) K("q", XKillClient(d, e.xkey.subwindow))
K("l", system("rotK &")) K("w", system("chromium --enable-features=WebContentsForceDark &"))
K("space", system("chromium &")) K("t", system("xterm &"))
K("Return", system("xterm &")) K("l", system("rotK"))
K("Right", system("vol 5%+ &")) K("u", system("vol 5%-"))
K("Left", system("vol 5%- &")) K("i", system("vol 5%+"))
K("Up", system("bri +100 &")) K("o", system("bri -100"))
K("Down", system("bri -100 &"))) K("p", system("bri +100")))
E (MapRequest, E (MapRequest, XMapWindow(d, e.xmaprequest.window);
XMapWindow(d, e.xmaprequest.window); XSetInputFocus(d, e.xmaprequest.window, 2, 0))
XSetInputFocus(d, e.xmaprequest.window, 2, 0))
E (ConfigureRequest, E (ConfigureRequest,
XMoveResizeWindow (d, e.xconfigure.window, 0, 0, e.xconfigure.width, e.xconfigure.height); XMoveResizeWindow (d, e.xconfigure.window, 0, 0, e.xconfigure.width, e.xconfigure.height);
XMoveResizeWindow (d, e.xconfigure.window, 0, 0, 1920, 1080)) XMoveResizeWindow (d, e.xconfigure.window, 0, 0, 1920, 1080))
} }
} }