Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invoking multiply with the same path/different file, produces no change #14

Closed
micahcowan opened this issue Aug 3, 2017 · 1 comment

Comments

@micahcowan
Copy link

micahcowan commented Aug 3, 2017

I've written (well, ported) a program that procedurally generates tiled wallpapers (not yet in npm), using the wallpaper module to optionally set it as the desktop background. A straightforward method of use would seem to be to keep invoking it to generate a new background at the same location, and then reset the wallpaper. However, the Mac OS wallpaper CLI tool doesn't allow for this mode of use, as after the first invocation, further invocations after image regenerations have no effect on the desktop background.

To be clear, this is the sort of thing I'm talking about:

let wp = require('wallpaper');
wp.set("output.png");
createNewImageFileAt("output.png");
wp.set("output.png");

Obviously, this is an artifact of the way that setDesktopImageUrl works, and not anything macos-wallpaper is doing per se... but of course users shouldn't have to be bothered with how the underlying mechanisms of the tool (or module) work - it should "just work" according to the most straightforward user expectations.

Not sure the best way to go about this. I assume there's some way to send a message to Dock to reload the wallpaper, but judging from discussion on #13 the right way to do this isn't currently known. Perhaps just flushing the setting to, I dunno, /dev/null, and then to the user-supplied argument? This probably produces an annoying sort of "flash", but it could be mitigated by only doing this if the new argument matches the pre-existing value in the db.

Obviously, my app, and other consumers of the wallpaper npm module, could just do this ourselves, instead of asking macos-wallpaper to fix it; but fixing it in one place instead of working around it in many others seems the more ideal solution.

Another point to consider is consistency across platforms - what do the Windows or Linux implementations of the wallpaper module do when they receive the same path twice (but with different actual image files)? If they behave differently than the Mac OS version, then unification would seem a good idea.

However, if you feel that this change is inappropriate, and that the current behavior should be left as-is, then I'd like to alternatively propose that the documentation be updated (here, in wallpaper-cli, and in the Node wallpaper module) to make this behavior clear.

Thanks!

@sindresorhus
Copy link
Owner

I would have expected the same behavior as you too. Not sure either what to do about it though, or how it works on other platforms.

Cool module btw.

@sindresorhus sindresorhus changed the title invoking multiply with the same path/different file, produces no change Invoking multiply with the same path/different file, produces no change Aug 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants