How this must work. 1. On first launch themere reads ~/.config/themer/config and aquires list of apps it should manage 2. 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 3. 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/ # creates app config directory if it does not exist (else no-op) rm -f ~/.config// # tries to delete the config if it exists (else no-op) ln -s ~/.config/themer/// ~/.config// # 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. 4. 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: 0. Update README.md, make app usable for a random person on the internet. 1. implement backup 2. parse cli args in a decent way 3. implement behaviour discussed above 4. Think of config options: configure ability to merge several files; map contents of theme dir to specific files Wider TODO: 1. Think of this app as a user context switcher, not only theme manager.