.desktop interview questions

Top 15 .desktop interview questions

4496 Jobs openings for .desktop

How to make my application accept folders from Unity Launcher?

When dragging a file, all the entries on the launcher that are able to open that file stay lightened while the others fade. As far as I know, this is based on the Mime Types specified on the .desktop file of each application.

I would like my application to be able to accept folders as arguments through the unity launcher. I have added


to my .desktop file but to no avail.

Any ideas?


This is my full .desktop file:

[Desktop Entry]
Comment=Change desktop wallpapers automatically
Exec=/usr/bin/wallch %U


[Desktop Action Start]
Exec=/usr/bin/wallch --start

[Desktop Action Change_Wallpaper]
Name=Change Wallpaper
Exec=/usr/bin/wallch --change

Source: (StackOverflow)

What is TargetEnvironment=Unity?

I have a pure Lubuntu 12.10 installation. While looking at some .desktop files in /usr/share/applications I see TargetEnvironment=Unity.
One example is in the .desktop file for Google Chrome:

[NewWindow Shortcut Group]
Name=New Window

[NewIncognito Shortcut Group]
Name=New Incognito Window
Exec=/opt/google/chrome/google-chrome --incognito

Another example is the .desktop file for Inkscape:

[Drawing Shortcut Group]
Name=New Drawing

To find out what that means, I looked at Desktop Entry Specification - freedesktop.org standards and at UnityLaunchersAndDesktopFiles. But neither mentions TargetEnvironment. Hence my question.

Source: (StackOverflow)

Showing all installed programs in Ubuntu

In Ubuntu, where to see all programs just like the "program files" in windows, from which I can launch a program from a list of all program installed?

Source: (StackOverflow)

How to add an application icons to the desktop in 14.04?

How does one add an application icon to the desktop in verson 14.04?

Thank you for your time.

Source: (StackOverflow)

How to launch an Xulrunner app with a desktop shortcut?

I have created a simple xulrunner app and it works great when invoked from command line.

clain@desktop:~$ xulrunner /home/clain/myapp/application.ini

The problem is that I need to keep the terminal open while the app is running. is there a way I can launch the app with a desktop shortcut / desktop entry?

I have tried to make a desktop entry file like below but when running it I got the error "Invalid desktop entry file: '/home/clain/Desktop/myapp'"

[Desktop Entry]
GenericName=MyApp XulRunner
Exec=xulrunner /home/clain/myapp/application.ini
TryExec=xulrunner /home/clain/myapp/application.ini

Comment[en_IN]=Standalone MyApp SSB

I am running on Lubuntu 14.04 LTS (Trusty Tahr)

Source: (StackOverflow)

Why so many files in /usr/share/app-install/desktop?

For 14.04, I'm trying out Lubuntu LTS.

If I run ls -l /usr/share/app-install/desktop, I get a list of 3085 .desktop files. All except one are dated Apr 18. The exception is:

-rw-r--r-- 1 root root  6328 Mar 28  2013 applications.menu

From the dates, it's clear that all these are installed by default and not by me.

  • Doesn't each GUI-based program bring in its own .desktop file at the time it's installed (mostly in /usr/share/applications)?

  • Then why are these thousands of other .desktop files needed? From their names, most of them haven't anything to do with Lubuntu.

  • Their names are different from regular .desktop files (such as those in /usr/share/applications): many, not all, are like name:name.desktop whereas the regular ones are just name.desktop.
  • The ones I looked at all have a line with X-AppInstall-Popcon=nnn where nnn is a string of digits. I know that Popcon "gathers statistics determining which packages are the most popular with Ubuntu users". But why is that part of these .desktop files?

Source: (StackOverflow)

.desktop files: how to specify the icon path

I had a look at the .desktop files on my 12.04 Ubuntu system, and many of them do not have a full path specification for their icon file. It is rather something like:






Is there a common path where icons can be stored so that this can work ? If not, how does this work ? If I try to do the same thing with my own icons I have to specify the full path.



works fine, but


will fail.

Any kind of help is welcome!

Source: (StackOverflow)

Ubuntu 13.10 - Black screen after login session [duplicate]

This question already has an answer here:

Yesterday, the system asked me if I wanted to upgrade to 13.10 from 13.04. Since that was the first time for me, I decided to proceed and ran the installation without worrying about it.

After the system completed the upgrade, my PC was rebooted and the new version of Ubuntu signalled that the desktop would have run in low graphigs mode due to a graphical driver problem. I couldn't manage to fix the issue, so I continued with the low graphics mode... but nothing showed up. I wasn't even able to access one of the TTYs.

So I ended up rebooting the system and accessing the recovery mode. I uninstalled all my ATI graphics drivers along with xorg-server and fglrx. After rebooting, I was able to access the login session of Ubuntu, but after confirming my credentials, the desktop wouldn't show up, but instead a black screen appeared with the following message:

System program problem detected

I couldn't figure out the problem and tried to restore/re-install all the graphics elements I knew. but nothing worked. The screen still remains black and won't show the icons nor the Unity bar.

What would you advise me to do? Should I try launching a fresh install of the OS from the live CD?

Thank you.

Source: (StackOverflow)

Desktop Files don't seem to use $PATH correctly

I am creating .desktop files for use in the Unity Launcher.

