testsAndMisc/linux_configuration/dwm/README.md
Krzysztof kuhy Rudnicki 4f2b0ccdf7 Dissolve linux_configuration/scripts/ and single_use/
Two levels of pure taxonomy carrying no information, and a 2-directory
cap leaves no room for them. Categories now sit directly under
linux_configuration/: features, fixes, utils, misc, fresh-install,
installers, diagnostics, gaming, boot_recovery, periodic_background, lib,
meta, tests. A script's own lib/ and tests/ are exempt from the cap, so
those stay put.

Depth violations 248 -> 139; roughly 40 of the remainder are inside
digital_wellbeing and hosts, deferred until the guard-lib repoint.

The moves are the easy half. What breaks is every path that counted
levels, and three classes of it had to be found by resolving paths rather
than reading diffs:

  - 52 relative `source` lines for lib/common.sh and lib/android.sh. The
    correct prefix differs per file: 40 were ../../ and 12 were ../../../,
    so a blanket replace would have fixed one set and broken the other.
  - REPO_ROOT in 7 fixes/lib/tests harnesses and setup_syncyomi_guard.sh,
    each walking up four levels from a directory now two levels shallower.
    This caused a real regression -- the fixes suite went red with
    "log_warn: command not found" -- caught by running it and comparing
    against the pre-move baseline worktree.
  - conftest.py's sys.path entries, which took the pytest gate down with
    14 collection errors, and the `# shellcheck source=` directives, which
    took shellcheck down with SC1091.

16 symlinks in $HOME broke, including the entire i3blocks bar. All
repointed, and cpu_monitor/memory/disk/time/volume were run to confirm
they emit real output rather than merely resolving.

Verified: 1798 tests pass at 100% coverage, 8 of 9 lib/tests suites pass
(the ninth needs the coverage jail, identically at baseline), pre-commit
is clean, and the two untracked secret configs are still ignored after
their gitignore paths changed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PJrqKERAo5QUeEHWS5Asgp
2026-08-23 18:53:30 +02:00

64 lines
4.9 KiB
Markdown

# dwm (i3-like, compiled from source)
Versioned customisation for [suckless dwm](https://dwm.suckless.org/). This
directory is the **source of truth**; the installer
[`../features/setup_dwm.sh`](../features/setup_dwm.sh)
clones upstream `dwm` master, copies these files on top, applies the two
`dwm.c` patches, and builds. Nothing here is a full fork of dwm — only the
files we actually change live in the repo, so upstream stays bleeding-edge.
## How a build works
`setup_dwm.sh` runs, in order:
1. `git clone` / `git reset --hard origin/master` into `~/.local/src/dwm`
(always the latest upstream).
2. Copy `config.h` over the clone.
3. `heal_config` — auto-merge any new upstream scalar knob (e.g. `refreshrate`)
that the current `dwm.c` needs but our `config.h` predates.
4. Apply `patches/focus-on-click.patch` and
`patches/fullscreen-pointer-confine.patch` to `dwm.c` — done with `perl`
rewrites (robust against upstream line shifts), not `git apply`. The
`.patch` files are the human-readable record of exactly those changes.
5. `make && sudo make install`.
6. Compile `pointer-confine.c` and install `bin/*` to `/usr/local/bin`.
Because the clone is reset every run, the patches are **re-applied each build**,
which is what keeps "always latest master" working.
## Files
| Path | What it is |
| ------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `config.h` | dwm config: Mod4, Dracula colours, 10 tags, bottom bar, vim-style focus/move, multi-monitor keys, media keys, `movestack`/`togglefullscr` defined inline so `dwm.c` needs no extra patch for them. |
| `pointer-confine.c` | Standalone helper: traps the X pointer on the current monitor with XFixes pointer barriers until killed. Used for fullscreen gaming so the cursor can't slide onto the other screen. |
| `patches/focus-on-click.patch` | No-ops `enternotify`/`motionnotify` so the pointer never changes focus or switches monitors — focus only changes on click or via keys. |
| `patches/fullscreen-pointer-confine.patch` | Hooks `setfullscreen`/`unmanage` to start/stop `pconfine-auto` so the cursor-lock turns on automatically when a window goes fullscreen. |
| `bin/dwm-session` | lightdm session launcher (autostart + `dwmstatus` + `exec dwm`). |
| `bin/dwmstatus` | Status feeder: CPU/GPU/board temps, RAM, load, volume, clock → root window name. `dwmstatus once` prints the line without `xsetroot`. |
| `bin/dwm-rebuild` | Recompile `~/.local/src/dwm` in place (quick local rebuild). |
| `bin/switch-wm` | Flip the lightdm boot session between `i3` and `dwm`. |
| `bin/pconfine-auto` | `on`/`off` single-instance control of the `pointer-confine` daemon (called by the dwm hooks and the panic key). |
## Customising
- **Permanent change:** edit the file here (e.g. `config.h`), then re-run
`setup_dwm.sh`. Log out / back in to apply (dwm has no live restart).
- **Quick experiment:** edit `~/.local/src/dwm/config.h` directly and run
`dwm-rebuild` — but note the next `setup_dwm.sh` run overwrites it from here.
## Notable bindings (Mod = Super)
- `Mod+Return` terminal, `Mod+d` dmenu, `Mod+f` fullscreen, `Mod+Shift+q` kill,
`Mod+Shift+e` exit, `Mod+Shift+r` recompile.
- Multi-monitor: `Mod+,`/`Mod+.` (or `Mod+Ctrl+←/→`) focus the other screen;
`Mod+Shift+,`/`Mod+Shift+.` (or `Mod+Ctrl+Shift+←/→`) throw the window there.
- `Mod+Shift+p` force-releases the fullscreen cursor-lock if a barrier sticks.
## Dependencies
Build/runtime: `libx11 libxft libxinerama gcc make dmenu terminator`, plus
`xorg-xsetroot` for the status bar and `libxfixes` for `pointer-confine`
(present as a dep of Xorg). Install missing ones interactively — this system's
`pacman` is a wrapper that deadlocks when driven non-interactively.