I'm not looking for tools change wallpaper. But what do those tools do? How do I implement one?
In my case, I am using the openbox-lxde window manager, but the desktop preferences are handled by pcmanfm. The
pcmanfm --desktop-pref opens a menu which allows for setting the wallpaper. The config is updated at
/home/username/.config/pcmanfm/LXDE/pcmanfm.conf which is now the default config file for this system's desktop settings.
To summarize what is written below, it seems that this is a matter of creating and setting the default configuration files to be used by your system so that your program is the preferred application for manipulating desktop settings.
You can look at
/src/pcmanfm.c to see how the work was actually done, but if you're not intending to code in c with that particular library, then your biggest concern is setting your default application and .desktop configurations.
This can be done via openbox system configuration1.
Openbox will also source .desktop files automatically installed by some packages in the global /etc/xdg/autostart directory. The package responsible for allowing Openbox to additionally source the /etc/xdg/autostart directory is python2-xdg.
The package pcmanfm2 uses
./data/pcmanfm-desktop-pref.desktop.in to set the preferred application for desktop settings to
It looks like
./data/Makefile.am sets up the default applications config which includes
NULL= SUBDIRS=ui man_MANS=pcmanfm.1 desktopdir=$(datadir)/applications desktop_in_files= \ pcmanfm.desktop.in \ pcmanfm-desktop-pref.desktop.in \ $(NULL) desktop_DATA = $(desktop_in_files:.desktop.in=.desktop) @INTLTOOL_DESKTOP_RULE@ defconfdir=$(sysconfdir)/xdg/pcmanfm/default defconf_DATA = \ pcmanfm.conf \ $(NULL) EXTRA_DIST= \ $(desktop_in_files) \ $(desktop_DATA) \ $(defconf_DATA) \ $(NULL)
You'll have to figure out where they go on your system, but hopefully that make file help.
pcmanfm-desktop-pref.desktop were added to
/usr/share/applications on my system. A
pcmanfm.conf file was added to/etc/xdg/pcmanfm
. This was because of my environment variables used by thisMakefile.am`. It will vary from system to system.
@pcmanfm --desktop --profile LXDE is also listed in
/etc/xdg/lxsession/LXDE/autostart for my system which I'm pointing out here to remind you that your program or script should be in the appropriate autostart file as well.
This is by no means a thorough guide, but it should point you in the right direction. Now that you've seen a bit of an example of how one popular tool does it, read the System configuration section at Openbox - ArchWiki for details on the openbox configuration process.