Official website for Linux User & Developer

KDE & GNOME cross-desktop development

by Kunal Deo

If you want your application to have the widest reach possible, it would be a good idea to ensure they play nice with both KDE and GNOME. Follow Kunal Deo’s brief tutorial to find out how to get started…

This article originally appeared in issue 90 of Linux User & Developer magazine.KDE & GNOME cross-desktop development Subscribe and save more than 30% and receive our exclusive money back guarantee – click here to find out more.

KDE & GNOME cross-desktop developmentRunning applications in different desktops is the easy part. Most of the applications are already cross-compatible with both KDE and GNOME as long as the required libraries are available. The real problem arises when you want to integrate the desktop aspects of your application. Desktop aspects include desktop menus, application menu, MIME type association, etc.

For example, GNOME uses a different location to KDE for storing  the application launcher menu item. Fortunately, you can take care of this yourself, thanks to the Portland Project. Portland is a joint OSDL/ initiative to provide developers with stable APIs for desktop Linux and other free desktop platforms.

xdg-utils is the first outcome of the Portland project. It is a set of open source tools that allows applications to easily integrate with any desktop configuration. It ships with the following tools…
xdg-desktop-menu: A command-line tool for (un)installing desktop menu items. Set it up via:
[sourcecode language=”cpp”]$ xdg-desktop-menu install [–noupdate] [–novendor] [–mode mode] directory-file(s) desktop-file(s)
$ xdg-desktop-menu uninstall [–noupdate] [–mode mode] directory-file(s) desktop-file(s)[/sourcecode]
xdg-desktop-icon: A command-line tool for (un)installing icons to the desktop. Set it up via:
[sourcecode language=”cpp”]$ xdg-desktop-icon install [–novendor] FILE
$ xdg-desktop-icon uninstall FILE[/sourcecode]
xdg-icon-resource: A command-line tool for (un)installing icon resources. These resources may include XPM or PNG files. This tool works according to the XDG icon theme specification from Set it up via:
[sourcecode language=”cpp”]$ xdg-icon-resource install [–noupdate] [–novendor] [–theme theme] [–context context] [–mode mode] –size size icon-file [icon-name]
$ xdg-icon-resource uninstall [–noupdate] [–theme theme] [–context context] [–mode mode] –size size icon-name[/sourcecode]
xdg-mime: A command-line tool for querying information about file type handling and adding descriptions for new file types. Set it up via:
[sourcecode language=”cpp”]$ xdg-mime query { filetype | default } …
$ xdg-mime default application mimetype(s)
$ xdg-mime install [–mode mode] [–novendor] mimetypes-file[/sourcecode]
Want to know which Desktop Environment is right for you? Check out Linux User & Developer’s feature KDE vs GNOME and join the debate. You can see what else featured in issue 90 of the magazine here.

twitter follow us
  • Tell a Friend
  • Follow our Twitter to find out about all the latest Linux news, reviews, previews, interviews, features and a whole more.