lightswitch is a small Unix-style tool for switching desktop applications between light and dark mode by running configured shell scripts.
lightswitch --dark
lightswitch --light
lightswitch --toggleManage active scripts:
lightswitch --activate terminal
lightswitch --activate editor --prio 10
lightswitch --deactivate terminal
lightswitch --renumberPrint log output to the terminal as well as the system log:
lightswitch --toggle --debugConfiguration lives in:
$XDG_CONFIG_HOME/lightswitchIf XDG_CONFIG_HOME is not set, Go's platform config directory is used.
Directory layout:
lightswitch/
scripts/
lightswitch.d/
state
scripts/ contains executable scripts. Each script receives one argument:
dark
light
lightswitch.d/ contains symlinks to active scripts. Active entries may be prefixed with a priority:
20-terminal
25-editor
Lower priorities run first. Entries with the same priority run alphabetically. Entries without a priority run last.
Example script:
#!/bin/sh
echo "Switching terminal to $1"Install it:
mkdir -p "$XDG_CONFIG_HOME/lightswitch/scripts"
cp examples/scripts/terminal "$XDG_CONFIG_HOME/lightswitch/scripts/terminal"
lightswitch --activate terminallightswitch --toggle stores the current mode in:
$XDG_CONFIG_HOME/lightswitch/state
If no state file exists, toggle assumes the current mode is light and switches to dark.
Run tests:
go test ./...Build:
go build .