问题
I would like to determine a user's wallpaper path with PyGTK.
If possible, I would like to not rely on a Desktop Environment's function to do this - this is because some users(like myself) do not use a DE. Because of this, I am wondering if you can use X11 or something else to determine the current wallpaper being used.
回答1:
You MUST rely on a desktop environment, otherwise it is not possible, since X11 isn't supposed to handle such things as wallpapers. When you set a background image, an external program loads the image and sets it as the background pixmap of the root window. Therefore, unless the specific loading mechanism stores the image path somewhere, X11 itself will never know where the image file is located on the disk.
来源:https://stackoverflow.com/questions/8774388/determining-path-to-current-wallpaper-with-pygtk-maybe-x11