CLI reference
The workspace produces one binary, theme-agent.
Commands
Section titled “Commands”| Command | Behavior |
|---|---|
daemon [--log-level L] [--config PATH] |
Run the headless daemon in the foreground. |
status [--json] |
Read current daemon state. |
set <light|dark|system|sun|auto> |
Change the running mode without persisting the default. |
subscribe [--json] |
Stream daemon events until interrupted. |
config path |
Print the active platform configuration path. |
config show [--json] |
Print parsed configuration. |
config set mode <mode> |
Persist the default mode and reload a reachable daemon. |
config set fallback <light|dark> |
Persist the fallback and reload. |
config set location <lat> <lon> |
Persist coordinates and reload. |
service <install|update|uninstall|start|stop|restart|status> |
Manage user-level daemon and tray entries. |
tray |
Run the native tray process; available with the default tray feature. |
config set ... edits TOML and live-reloads a running daemon. See Configuration for the schema and validation rules.
Output contracts
Section titled “Output contracts”Human output is intended for interactive terminals. For integrations, use status --json, config show --json, subscribe --json, or the local NDJSON protocol. Those JSON representations are the machine-facing contract.
CLI failures use structured project errors. When a command requested JSON, failures are formatted as JSON rather than mixed with human prose.
User service lifecycle
Section titled “User service lifecycle”theme-agent service installtheme-agent service statustheme-agent service restarttheme-agent service updatetheme-agent service stoptheme-agent service starttheme-agent service uninstallinstall and update register the current binary, preserve configuration, enable startup at login, and start the user-level service without root or administrator access. With the tray feature, installation manages both daemon and tray login entries; uninstall removes both entries but does not delete user configuration.
Tray feature and behavior
Section titled “Tray feature and behavior”The optional Cargo feature tray is enabled by default. A --no-default-features build contains the headless daemon and CLI but has no tray command or tray autostart entry.
The tray runs as a separate thin IPC client. Its GUI main thread owns the event loop while worker tasks communicate with the daemon. Start it directly with:
theme-agent trayThe menu:
- displays the current effective theme;
- selects
Light,Dark,System,Sun, orAutomode; - opens
config.tomlin the default application, creating it if absent; - requests an explicit configuration reload;
- quits only the tray, leaving the daemon running.
The tray follows live subscription events. If no daemon is available, it attempts to start the managed service or spawn a detached daemon before connecting.