hexive / sunpaper

Dynamic wallpaper changes based on the sun.
https://github.com/hexive/sunpaper
Apache License 2.0
197 stars 7 forks source link

Suggestion: symbolic link to the current theme #2

Closed hathawaydave closed 3 years ago

hathawaydave commented 3 years ago

Each of the four themes are attractive. The current code uses static folder paths to choose which to use:

#Set full path to your local dynamic wallpaper folder
#no ending folder slash /
#wallpaperPath="$HOME/sunpaper/images/The-Beach"
#wallpaperPath="$HOME/sunpaper/images/The-Cliffs"
#wallpaperPath="$HOME/sunpaper/images/The-Lake"
wallpaperPath="$HOME/sunpaper/images/The-Desert"

This means the source must be edited to change the theme. When using systemctl for a scheduled task, you need to disable the service, change the script, then enable the service again.

A better solution is to simply create a link to the folder. In the same folder as the themes ($XDG_DATA_HOME/sunpaper/images for me), issue this command:

ln -s The-Desert current

Then, when you list files, the "current" points to the selected theme:

..sunpaper/images on  main [!?] ➜ la
Permissions Size User   Date Modified Name
drwxr-xr-x     - dave   27 Feb  5:31  The-Beach/
drwxr-xr-x     - dave   27 Feb  5:32  The-Cliffs/
drwxr-xr-x     - dave   27 Feb  5:32  The-Desert/
drwxr-xr-x     - dave   27 Feb  5:32  The-Lake/
lrwxrwxrwx    10 dave   27 Feb  9:47  current -> The-Desert

In your script, simply point to this link:

#Set full path to your local dynamic wallpaper folder
#no ending folder slash /
#wallpaperPath="$HOME/sunpaper/images/The-Beach"
#wallpaperPath="$HOME/sunpaper/images/The-Cliffs"
#wallpaperPath="$HOME/sunpaper/images/The-Lake"
#wallpaperPath="$HOME/sunpaper/images/The-Desert"
wallpaperPath="$HOME/sunpaper/images/current"

If you want to point to a different theme, just change the link. You don't have to stop the service or modify the script.

hexive commented 3 years ago

Would an option flag that could set the theme also work for the systemd case?

sunpaper.sh -t the-beach or supaper.sh -t the-cliffs for example?

I'm thinking it might be too much to ask new users to set a folder link before they can get things working. ???

hathawaydave commented 3 years ago

I think you are right, that it is asking a lot for new users. It isn't too much for themers though.

Your idea of adding it as a switch would be useful, for sure.

hexive commented 3 years ago

Thanks again for passing this along.

I added your symbolic link instructions to the wiki documentation.

And based on another suggestion, there's also now an option to have an external configuration file at ~/.config/sunpaper/config

I haven't fully groked systemd, but maybe that would also be useful for making confg changes without shutting down the service.