sindresorhus / wallpaper

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

Add support for nitrogen on linux #17

Closed fa7ad closed 7 years ago

fa7ad commented 8 years ago

This is popular among people who use tiling window managers (specially i3 users)

sindresorhus commented 8 years ago

Is there any way to get the wallpaper with nitrogen?

fa7ad commented 8 years ago

Not that I know of, besides reading the config file.

A simple way to do that would be,

grep -m 1 -oP '(?<=file=).*' ~/.config/nitrogen/bg-saved.cfg 

Or, if you want more portability,

sed -n 's/^file=//p' ~/.config/nitrogen/bg-saved.cfg | tail -n 1

^ the tail bit and -m 1 is there to make sure it returns only one file name. Nitrogen can be launched from different environments and the configs are stored separately. But for most use cases, the last match is the last used settings and is likely what the user is looking for. but, I think these transformations are better handled in JS. no idea how to implement it though.

fa7ad commented 8 years ago

Do you have any suggestions on how a different command can be used to get values? With the current API, that doesn't seem to be possible.

sindresorhus commented 8 years ago

You could add manual workaround here https://github.com/sindresorhus/wallpaper/blob/72f0843eec44af76310e6ad3c87c85d8b63d82ed/lib/linux.js#L126 if app is nitrogen.

sindresorhus commented 8 years ago

ping :)

fa7ad commented 8 years ago

totally forgot about it, thanks for the ping. gonna make the commit asap :smile:

fa7ad commented 8 years ago

I think now you can merge it.

sindresorhus commented 8 years ago

Can you look into the feedback from @Sohail05?

fa7ad commented 8 years ago

@sindresorhus I will fix those as soon as I get some time. FWIW, I think this solution is very fragile. I'll try to re-iterate and maybe use node's fs module for get instead of relying on sed.

sindresorhus commented 8 years ago

I'll try to re-iterate and maybe use node's fs module for get instead of relying on sed.

👍

fa7ad commented 7 years ago

I think all the changes have been made, please re-check

sindresorhus commented 7 years ago

You need to fix the promise chaining for the set function too.

fa7ad commented 7 years ago

@sindresorhus should be okay now. Couldn't test it myself this time.

fa7ad commented 7 years ago

BUMP!

sindresorhus commented 7 years ago

@fa7ad I'm not super confident in the changes, especially since you haven't tested it, but I'll try to give it a thorough review.

fa7ad commented 7 years ago

@sindresorhus yeah sorry about that. I don't use GNOME or Cinnamon anymore. So, I'm not able to physically test it. Maybe someone who uses those systems can help out. But the changes are minimal and should work. Do give it a review though :smile: