dylanaraps / pywal

🎨 Generate and change color-schemes on the fly.
MIT License
8.34k stars 325 forks source link

Need help with custom wallpaper setter #574

Open ghost opened 3 years ago

ghost commented 3 years ago

Thank you for your work. I wanted pywal to run automatically whenever the wallpaper is changed in gnome (via setting or wallpaper apps like fondo). I have tried running gsettings get/gsettings monitor to get the path of the current wallpaper but have failed to find an efficient way of using automatically updating the terminal colors on wallpaper change.

help would be greatly appreciated.

ghost commented 3 years ago

to be clear... im currently using the following in my .zshrc

wal -q -i "$(gsettings get org.gnome.desktop.background picture-uri | grep -oP "://\K.*" | rev | cut -c2- |rev)"

I do not want to use wal to set the wallpaper, however, I'd like to know of a method to run wal whenever the wallpaper is changed via any other application. so that my currently opened applications (vs code/gnome-terminal/alacritty) are automatically themed on wallpaper change.

thanks!

KiranWells commented 3 years ago

Are you able to get the wallpaper successfully with that command? If you just need to find a good way to run it, you could try watching the file where gnome settings are stored (try this post for reference) and running the script when the file changes. I know tail has a -F option that follows the file and updates when it is changed; maybe there is another program that does something similar for scheduling.

Of course, the brute-force way to do it would be to simply run a check every second or so and run pywal if the file has changed.