Skip to content

chore: own sketchybar's launchd agent, mirror two app-written configs - #161

Merged
gapul merged 2 commits into
mainfrom
declare-strays-round2
Aug 8, 2026
Merged

chore: own sketchybar's launchd agent, mirror two app-written configs#161
gapul merged 2 commits into
mainfrom
declare-strays-round2

Conversation

@gapul

@gapul gapul commented Aug 8, 2026

Copy link
Copy Markdown
Owner

#160 の続き。実機にあって宣言されていなかったものを片付ける。

sketchybar を launchd に載せた

formula は宣言されていたけど、起動しているのは brew services start sketchybar を一度手で叩いて作られた homebrew.mxcl.sketchybar.plist だった。リポジトリのどこにも書かれていないので、まっさらな mac を rebuild してもバーが出ない状態だった。兄弟の borders は既に launchd.agents.borders で宣言済みなので、そこに揃えた。

  • launchd.agents.sketchybar を darwin-chrome.nix に追加。PATH と LANG は brew の plist が持っていたものをそのまま移した(launchd は PATH が空で起動するので、sketchybarrc から呼ぶ media-control や displayplacer が解決できなくなる)
  • home.activation.sketchybarBrewService で brew service を停止して plist を削除。2回目以降は no-op
  • darwin.nix のコメントも (b) brew service から (a) launchd agent に更新

OmniWM と CodexBar の設定をミラーで追跡

どちらも home.file にはできない。アプリ自身が書き戻すファイルで、store の読み取り専用シンボリックリンクにすると設定を保存できなくなる。実際 settings.toml はキーがソート済み、float がフル精度 (0.979300037944676)、バージョン間でキーが増減していて、明らかにアプリの出力だった。

なので obsidian-snapshot と同じ片方向ミラー方式にした。

  • configs/wm/omniwm/settings.tomlconfigs/apps/codexbar/config.json を追加、それぞれ README 付き
  • just app-snapshot でライブ → リポジトリの一方通行。差分がなければ何もしない
  • このリポジトリは public なので、CodexBar の providers[].codexActiveSource(Codex アカウントの UUID)はスナップショット時に jq で落としている

検証

  • nix build .#homeConfigurations.gapul.activationPackage 成功。生成された org.nix-community.home.sketchybar.plist を plutil で確認(ProgramArguments / PATH / KeepAlive とも意図どおり)
  • just app-snapshot を2通り実走。差分なしの経路と、わざとリポジトリ側を書き換えた差分ありの経路の両方
  • just fmt (deadnix / gitleaks / nixfmt / shellcheck) 全部 Pass

別件、要確認

~/.config/gh-dash/config.yml~/.config/slk/config.toml が、#153 で宣言済みなのに実機ではリンクされず素のファイルのままだった。現行世代の home-manager-files には両方入っているのに、8/8 12:50 の activation で張られた 61 本のリンクに含まれていない。.hm-bak も残っていない。中身はリポジトリ側と完全に一致しているので実害はないけど、宣言が黙って効いていないのは気持ち悪い。ライブ側を退避すれば次の rebuild で張られるはずなので、必要なら別途。

sketchybar's formula was declared but nothing started it — the bar only ran
because `brew services start` had been typed on this machine once, so a fresh
mac came up with no bar. Own the daemon like borders does, and stop the brew
service on activation.

OmniWM's settings.toml and CodexBar's config.json are rewritten by the apps
themselves, so home.file would break them. Track them as one-way mirrors
(`just app-snapshot`), same contract as obsidian-snapshot.
@gapul
gapul merged commit 1d245e4 into main Aug 8, 2026
3 checks passed
@gapul
gapul deleted the declare-strays-round2 branch August 8, 2026 09:02
gapul added a commit that referenced this pull request Aug 8, 2026
The squash-merge of #161 made git see the same agent arriving from both sides,
so darwin-chrome.nix ended up with two launchd.agents.sketchybar blocks (a
duplicate-attribute error) and borders was reverted to exec'ing the $HOME path
instead of the store one.
gapul added a commit that referenced this pull request Aug 8, 2026
* chore: own sketchybar's launchd agent, mirror two app-written configs

sketchybar's formula was declared but nothing started it — the bar only ran
because `brew services start` had been typed on this machine once, so a fresh
mac came up with no bar. Own the daemon like borders does, and stop the brew
service on activation.

OmniWM's settings.toml and CodexBar's config.json are rewritten by the apps
themselves, so home.file would break them. Track them as one-way mirrors
(`just app-snapshot`), same contract as obsidian-snapshot.

* refactor(nix): replace the scripted bits with declared ones

- Skim/Puddle prefs and the security-update defaults move from hand-rolled
  `defaults write` loops to system.defaults.CustomUserPreferences /
  CustomSystemPreferences, which is the same write, declared.
