sindresorhus / wallpaper

Manage the desktop wallpaper
MIT License
1.05k stars 92 forks source link

Crashes on GNOME #18

Closed fa7ad closed 7 years ago

fa7ad commented 8 years ago

I get this error when I run

wallpaper.get().then(console.log)

Error:

UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Command failed: gsettings get org.cinnamon.desktop.background picture-uri
No such schema 'org.cinnamon.desktop.background'

First I thought it was a bug on my fork, so I tried pulling from your repo, and then I tried installing the package from npm again. Same problem, my guess is that the command for Cinnamon somehow replaces the command for GNOME (probably because they both use gsettings).

fa7ad commented 8 years ago

UPDATE: just as I expected, moving the block for cinnamon above the command for GNOME "fixes" it.

Sohail05 commented 8 years ago

@fa7ad As you may have already figured out, it iterates over the list and picks the last valid cmd. Moving the block would break it for "cinnamon" environment.

Your "feature proposal" is a valid workaround but wouldn't make it an out of the box solution (environment agnostic).

Just a few ideas:

fa7ad commented 7 years ago

@sindresorhus this looks promising, but I don't think execFile supports piping output to a different command. Can you think of a way to handle this?

sindresorhus commented 7 years ago

I don't see why you need piping at all. Execute gsettings list-schemas and use JS to get the desktop.background from the result.

fa7ad commented 7 years ago

@sindresorhus so, this has to be executed during the app detection process correct?

sindresorhus commented 7 years ago

@fa7ad Yes

fa7ad commented 7 years ago

PR #17