.desktop interview questions

Top 15 .desktop interview questions

How to refresh launcher icon application menu in ubuntu 12.04?

After modifying a desktop file in /usr/share/applications, I need to refresh the launcher icon application menu so that my modification shows up. For the sake of clarity, the menu that should get modified is the one that appears with a right click when the pointer is on an icon of the launcher (the big bar full of icon on the left side of the screen).

Best answer would be a simple command line.

I am not using ubuntu-2d and I don't want to logout/login.

I'm aware of some partial solution:

  • unity --replace reloads everything (window decoration, notification area, ...)
  • killall ubuntu-2d-launcher is ubuntu-2d only, but if a similar one-line command exists for unity, that would be a good solution.
  • logging out then logging back in works also, but I can't afford loosing all my session just to update the menu.
  • on ubuntu 14.04 I don't have this issue: any changes made to "*.desktop" files seems to be repercuted live.

Any suggestions ? Is there a way thanks to ccsm ?

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)

Can I use pkexec in a python script or a .desktop file?

From the following questions

we see that gksu will no longer be supported in the long term, and it will not be installed by default from >= 13.04. Instead we should use pkexec which does its job fine for non-graphical applications but not for apllications on the GUI:

pkexec gedit

when replacing gksu in a .desktop file

EXEC=pkexec /usr/bin/gedit

or when I run a python script to run a graphical application with root permissions I get the following error:

** (gedit:3203): WARNING **: Could not open X display

How would I have to re-write my scripts or my .desktop files to support an authentication dialog and run an application as root if I should not have it depend on gksu?

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 make a shell file execute by double click [duplicate]

This question already has an answer here:

I have tried right clicking on the file selecting properties and then the permissions tab and setting it to execute. However, when I double click the file it opens in gedit. What do I do?

Source: (StackOverflow)

Desktop launcher documentation? [duplicate]

Possible Duplicate:
What is the syntax for .desktop files?
How do I add a custom launcher?

I prefer to create new desktop launchers (.desktop files) using just a text editor, for example to create an iotop launcher I write:

[Desktop Entry]
Exec=gksudo "gnome-terminal -x iotop"

But I haven't found any documentation on the format. Can someone give me a link to the format specification?

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)

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)

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)

How to order desktop icons by name in XFCE?

I'm using Xfce 4.8 installed on Ubuntu 12.04.2 LTS and I'm wondering what's the alternative for Right-click -> Order by name on XFCE. Right now, when I right click on my desktop, it looks like this:

right click menu on desktop in Xfce

As you can see, there's no option for rearranging the icons. If my assumption is correct, it can't be done directly via GUI. I saw this thread, but that doesn't really explain how to achieve the same result. Any ideas?

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)

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)

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)