未解决 !!(又好像解决了)
错误信息:
This .desktop file is not trusted, it can not be launched. To enable launching, right-click, then: **Enable "Allow Launching"**
.desktop file cannot be marked as trusted in Ubuntu 22.04 https://forum.studentb.eu/index.php/ubuntu/desktop-file-cannot-be-marked-as-trusted-in-ubuntu-22-04/#google_vignette
.desktop files not launching from desktop in Ubuntu 20.04 LTS https://askubuntu.com/questions/1237042/desktop-files-not-launching-from-desktop-in-ubuntu-20-04-lts
How to mark a .desktop file as trusted from command line on Ubuntu 18.04?
------------
How to Run a .desktop File From the Command Line https://www.baeldung.com/linux/cli-run-desktop-entry-file
gtk-launch only works when present working directory is Desktop https://unix.stackexchange.com/questions/393079/gtk-launch-only-works-when-present-working-directory-is-desktop
.desktop files - Allow launching - set this via CLI https://askubuntu.com/questions/1218954/desktop-files-allow-launching-set-this-via-cli
linux 命令行进行桌面图标的打开 https://blog.youkuaiyun.com/PRML_MAN/article/details/121500548
----------------------------------------------------
检查、或设置的步骤
- 勾选 Execute
- 激活 “Allow Lauching” 的菜单。
- 问题:在 .desktop 文件中的内容,不正确;导致没有出现 “Allow Lauching” 的菜单 ?
说明:
1. 意味着、Ubuntu 的这个设置,需要经过 2 个步骤 ?
2. 其他发行版, 如: mxlinux,只需要一个步骤(相当于:>> 正常的设置、步骤 1:)就可以了。
------------
测试:在多用户场景
1. 将 普通管理员用户,加入到 root 组(应该只需要 sudo 权限,就可以了 ?)。
2. 重启
3. 勾选,如下图:
>> 正常的设置、步骤 1:
4. 仍然有 "x" 的.desktop 图标
此时,
- 有些 .desktop,单击鼠标右键,会出现 “Allow Lauching” 的菜单。
左键单击这个菜单,.desktop 功能OK 了。 - 有些 .desktop,单击鼠标右键,没有出现 “Allow Lauching” 的菜单。
.desktop 功能总是 NG的。
在正常调出时的菜单,显示、如下:
但 “Allow Launching” 这个菜单标签,有时会出现,有时又没有出现。这应该是一个 Bug 吧 ?
这是一个 toggle 菜单,选择之后,切换后,会变成“Don't Allow Launching" 菜单。
>> 正常的设置、步骤 2:
激活 “Allow Lauching” 的菜单。
可能的原因:?
在 .desktop 文件中的内容,不正确;因此,就会导致没有出现 “Allow Lauching” 的菜单 ?
结论:
1. Ubuntu 22.04 的这个功能,有 Bug ?
2.
解决:
怎样才能正常调出 “Allow Lauching” 的菜单呢 ?
----------------------------------------------------
系统默认的 .desktop 的公共目录
/usr/share/applications
I created a desktop file in /usr/share/applications, but it doesn't show up in Dash https://askubuntu.com/questions/526308/i-created-a-desktop-file-in-usr-share-applications-but-it-doesnt-show-up-in-d/527154#527154
Exec=sh -c "your_complicated_command_here && the_rest_of_it"
(command inside quotes)
How to Run a .desktop File From the Command Line https://www.baeldung.com/linux/cli-run-desktop-entry-file
.desktop file cannot be marked as trusted in Ubuntu 22.04 https://forum.studentb.eu/index.php/ubuntu/desktop-file-cannot-be-marked-as-trusted-in-ubuntu-22-04/
How to mark a .desktop file as trusted on Ubuntu 22.04? https://askubuntu.com/questions/1408373/how-to-mark-a-desktop-file-as-trusted-on-ubuntu-22-04
How to mark a .desktop file as trusted from command line on Ubuntu 18.04? https://askubuntu.com/questions/1202488/how-to-mark-a-desktop-file-as-trusted-from-command-line-on-ubuntu-18-04
f you are running as root user, run the below command to set the metadata
sudo -u <username> -g <username> dbus-launch gio set myapp.desktop metadata::trusted yes