Daily Ubuntu / Linux news and application reviews.

ads

By default, the applications that you add or are automatically added to startup are launched automatically on any desktop environment. Here is how to make an application start automatically only in a certain environment.

Example: Mailnag is a GNOME Shell mail notifier and it displays an ugly dialog box instead of regular notifications under Unity, so it's only useful in GNOME Shell. Using the instructions below, you can get Mailnag to automatically start only when you log in to GNOME.




Make an application start automatically only in a certain desktop environment


To make an application automatically start only in GNOME or Unity (or KDE, etc.), you need to edit its autostart .desktop file - this can be found in either ~/.config/autostart or in /etc/xdg/autostart. Open the .desktop file for the application you want to start only in GNOME or Unity with a text editor and at the end of the file, add this:
OnlyShowIn=GNOME;

Adding "OnlyShowIn=GNOME;" will make the application autostart only in GNOME. If you want it to automatically start in Unity only, add "Unity" instead of GNOME and so on.

To add multiple desktop environments, separate them using ";". For example, to make an application autostart only in GNOME and Unity, use:
OnlyShowIn=GNOME;Unity;

Instead of "OnlyShowIn" you can also use "NotShowIn", to not start an application in a certain desktop environment.

By the way, this isn't just for startup items - it can also be used for the menu so you can edit the .desktop files under /usr/share/applications and tweak them to only show up in the Unity/GNOME/KDE/etc. menu.


GNOME Shell / Classic GNOME 3 session (fallback) conditions


Using "GNOME" for "OnlyShowIn" for instance, the application will automatically start in both GNOME Shell and GNOME Classic (Fallback) so here's how to specify the session too: in the same .desktop file, add this at the end (thanks to Lucas Capalbo Lavezzo):
AutostartCondition=GNOME3 if-session gnome-fallback

Where "gnome-fallback" is the Classic (fallback) GNOME session. For GNOME Shell, use just "gnome" instead of "gnome-fallback".



Note: this might not work for all applications because some overwrite the .desktop file (like GmailWatcher or Dropbox).
«
Next
Newer Post
»
Previous
Older Post
-->