Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

KDE & GNOME cross-desktop development

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.

Subscribe and save more than 30% and receive our exclusive money back guarantee – click here to find out more.

Running 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 username=”linuxusermag”]