9

Has a way to create a program shortcut on the desktop entirely from the terminal / CLI (scriptable) been discovered in Ubuntu 20.04?

I can copy in .desktop files from /usr/share/applications/, and set them as executable, but apparently that's no longer enough. There is now a final step:

Right-click the shortcut -> Select Allow Launching.

Until that is done, double-clicking it simply opens the .desktop file as a text file, rather than execute the program. Furthermore before that step, the icon is the generic shell script icon, rather than the program's own icon.

...and I don't yet know how to do that step from the terminal.

Any help is appreciated - thank you.


My own investigations:

Allow Launching does set the script as executable, but doing that manually is not enough. Also from my investigation it doesn't alter the .desktop file itself, and no changes are made that are visible to ls -l or lsattr, so I'm assuming it's some other database of sorts, that tracks which shortcuts it's allowed to launch and which it isn't?

Considered solutions:

  • gnome-desktop-item-edit can't do it, and it also no longer exists in recent versions of Ubuntu.
  • alacarte I'm unsure about, but regardless it's GUI only.
  • desktop-file-install/desktop-file-edit I'm unsure about.
miyalys
  • 172

1 Answers1

8

PiluX v1.0 (An Ubuntu 22.04 based OS, Not released yet), is used this script for trust all desktop icons ( /bin/teteosnet/trustdesktop all )

#!/bin/bash
cd $(xdg-user-dir DESKTOP)

FILES="*.desktop" for f in $FILES do gio set $f metadata::trusted true done

chmod +x *.desktop

It's mean using this code is good idea for trust just one .desktop file:

#!/bin/bash
gio set $(xdg-user-dir DESKTOP)/YOUR_APP.desktop metadata::trusted true
chmod +x $(xdg-user-dir DESKTOP)/YOUR_APP.desktop

Note: trusted yes is wrong , use trusted true

Wrong: gio set ..desktop metadata::trusted yes

Correct: gio set ..desktop metadata::trusted true

Good luck :)

Hasan Merkit
  • 471
  • 3
  • 10