Gnome 3 and .desktop files - What exactly does "Allow/Disallow lauching do"?
Asked Answered
L

3

10

I know that when creating a .desktop file, one can set the metadata::trusted as true and false, in order to be able to launch the icon as an executable. What is intriguing me however is the fact that:

  1. When right-clicking on the .desktop file and "Allow launching" apparently the only thing it does is to set the metadata::trusted to true. The icon, however, changes, as expected, instantly to the icon described in the .desktop file Icon=.

  2. However when setting the metadata::trusted to either false or true via command-line the icon doesn't seem to change its behavior $ gio set android-studio.desktop metadata::trusted false

Once I refresh the Desktop manually (Alt + F2 >> restart) the environment refreshes and the icon turns to be executable again, BUT the whole environment is restarted.

So, What does exactly "Allow/Disallow launching" does after setting the metadata::trusted? How does it refresh the metadata in the .desktop itself without refreshing the whole Desktop?

Lackluster answered 5/2, 2020 at 11:14 Comment(0)
C
9

Your question is exactly the same as what I'm looking for.

On Ubuntu 18.04 (GNOME 3.28):

dbus-launch gio set file.desktop "metadata::trusted" yes

and (although this is not quite what you need)

killall nautilus-desktop && nautilus-desktop & disown

Ubuntu 20.04 (GNOME 3.36):

dbus-launch gio set file.desktop "metadata::trusted" true

but no nautilus-desktop...

dbus-send --type=method_call --print-reply --dest=org.gnome.Shell /org/gnome/Shell org.gnome.Shell.Eval string:'global.reexec_self()'

or something like systemd*...

Look at this code:

https://gitlab.gnome.org/GNOME/nautilus/commit/1630f5348

and here search "trusted":

https://download.gnome.org/core/3.36/3.36.2/sources/

nautilus-3.36.2/src/nautilus-file-operations.c

nautilus-3.36.2/src/nautilus-mime-actions.c

Cosine answered 7/6, 2020 at 3:26 Comment(1)
interesting, thanks for replying this. I still havent figured out lolLackluster
C
2

It may turns out to be simpler. From desktop-file-utils.

man desktop-file-install

For example:

desktop-file-install --mode=0755 --dir=$HOME/Desktop /path/to/source/file.desktop
Cosine answered 5/11, 2020 at 14:33 Comment(1)
Sorry but this command put a "non launchable" icon on the Desktop. So there is still no answer to the question: how to refresh the desktop with the right icon and make the starter launchable?Paronymous
T
2

Quiet interesting, I've used combination of the two previous answers in order to "Allow Launching" .desktop file located at my desktop within Kali Linux 2022 with GNOME Shell:

desktop-file-install --mode=0755 --dir=$HOME/Desktop ~/Desktop/Telegram.desktop
dbus-launch gio set ~/Desktop/Telegram.desktop "metadata::trusted" true

Note the order of the execution of the commands is important!


Tabby answered 23/8, 2022 at 7:53 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.