Set the themes for generic applications and frameworks.
Themes and the way how the themes are changed are defined in the config file
~/.config/switch-theme/switch-theme.toml
.
There are three major categories:
- Aliases
- Themes
- Apps
An example can be found in example/switch-theme.toml
.
It's possible to set an alias to a specific theme. E.g. this can be used to define the standard dark and light theme:
[aliases]
light = "onehalf-light"
dark = "ayu-dark"
dimmed-dark = "onehalf-dark"
A theme defines the theme name used for each application:
[themes.onehalf-dark]
fallback = "dark"
alacritty = "onehalf-dark"
bat = "OneHalfDark"
gtk = "Adwaita-dark"
In the example there are three applications defined, which behavior is defined under
[apps.alacritty]
[apps.bat]
[apps.gtk]
A special option is fallback
, which references to another theme. In the
example the fallback theme is defined under themes.dark
. The fallback
option
is not recursive and only followed once.
A theme together with its fallback must define themes for all applications defined.
For each application there are two different modi:
- Search and replace
- Executing a command
The script will replace the value of pattern
with the value of replace
in
the file defined under file
. Thereby {}
of the field replace
will be
replaced by the string defined under the theme.
[apps.bat]
file = "~/.config/fish/functions/bat.fish"
pattern = ' --theme=.* '
replace = ' --theme="{}" '
If switching the theme to onehalf-dark the pattern --theme=.*
is replaced
in ~/.config/fish/functions/bat.fish
will be replaced with
--theme="OneHalfDark"
.
A command will execute the provided string with the theme name appended.
[apps.gtk]
command = "gsettings set org.gnome.desktop.interface gtk-theme"
If switching the theme to onehalf-dark the command
gsettings set org.gnome.desktop.interface gtk-theme Adwaita-dark
is executed.