2.7 KiB
2.7 KiB
How this must work.
- On first launch themere reads ~/.config/themer/config and aquires list of apps it should manage
- Themer backs up whole config directories to ~/.config/themer so further manipulations are safe Default name is themer/original, but user can provide a different name from command line.
example: themer backup [--name ] [--apps TODO] default name is "original" default apps list is read from config. command line overrides config completely, no merging.
Backup algorithm:
- If directory ~/.config/sway does not exist or is empty will do nothing
- if directory exists AND not empty then create directory ~/.config/themer/original/sway
- copy contents of all files AND direcotries in it to ~/.config/themer/original/sway
- if any file failed to copy - rollback and remove ~/.config/themer/original/sway
- remove original files (and directories) from ~/.config/sway
- create symlinks to copied files in ~/.config/sway
- Swithing algorithm: User requests theme change with: themer apply
Themer tries to apply configs as follows:
- looks up a list of apps it should manage; if list is empty - return non-zero
- looks up requested theme name in ~/.config/themer/; if not found - return non-zero
- looks up config dir ~/.config/themer//; if none found - return non-zero
- for each in ~/.config/themer// themer does
mkdir -p ~/.config/<app> # creates app config directory if it does not exist (else no-op)
rm -f ~/.config/<app>/<filename> # tries to delete the config if it exists (else no-op)
ln -s ~/.config/themer/<theme>/<app>/<filename> ~/.config/<app>/<filename> # symlinks the file from requested theme user dir
- after creating symlinks themer tries to let the app know that config changed
- if app has hot-reload (niri, alacritty, hyprland) - do nothing
- if app re-reads configs on start (fuzzel, wofi) - do nothing
- if app obeys USR1/URS2 - issue the signal
- if app is a systemd service - exec systemctl --user restart
This way a single copy of config files are kept in ~/.config/themer. This way user can choose which files to manage themselves and which themer should manage.
- cli interface themer list - returns newline-separated list (suitable for dmenu) themer apply $(themer list | fuzzel -d) - a usable way to select theme with dmenu-like apps
TODO:
- Update README.md, make app usable for a random person on the internet.
- implement backup
- parse cli args in a decent way
- implement behaviour discussed above
- Think of config options: configure ability to merge several files; map contents of theme dir to specific files
Wider TODO:
- Think of this app as a user context switcher, not only theme manager.