A theme switcher to automatically change application themes based on KDE global theme.
Currently, only alacritty terminal emulator and micro text editor are supported.
theme-switcher.mp4
You can define custom KDE theme - app theme mappings as you wish.
For traditional Linux users
- Download Nushell v0.104 from here.
- Clone this repository:
git clone https://github.com/rayanamal/kde-app-dynamic-theme.git- Extract the binary (the file named 'nu') from the archive, and put it somewhere, preferably into the repo you just cloned.
- Open
theme-switcher.nuin your text editor.
- Edit the constants at the start if you need to, as explained in the file.
- Edit the KDE theme -> app theme mappings to match your preferences.
- Open
theme-switcher.servicefile in your editor, and put in the location of thenubinary and the script, as explained. - Create
~/.config/systemd/user/directory if it doesn't exist. - Put
theme-switcher.pathandtheme-switcher.serviceinto~/.config/systemd/user/:
mv theme-switcher.path theme-switcher.service ~/.config/systemd/user/- Run these commands:
systemctl --user daemon-reload
systemctl --user enable theme-switcher.path
systemctl --user start theme-switcher.path- Enjoy. If it didn't work for you, open an issue, and I'll do my best.
For NixOS users
- Download
theme-switcher.nuscript.
curl -LO https://raw.githubusercontent.com/rayanamal/kde-app-dynamic-theme/refs/heads/main/theme-switcher.nu- Open
theme-switcher.nuin your text editor.
- Edit the constants at the start if you need to, as explained in the file.
- Edit the KDE theme -> app theme mappings to match your preferences.
- Add the below to your
configuration.nix. Fix the part inFIXME:
systemd.user.paths.theme-switcher = {
wantedBy = [ "default.target" ];
pathConfig.PathChanged="%h/.config/kdeglobals";
};
systemd.user.services.theme-switcher = {
## FIXME fix the path to point to the real location of the script.
script = "/home/username/.config/nushell/scripts/theme-switcher.nu";
path = [ pkgs.nushell ];
};- Enjoy. If it didn't work for you, open an issue, and I'll do my best.
Note that this doesn't guarantee nu version will stay same, and thus may break in the future.
I welcome contributions.