Home Store Blog

.desktop file will not execute

#1

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]
Version=1.0
Type=Application
Terminal=true
Icon[en_US]=gnome-panel-launcher
Name[en_US]=Run Trim
Exec=sudo sh -c “fstrim -v /; fstrim -v /home; sleep 5”
Name=RunTrim
Icon=/usr/share/icons/Humanity/devices/32/block-device.svg

#2

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.

#3

@vlijm

…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.

#4

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.

#5

@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

#7

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

#8

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.
Rebooted.
Desktop launcher again fails and default desktop icon size is larger.

#9

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.

#10

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

#11

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

#12

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

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

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

#13

A bit surprised you are using gnome terminal?

#14

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.