Ubuntu – How to get wallpaper file name if using dynamic wallpapers

18.0418.10backgroundgnome-shellwallpaper

I have a hundreds of images in some folder and use xmlback script to generate background.xml file and set it as a wallpaper.

So, now:

$ gsettings get org.gnome.desktop.background picture-uri
'file:////home/itsme/Images/ng-wallpaps/background.xml'

How can I get current image file name (or position inside xml file), exaclty?

It does not depend of xmlback, however, with one of packaged dynamic backgrounds i have this result:

$ gsettings get org.gnome.desktop.background picture-uri
'file:///usr/share/backgrounds/contest/cosmic.xml'

Best Answer

  • You can use xmllint with the --xpath setting to extract relevant parts of an XML document:

    xmllint --xpath 'string(/background/static/file)' /usr/share/backgrounds/contest/cosmic.xml
    
  • Related Question