I have my own location in my home directory where I put my executables (~/usr/bin/) which is correctly added to my PATH environment variable in my .pam_environment file as specified in the relevant Ubuntu documentation.

This is the contents of my .pam_environment file:


PATH DEFAULT=${PATH}:~/usr/bin/

Which results in my PATH variable being as follows:

ben@ben-HPdv6:~$ echo $PATH

I know it is appended twice, but anything in the .pam_environment file seems to get added twice no matter what when using the correct syntax recommended in that Ubuntu Documentation I have referenced.

This is one example of the problem (it happens with all cases). I have a script (called eclipse) in ~/usr/bin/ which runs Eclipse IDE.

I can open any terminal and simply type eclipse and it runs fine like you would expect.

But when using the following .desktop file:

#!/usr/bin/env xdg-open

[Desktop Entry]
Name=Eclipse - Juno (4.2)

I get the error: Error

But when I change the Exec= line to:


it works perfectly.

The Official Unity Launchers and Desktop files documentation suggests that this should work:

Exec is the path to the executable file. The full path to the executable file must be used only in case it isn't in any of the paths specified in the $PATH variable. For example, any files that are inside the path /usr/bin don't need to have their full path specified in the Exec field, but only their filename.

Any suggestions on what is happening?

Source: (StackOverflow)

Timestamp in Exec= line of .desktop file possible?

Lubuntu 16.04 - Openbox session

I can use the terminal to open a time-stamped file with gedit:

gedit ~/$(date +%Y%m%d%H%M%S).txt

The command can also be used via a keyboard shortcut in Openbox.

<keybind key="W-4">        # gedit time-stamped file
  <action name="Execute"><command>sh -c 'gedit ~/$(date +%Y%m%d%H%M%S).txt'</command></action>

But I can't do the same via the Exec= line of a .desktop file.

Exec=sh -c 'gedit ~/$(date +%Y%m%d%H%M%S).txt'

just creates a file called ~/.txt

So how do I get a .desktop file to do what I want?

Source: (StackOverflow)

How do I create a .desktop file for a .jar file?

My problem is, that I do want to create a .desktop file for Technic Launcher, which is an alternative launcher for Minecraft. It comes in the form of a .jar file and I want to create a menu entry for it. How would I write such a .desktop file?

My attempt was the following:

[Desktop Entry]
Name=Technic Launcher
Comment=Minecraft Launcher for Technic Pack, Tekkit, Hack/Mine and Yogbox

This didn't work, hence my question. What did I do wrong? Is it even possible to point to a .jar file?

Source: (StackOverflow)

How do I diagnose "There was an error launching the application"?

I created a my-app.desktop file for a program I wrote. When I double-click it, I get the error message "There was an error launching the application". How can I get more detailed information about what the problem is?

I saw a reference to a "details" section of the dialog box, but there is nothing like that present in the one I see. If I were on my Mac, I'd open the Console app to see if any errors were logged, but I haven't learned of anything similar on Ubuntu.

(Note that unlike other similarly-titled questions, I am not asking what's wrong with this particular .desktop file; I want to know how to find out in general.)

Source: (StackOverflow)

Create a .desktop file that opens and execute a command in a terminal

I would like to know how to write the Exec command of a .desktop file to open a new terminal and execute a shell script in it. The shell script is working and accessible by all users. When launching the script from the terminal everything works, but it doesn't when trying to launch the script from a .desktop file.

Here are some combinations I have already tried:

Exec=gnome-terminal -x sh -c 'echo hello'
Exec=sh -c 'gnome-terminal echo hello'
Exec=sh -c 'echo hello'
Exec=echo hello

The .desktop terminal option is set to true.

Source: (StackOverflow)

How can I add folder shortcuts to the Unity Launcher?

I want to add some folder to the launcher so that I can access them at ease. How do I add shortcut to launcher?

Source: (StackOverflow)

Custom right-click action in Unity Launcher keeps cursor busy for 20 seconds

To have a "minimize window" option through right click on an icon in the Unity launcher (Ubuntu 14.04), I followed the detailed instructions here about changing a .desktop file and made a custom Firefox launcher in ~/.local/share/applications/ folder. The relevant part of the .desktop file is:


[Desktop Action NewWindow]
Name=Open a New Window
Exec=firefox -new-window

[Desktop Action NewPrivateWindow]
Name=Open a New Private Window
Exec=firefox -private-window

[Desktop Action Minimize]
Name=Minimize Windows
Exec=sh /home/myusername/Documents/xdotool_sh/minimize.sh firefox

The desktop action "Minimize" invokes a simple shell script, minimize.sh that has the following content:

for i in $(xdotool search --class "$name"); do
    xdotool windowminimize $i

The script uses xdotool, that can be installed from the official repositories, to find all the firefox windows, iterate over them and minimize them.

The script works and the launcher right menu option "Minimize Windows" works as well, but as soon as the windows are minimized, the mouse pointer gets in "busy" mode and stays like this for about 20 seconds (although the mouse actions are still responsive).

Does anyone know why starting a shell script from a right menu option in Unity could lead to this behaviour?

EDIT: Apparently the wait period is inevitable, as explained in Jacob Vlijm's answer. Since the mouse remains responsive, avoiding the transformation of the pointer in the spinning wheel is a partial esthetic workaround, as explained on askubuntu.

EDIT2: giving the system a fake window is a better solution, as explained by Jacob below.

Source: (StackOverflow)