- nix.custom.conf stops being five append-if-grep-misses blocks and becomes one
  regenerated marked block, so a rotated cache key replaces the old line instead
  of stacking on top of it.
- borders/theme-watch move into the store, so the running agent belongs to a
  generation instead of to whatever is on disk.
- The four one-shot legacy-plist migrations become one dated list.
- The three restic scripts, duplicated across the darwin and linux modules, move
  into lib/restic-common.nix; the modules keep only launchd vs systemd.
- The launchd agent helper, copy-pasted in maintenance and restic, moves to lib.
- `nh home switch` gets -b hm-bak so a newly declared home.file whose target
  already exists actually gets linked.
- Login item registration reports failures instead of swallowing them, and the
  redundant brew trust pass is dropped from rebuild (upgrade still needs it).

* docs: regenerate for app-snapshot

* fix: drop the sketchybar agent duplicated by the merge

The squash-merge of #161 made git see the same agent arriving from both sides,
so darwin-chrome.nix ended up with two launchd.agents.sketchybar blocks (a
duplicate-attribute error) and borders was reverted to exec'ing the $HOME path
instead of the store one.
gapul added a commit that referenced this pull request Aug 8, 2026
…ice label (#165)

* fix(sketchybar): drop the aerospace leftovers and the stale brew service label

aerospace was removed in #125 but the sketchybar helpers still called
/opt/homebrew/bin/aerospace. wm.sh fell back to that binary whenever OmniWM was
not running, so instead of failing it quietly returned nothing and the bar went
blank; refresh-displays.sh depended on it outright and could not work at all.

Also two labels that #161 invalidated: `just restart sketchybar` and
app_guard's restart command still pointed at homebrew.mxcl.sketchybar, which no
longer exists now that the agent is org.nix-community.home.sketchybar.

Puddle is added to the app_guard list — it had silently not been running, which
is exactly what that list is for.

Kept as-is: the aerospace_workspace_change event name, the AEROSPACE_* env vars
and /tmp/sketchybar-aero-display.map. They are consistent between the firing
side and the reading side, so renaming changes no behaviour and only widens the
diff.

* refactor(sketchybar): rename the aerospace-era identifiers to omniwm

Event aerospace_workspace_change -> omniwm_workspace_change, AEROSPACE_* ->
OMNIWM_*, /tmp/sketchybar-aero-display.map -> sketchybar-omniwm-display.map.
Both the firing side (omniwm-event.sh) and every reading side are renamed in
the same commit; a half rename would leave the event reaching nobody.
gapul added a commit that referenced this pull request Aug 8, 2026
* fix(sketchybar): drop the aerospace leftovers and the stale brew service label

aerospace was removed in #125 but the sketchybar helpers still called
/opt/homebrew/bin/aerospace. wm.sh fell back to that binary whenever OmniWM was
not running, so instead of failing it quietly returned nothing and the bar went
blank; refresh-displays.sh depended on it outright and could not work at all.

Also two labels that #161 invalidated: `just restart sketchybar` and
app_guard's restart command still pointed at homebrew.mxcl.sketchybar, which no
longer exists now that the agent is org.nix-community.home.sketchybar.

Puddle is added to the app_guard list — it had silently not been running, which
is exactly what that list is for.

Kept as-is: the aerospace_workspace_change event name, the AEROSPACE_* env vars
and /tmp/sketchybar-aero-display.map. They are consistent between the firing
side and the reading side, so renaming changes no behaviour and only widens the
diff.

* refactor(sketchybar): rename the aerospace-era identifiers to omniwm

Event aerospace_workspace_change -> omniwm_workspace_change, AEROSPACE_* ->
OMNIWM_*, /tmp/sketchybar-aero-display.map -> sketchybar-omniwm-display.map.
Both the firing side (omniwm-event.sh) and every reading side are renamed in
the same commit; a half rename would leave the event reaching nobody.

* chore(wallpaper): drop the HTML/JS wallpapers, keep only Metal

Puddle renders the .metal shaders natively — lsof shows it holding globe.metal
open with the Metal shader caches, and it sits at ~1% CPU, which an HTML canvas
polling state.js every 300ms would not. The six .html files and system-theme.js
were left over from the WebView era and nothing reads them.

With them go the state.js writer in omniwm-event.sh (a gitignored file inside
the repo that the WM rewrote on every workspace switch) and its .gitignore
entry. Workspace linkage now runs solely through the inputs files that the
Metal contract reads.

Puddle's own websites list still holds four file:// entries pointing at the
deleted HTML. They are app-side state, not rendered, and harmless; clear them
from Puddle's settings when convenient.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant