I'm not looking for tools change wallpaper. But what do those tools do? How do I implement one?

  • I think the answer you're looking for is that they draw an image (or something similar) to X's root window. – HalosGhost Nov 6 '14 at 5:04
  • You may get an idea by looking at the source code of nitrogen. I understand that nitrogen plays well with Openbox. – DK Bose Nov 6 '14 at 5:50
  • feh, imlibsetroot, xsetbg, etc... – jasonwryan Nov 6 '14 at 6:15

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 pcmanfm --desktop-pref.

It looks like ./data/Makefile.am sets up the default applications config which includes pcmanfm-desktop-pref.desktop.in.




desktop_in_files= \
        pcmanfm.desktop.in \
        pcmanfm-desktop-pref.desktop.in \
desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)

defconf_DATA = \
        pcmanfm.conf \

        $(desktop_in_files) \
        $(desktop_DATA) \
        $(defconf_DATA) \

You'll have to figure out where they go on your system, but hopefully that make file help.

The files pcmanfm.desktop and 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.