How would I change the wallpaper on a Linux desktop (using GNOME) within a C/C++ program? Is there a system API to do it?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
If nothing else, you could probably use
system()
to invoke one of the command lines suggested here:http://www.linuxquestions.org/questions/linux-general-1/change-background-via-command-line-350936/
Though the question was gnome-specific, there's also a way to deal with the wallpaper that is not depepndant on the higher layer toolkits. You should be able to deal with the root window (which the wallpaper is, in fact) by studying the source of xsetroot.c, the most interesting part of which I copypaste here:
You could use gconf library to do it. The following sample is a complete program to change background:
The source above is based on gthumb project. It could be compiled with the following string: