rawnly / splash-cli

A simple, CLI to download Unsplash wallpapers. Nothing fancy — it just works.
http://splash-cli.app?ref=github
546 stars 28 forks source link

`--save` option not working as intended (Sets the wallpaper to the hash or blur of the downloaded wallpaper) #115

Closed Sardonyx001 closed 8 months ago

Sardonyx001 commented 8 months ago

System: MacOS Sonoma 14.0 splash-cli version: 4.1.2 (73c63f0) (Installed through brew)

As the title describes, when I try something like splash --day -s with it actually sets the current space's wallpaper to the blur hash of the downloaded wallpaper.

When reviewing the code, this clearly happens at cmd/root.go#L206. Specifically at lib/blurhash/blurhash.go#L#37.

I don't see the point of having this kind of behavior with the -s (--save) flag at it sort of defeats the purpose.

This could be easily avoided with a check on saveFlag before _ = blurhash.Prepare(photo). Something like:

if !saveFlag {
    _ = blurhash.Prepare(photo)
}

I added the condition above and compiled it locally on my machine and here's the before and after:

Before:

https://github.com/rawnly/splash-cli/assets/41418470/5ca97d4d-cf92-449b-aace-3fbed86cd407

After:

https://github.com/rawnly/splash-cli/assets/41418470/26550799-819e-475b-b2af-853a066bd83b

Should I open a PR for this?

rawnly commented 8 months ago

hey thanks for reporting, i noticed this last friday but didn’t have the time to fix, if you want to open a PR i’ll be happy to review it!

The save flag check is missing on the blur hash part so your fix should be correct!

rawnly commented 8 months ago

will release this soon

Sardonyx001 commented 8 months ago

Appreciated! I really like this project if you any help just @ me!