Home Store Blog

.desktop file will not execute


The file below will execute on ubuntu 19.04 but will not execute on UB 19.04 and Nemo. It has the permissions set to execute.

I checked it with desktop-file-validate and no problems,

The problem is the Exec command. I have tried different shells and same results.

[Desktop Entry]
Name[en_US]=Run Trim
Exec=sudo sh -c “fstrim -v /; fstrim -v /home; sleep 5”


I never use fstrim, but it seems quite impossible to me that it would run on 19.04 or any other distro/version without having set a way to enter the sudo password. You’d at least need a pkexec or something.



…but it seems quite impossible to me that it would run on 19.04…

Well it runs on ubuntu 19.04 and it run a command window sudo sh -c “fstrim -v /; fstrim -v /home; sleep 5”.

Same behavior with nemo 3.8.5 and 4.0.6

If I change the Exec to Exec=sudo sh -c “ls -l; sleep 5” it still fails.


So where do you enter the password? It doesn’t call a terminal nor pkexec. Ah, wait, you set terminal = true, my bad! It has nothing to do with Nemo though.


@makitso if you want to run it in a terminal, don’t set Terminal=true, but use tilix -e command . https://askubuntu.com/questions/436891/create-a-desktop-file-that-opens-and-execute-a-command-in-a-terminal


I have reinstalled 19.04 and the problem has gone away. As a side note, I run gnome-terminal not tilix.


After clean install of 19.04 and installing the gnome-terminal, the above referenced desktop file works correctly – Nemo 3.8.5.

Next, I installed ppa:ubuntubudgie/backports for the new Nemo 4.0.6.
Desktop launcher again fails and default desktop icon size is larger.


Ah, yes, the bigger icons on nemo 4 are a known difference. nemo 4 has a different “opinion” on sizes. To get the same icon size, set gsettings set org.nemo.icon-view default-zoom-level 'small' (or use dconf editor to do the same). Currently, nemo 4 is adviced for “the brave”. Some peculiarities might occur.


So, can we assume that nemo 4 will not be the release version for 19.04?


The next upload of budgie-desktop-environment will ensure the icon size if 4.0.6 will mirror that of 3.8 nemo


Ok, got my launcher to work – but some changes were needed for nemo 4.

Exec=sudo sh -c “fstrim -v /; fstrim -v /home; sleep 5”

Exec=gnome-terminal – bash -c “sudo fstrim, -v/; sudo fstrim -v /home; sleep 5”


A bit surprised you are using gnome terminal?


A bit surprised you are using gnome terminal?

Yea, I just like it better than Tilix. But, I am a strange duck, I also install Thunar and use it for file management. So, go figure :slight_smile:

Actually, I was using xubuntu for several years so it’s what I am comfortable with. So, when I made the change to UB I brought along some friends.