Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lightswitch

lightswitch is a small Unix-style tool for switching desktop applications between light and dark mode by running configured shell scripts.

Usage

lightswitch --dark
lightswitch --light
lightswitch --toggle

Manage active scripts:

lightswitch --activate terminal
lightswitch --activate editor --prio 10
lightswitch --deactivate terminal
lightswitch --renumber

Print log output to the terminal as well as the system log:

lightswitch --toggle --debug

Configuration

Configuration lives in:

$XDG_CONFIG_HOME/lightswitch

If 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.

Scripts

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 terminal

State

lightswitch --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.

Development

Run tests:

go test ./...

Build:

go build .

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages