anufrievroman/waypaper

add custom command to run after wallpaper is set

Closed this issue · 7 comments

Add a way to run a command after a wallpaper has been set, for use with pywal or some other thing like that, sort of like https://github.com/deviantfero/wpgtk. You would also want to add a variable that is the name of the wallpaper.

Interesting idea! I'll make it as a config entry.
About the variable, could you elaborate? Do you mean a global system variable or something else?

Alright, I added an option post_command to do something after wallpaper is changed. Could you try installing from the main:

pipx install git+https://github.com/anufrievroman/waypaper

and adding to your waypaper config something like:

post_command = echo "hello world!" or anything you'd like to do?

I suspect we may need to add a delay or something like that to make it work with pywall.

Interesting idea! I'll make it as a config entry. About the variable, could you elaborate? Do you mean a global system variable or something else?

A variable only available in the config that I can use in the command to represent the path to the wallpaper. Something like: post_command = wal -n -i $wallpaper where $wallpaper == /path/to/wallpaper.

Alright, I added an option post_command to do something after wallpaper is changed. Could you try installing from the main:

pipx install git+https://github.com/anufrievroman/waypaper

and adding to your waypaper config something like:

post_command = echo "hello world!" or anything you'd like to do?

I suspect we may need to add a delay or something like that to make it work with pywall.

I installed it and it works as intended, no delay is necessary for pywal and if the user does need a delay they can just use sleep. Maybe add a way to change whatever shell it uses? There shouldn't be any need to add any more features because the user can just implement whatever they need in a script. All they need is a $wallpaper variable.

Ah, I see what you mean. I am not sure if python configparser support variables, but in the worst case I guess we could just use some word that I'll manually parse. I'll look into it.

Okay, actually you can use ${wallpaper} as such variable in config, but the problem is that it would read the previous wallpaper that was in config when application launched, which is not what you expect I guess. You want to use new, just selected wallpaper, right?

So I reimplemented it so that $wallpaper in the post_command will be replaced with the full path to the wallpaper that was just selected. You can already check it in the main.

Okay, actually you can use ${wallpaper} as such variable in config, but the problem is that it would read the previous wallpaper that was in config when application launched, which is not what you expect I guess. You want to use new, just selected wallpaper, right?

So I reimplemented it so that $wallpaper in the post_command will be replaced with the full path to the wallpaper that was just selected. You can already check it in the main.

Thanks! And thanks for the quick reply as well, I'll go test this out now.

Works as intended, thanks!