You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/superpowers/specs/2026-05-05-settings-hooks-design.md
+7-3Lines changed: 7 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,14 @@
13
13
14
14
- Hook scripts live at `$HOME/.config/trollshell/hooks/<event>` — one file per event, no `.d/` directory, no extension required.
15
15
- The file must be a regular file with the executable bit set (`mode & 0o111 != 0`). It is invoked directly (no `sh -c` wrapping); the user's shebang decides the interpreter.
16
-
- v1 fires exactly one event: `theme-changed`. Future events (`network-up`, `power-state`, etc.) drop into the same directory under different names.
16
+
- v1 shipped one event, `theme-changed`; more slot into the same directory under different names as callers are added (the API itself is unchanged). Fired events so far:
17
+
-`theme-changed` (`theme::set`) — the desktop theme flipped.
18
+
-`place-changed` (`places::resolve_loop`) — the resolved current place transitioned (Wi-Fi fingerprint / GeoClue presence). Deduped on the place **name**, and the first resolution after startup is silent, so login stays quiet and GeoClue jitter within one place doesn't re-fire (#235).
17
19
- Inputs are passed as environment variables, never as positional args:
18
20
-`TROLLSHELL_EVENT=<event-name>` — always present
19
-
- Event-specific vars set by the caller. For `theme-changed`: `TROLLSHELL_THEME=light` or `TROLLSHELL_THEME=dark`.
21
+
- Event-specific vars set by the caller:
22
+
-`theme-changed`: `TROLLSHELL_THEME=light` or `TROLLSHELL_THEME=dark`.
23
+
-`place-changed`: `TROLLSHELL_PLACE=<place name>` and `TROLLSHELL_PLACE_STATION=<station id>` (empty when the place has no configured station, e.g. "away").
20
24
-`$HOME` resolution mirrors `theme.rs::config_subdir`: `$HOME/.config/...` directly, no `$XDG_CONFIG_HOME`. If both files later need XDG support, both get upgraded together.
21
25
22
26
### `hooks::run` API
@@ -112,4 +116,4 @@ No integration test for `theme::set` → `hooks::run`. The wire-up is a single l
112
116
- Positional args / arg-parsing.
113
117
- OSD or settings-panel surfacing of hook failures.
114
118
-`$XDG_CONFIG_HOME` resolution (would be a one-shot upgrade across `theme.rs` and `hooks.rs` together).
115
-
-Other events: `network-up`, `power-state`, `lock`, etc. The contract is designed so they slot in by adding a new caller; `hooks::run` itself does not need to change.
119
+
-Further events: `network-up`, `power-state`, `lock`, etc. The contract is designed so they slot in by adding a new caller; `hooks::run` itself does not need to change. (`place-changed` was the first such addition — see the event list above.)
0 commit comments