Registered Member
|
Hi,
I wonder is it possible to get/set the current wallpaper via the command line? I saw viewtopic.php?f=15&t=66064&hilit=get+current+wallpaper where the dbus call is explained to reload the configuration. (Didn't want to hijack the thread). But I either want: 1) To be able to set the wallpaper via the command line 2) To be able to get the wallpaper via the command line 3) Call a script after the wallpaper changes I want to darken a background for conky to get a darker bg which is set by feh. Currently I just hardcode the wallpaper and after every KDE login I convert that background from color to b/w. If option 3 is available I only need to call the script once (when the bg has changed. PS. Using KDE 4.3
waterkip, proud to be a member of KDE forums since 2008-Oct.
|
KDE Developer
|
hmm... can't you simply select your own picture from the desktop settings dialog?
ruphy, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Sorry? I don't understand you.
This is what I have.
The KDE 4.3 part is not working. Now I saw online some posts claiming you can retreive it from a plasmarc file, by doing
But I get too much results, including wallpapers I do not use. I want to select a wallpaper within KDE and then have something telling me (the script) that the wallpaper has changed, so it can run and update the wallpaper set by feh.
waterkip, proud to be a member of KDE forums since 2008-Oct.
|
KDE Developer
|
sorry, I'm not sure i get it.
can't you simply select $HOME/.conkybg.png as wallpaper image? I assume the image that you will want will always be found there. the background is iirc also cached, so you might want to clear the relevant files into $KDEHOME/cache-$(hostname)/ where $KDEHOME is usually .kde or .kde4.
ruphy, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
No, the .conkybg.png is a darker background then my own. I need it because conky uses fake transparency, so it just takes a copy of the root wallpaper. However, KDE uses a different window and not the root. So I want to grab the KDE wallpaper, make it darker (conky doesn't support shading) and use feh to set it as a root wallpaper, which then gets used by conky. Making it look like conky is really cool. So when a KDE wallpaper changes I need to update the script to use the same wallpaper as KDE. If I can extract that data from KDE I can do this without having to set it in the script. I just want something like: $ kde --get-wallpaper /home/user/path/to/wallpaper and/or $ kde --set-wallpaper /home/user/path/to/wallpaper
waterkip, proud to be a member of KDE forums since 2008-Oct.
|
KDE Developer
|
ah, ok, i see!
for set is somewhat difficult, while if you just want to get it you could try to parse .kde4/share/config/plasma-desktop-appletsrc, and find the right section of the form [Containment][$id][Wallpaper][image] just open the file in a text editor, it should be easy enough.
ruphy, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
Easy? Have you seen that file? I have no idea how I can extract the correct wallpaper of the correct id of the currently active wallpaper. A simple grep will not work, since many many wallpapers (often duplicates) are shown...
Perhaps I need to read the code of the plasma to figure out how it picks the correct section..
waterkip, proud to be a member of KDE forums since 2008-Oct.
|
KDE Developer
|
there is not any duplicacy, each of those lines corrisponds to a different containment. just get the one that you want, or change them all.
ruphy, proud to be a member of KDE forums since 2008-Oct.
|
Registered Member
|
That is not really portable across KDE users... Eitherway, fixed for me by doing this, although a nicer way would be appreciated, like the KDE3.5 way.
|
Registered Member
|
In KDE 4.4.2 it looks like the wallpaper variable doesn't give you the full path to the actual image. That path is actually a directory. So if grep returns your wallpaper as "/usr/share/wallpapers/FOO", the actual wallpaper images are in "/usr/share/wallpapers/FOO/contents/images" and there are multiple images there, apparently one for each resolution. So now the question is, is there a command-line way to get the current screen resolution? Oh, and by the way, it looks like the file type of plasma-desktop-appletsrc is now incorrectly reported as 'binary' so the grep statement should be:
...in order for you to get the actual matching strings in your output. |
Registered Member
|
Okay, here's how you get your current wallpaper in KDE 4.4.2. It'll probably totally break when you upgrade anything or add some new eyecandy package or breathe on it wrong, but it works for now.
Now the question is, what's the most efficient thing to do with FOO? The nobrainer would be to redirect the output to a file that conky reads everytime it cycles. But from a performance point of view, shouldn't I store it in an environment variable? Is there a way to set a global environment variable for already-running processes? And either one is better than actually running the whole thing every time conky cycles, because it's not as if users change screens that often. Is there a way to run a shell script automatically every time the screen resolution or wallpaper changes? Thanks. |
Registered Member
|
D'oh, I'm wrong. There isn't a 1-to-1 correspondence between the resolution and the wallpaper chosen, and (should have realized) most resolutions don't have a corresponding wallpaper. So I guess I'll just hardcode the closest one and be done with it. Ugh, how ugly. Can't wait till dbus catches up.
By the way, since dcop still exists in the repository for 10.04, has anybody tried just using that? How did it work out for you? |
Registered users: bartoloni, Bing [Bot], Evergrowing, Google [Bot], q.ignora, watchstar