|
| 1 | +# dwm-titus runtime configuration |
| 2 | + |
| 3 | +Facts below were read from dwm-titus `dwm.c`, `tomlparser.c`, and the shipped |
| 4 | +`config/*.toml`. When an installed system disagrees, trust its source copy in |
| 5 | +`~/.local/share/dwm-titus/` (or the user's checkout) over this file. |
| 6 | + |
| 7 | +## Files and load order |
| 8 | + |
| 9 | +- User files: `${XDG_CONFIG_HOME:-~/.config}/dwm-titus/hotkeys.toml`, |
| 10 | + `themes.toml`, `window-rules.toml`. |
| 11 | +- Defaults: `${XDG_DATA_HOME:-~/.local/share}/dwm-titus/config/`. A default is |
| 12 | + used only when the user file does not exist. |
| 13 | +- A user file that parses to zero entries (empty, comments only, unreadable) |
| 14 | + triggers a critical `dwm: bad config` notification and loads nothing from |
| 15 | + that file. Do not leave an empty user file in place. |
| 16 | +- Saving any of the three files (close-write or rename into the directory) |
| 17 | + reloads all three, re-grabs keys, and runs |
| 18 | + `~/.local/share/dwm-titus/scripts/theme-apply.sh`. `kill -USR1 "$(pidof dwm)"` |
| 19 | + forces the same reload. |
| 20 | +- dwm logs to stderr, which LightDM sends to `~/.xsession-errors`: |
| 21 | + `dwm: loaded N keybinds from hotkeys config`, `... button bindings ...`, |
| 22 | + `dwm: loaded theme from config`, `dwm: loaded N window rules from config`, |
| 23 | + plus `dwm: unknown keysym '...'` and `dwm: unknown func '...'`. |
| 24 | + |
| 25 | +## Parser limits |
| 26 | + |
| 27 | +The parser is a small line parser, not full TOML: |
| 28 | + |
| 29 | +- Arrays of inline tables: `name = [` on one line, one `{ k=v, ... }` per |
| 30 | + line, `]` alone on its line. `[[name]]` tables also work. |
| 31 | +- Values: `"string"`, `[ "string", ... ]`, or numbers. Use `1`/`0`, not |
| 32 | + `true`/`false`, inside inline tables. |
| 33 | +- Unknown keys are accepted and ignored with no warning. Check field names |
| 34 | + against the lists below. |
| 35 | +- At most 512 key/value pairs per file, counting every field inside every |
| 36 | + inline table (the shipped `hotkeys.toml` already uses about 296), 511-char |
| 37 | + strings, 32 array items, and 64 window rules. Extra entries are dropped |
| 38 | + silently, so large additions can make the last bindings vanish. |
| 39 | + |
| 40 | +## hotkeys.toml |
| 41 | + |
| 42 | +- `[vars]`: `name = "value"`; `$name` expands inside `exec` items and `cmd`. |
| 43 | + Unknown `$X` is left as is: `cmd` hands it to `/bin/sh`, but `exec` passes |
| 44 | + it literally. |
| 45 | +- `keys = [ { mod="SUPER SHIFT", key="Return", func="spawn", exec=["..."] } ]`. |
| 46 | + `key` is an X keysym name. `desc` is for the cheatsheet only. |
| 47 | +- New bindings must go inside the `keys = [ ... ]` array. The commented |
| 48 | + "CUSTOM SHORTCUTS" examples after `tag_keys` in the shipped file sit |
| 49 | + outside the array and do nothing if uncommented there. |
| 50 | +- Modifiers (space-separated): `SUPER` and `MODKEY` both mean the compile-time |
| 51 | + `MODKEY` from `config.h` (Super by default, but a user may have changed it), |
| 52 | + `SHIFT`, `CTRL`, `ALT`, `Mod2Mask`..`Mod5Mask`, `""` for none. Unknown |
| 53 | + tokens are ignored silently. |
| 54 | +- `func` values and arguments: |
| 55 | + - `spawn`: `exec=["argv", ...]` (preferred) or `cmd="shell string"` |
| 56 | + - `focusstack`, `movestack`, `incnmaster`, `focusmon`, `tagmon`: |
| 57 | + `i=1` or `i=-1`; `moveorplace` and `sigstatusbar` take an integer `i` |
| 58 | + (the shipped mouse binding uses `moveorplace` with `i=2`) |
| 59 | + - `setmfact`, `setcfact`: `f=0.05` (`setcfact` `f=0.00` resets) |
| 60 | + - `view`, `toggleview`, `tag`, `toggletag`: `ui=` tag bitmask (`-1` = all) |
| 61 | + - `setlayout`: `layout_idx` 0 tile, 1 floating, 2 monocle |
| 62 | + - no argument: `killclient`, `quit` (ends the session), `zoom`, |
| 63 | + `togglebar`, `togglefloating`, `fullscreen`, `togglefakefullscreen`, |
| 64 | + `resizemouse` |
| 65 | +- `tag_keys = [ { key="1", tag=0 } ]`: `tag` is 0-based. Each entry creates |
| 66 | + four MODKEY bindings: view, +Ctrl toggleview, +Shift tag, +Ctrl+Shift |
| 67 | + toggletag. |
| 68 | +- `buttons = [ { click="ClkClientWin", mod="SUPER", button=1, func="..." } ]`. |
| 69 | + Click targets: `ClkTagBar`, `ClkLtSymbol`, `ClkStatusText`, `ClkWinTitle`, |
| 70 | + `ClkClientWin`, `ClkRootWin`. |
| 71 | +- Before adding a binding, check its `mod` + `key` against every `keys` entry |
| 72 | + and against the four bindings each `tag_keys` entry generates (MODKEY, |
| 73 | + +Ctrl, +Shift, +Ctrl+Shift with that key; MODKEY is whatever `config.h` |
| 74 | + sets). dwm runs every matching binding, so a duplicate fires both actions. |
| 75 | + Check that the keysym exists (`xmodmap -pke` or the dwm log after saving). |
| 76 | + |
| 77 | +## window-rules.toml |
| 78 | + |
| 79 | +- `rules = [ { class="...", isfloating=1 } ]`. |
| 80 | +- Fields read: `class`, `instance`, `title` (substring matches), `tags` |
| 81 | + (1-9, 1-based; anything else means the current tag), `monitor` (index, |
| 82 | + default -1), `isfloating`, `alwaysontop`, `isterminal`, `noswallow`. |
| 83 | +- `float` is not a field; it is ignored silently. Use `isfloating=1`. |
| 84 | +- Every matching rule applies in order and assigns `isfloating`, |
| 85 | + `isterminal`, `noswallow`, and `alwaysontop`; a later match resets them. |
| 86 | + Append a specific rule after the general rules it overrides (for example |
| 87 | + after `{ class="Alacritty", isterminal=1 }`), and repeat fields such as |
| 88 | + `isterminal=1` that the general rule set. `alwaysontop=1` implies floating. |
| 89 | +- Get the class and title of a window from the live session: |
| 90 | + `xprop WM_CLASS WM_NAME` (click the window), or |
| 91 | + `xprop -id "$(xdotool getactivewindow)" WM_CLASS WM_NAME`. |
| 92 | + `WM_CLASS` prints instance first, then class. |
| 93 | + |
| 94 | +## themes.toml |
| 95 | + |
| 96 | +- `[active] theme = "<name>"` selects `[theme.<name>]`. An unknown name falls |
| 97 | + back to Nord colors without a warning. |
| 98 | +- dwm reads `normfgcolor normbgcolor normbordercolor selfgcolor selbgcolor |
| 99 | + selbordercolor` (`#RRGGBB`) and `[appearance] borderpx`. |
| 100 | +- `theme-apply.sh` reads `term_bg term_fg term_cursor term_color0`..`15`, |
| 101 | + `dark_mode`, and `gtk_theme`, then updates Alacritty, kitty, GTK, Qt, |
| 102 | + xsettingsd, and cursors. |
| 103 | +- Switch themes with `dwm-settings-theme apply <name>` or the Control Center |
| 104 | + rather than by editing `[active]`. List the theme names with |
| 105 | + `grep '^\[theme\.' ~/.config/dwm-titus/themes.toml`. |
| 106 | +- For a custom theme, copy an existing `[theme.<name>]` block under a new name |
| 107 | + and keep every key. |
| 108 | + |
| 109 | +## config.h (build time) |
| 110 | + |
| 111 | +- Holds `MODKEY`, `fonts[]`, `tags[]`, `layouts[]`, `mfact`, `nmaster`, |
| 112 | + `showbar`, `topbar`, `snap`, `cursorwarp`, `swallowfloating`, and similar. |
| 113 | + Keys, rules, and colors are not in `config.h`, even where older docs say so. |
| 114 | +- `config.h` is created from `config.def.h` only when it is missing. It is the |
| 115 | + user's file and is never overwritten by updates. |
| 116 | +- Rebuild from the checkout with `./scripts/dev-sync-install.sh` |
| 117 | + (`--check` verifies without changes). It runs `sudo make install`, then |
| 118 | + a new dwm session is required. |
| 119 | + |
| 120 | +## Generated files: do not hand-edit |
| 121 | + |
| 122 | +`~/.config/dwm-titus/` also holds files written by helpers: |
| 123 | + |
| 124 | +- `theme-env.sh`, `xsettingsd.conf`, `cursor.Xresources`: `theme-apply.sh` |
| 125 | +- `personalization.conf`: `dwm-settings-theme personalize` |
| 126 | +- `font.conf`: `dwm-settings-font` |
| 127 | +- `wallpaper.conf`: `dwm-settings-wallpaper` |
| 128 | +- `input-settings.conf`: `dwm-settings-input` |
| 129 | +- `display-profiles/`: `dwm-settings-display` |
| 130 | +- `power.conf`: `dwm-quickshell-controlcenter power-*` |
| 131 | +- `panel-widgets.conf`: `dwm-panel-settings` |
| 132 | +- `accessibility.conf`: `dwm-accessibility-settings` |
| 133 | +- `notification-settings.json`: the panel |
0 commit comments