Closed fa7ad closed 7 years ago
Is there any way to get the wallpaper with nitrogen
?
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.
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.
You could add manual workaround here https://github.com/sindresorhus/wallpaper/blob/72f0843eec44af76310e6ad3c87c85d8b63d82ed/lib/linux.js#L126 if app
is nitrogen.
ping :)
totally forgot about it, thanks for the ping. gonna make the commit asap :smile:
I think now you can merge it.
Can you look into the feedback from @Sohail05?
@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.
I'll try to re-iterate and maybe use node's fs module for get instead of relying on sed.
👍
I think all the changes have been made, please re-check
You need to fix the promise chaining for the set
function too.
@sindresorhus should be okay now. Couldn't test it myself this time.
BUMP!
@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.
@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:
This is popular among people who use tiling window managers (specially i3 users)