简体   繁体   English

用于调用 Python 脚本的桌面图标不起作用

[英]Desktop icon for calling a Python script does not work

I'm trying to execute this desktop shortcut, but it doesn't work.我正在尝试执行此桌面快捷方式,但它不起作用。 The paths are right.路径是对的。

However, despite having indicated the image to associate with the icon, clicking on it does not launch the python script and the image is not associated.但是,尽管已指示图像与图标关联,但单击它不会启动 python 脚本,并且图像未关联。 Therefore the classic gear image appears.因此出现了经典的齿轮图像。 If I click on it, the text file simply opens.如果我点击它,文本文件就会打开。

Help to solve this problem?帮助解决这个问题?

Here the code:这里的代码:

[Desktop Entry]
Name= Launcher 
Version=1.0
Icon=/home/workstation/Desktop/launcher/icon_launcher.png

Path=/home/workstation/Desktop/launcher
Exec=python3 Launcher.py
StartupNotify=true
Terminal=false
Type=Application
Name[it_IT]= Launcher_test

I think you are going to need to add what error you are getting but I think it is syntax.我认为您将需要添加遇到的错误,但我认为这是语法。 Here is the updated version.这是更新的版本。

[Desktop Entry]
Name = 'Launcher'
Version = 1.0
Icon = r'/home/workstation/Desktop/launcher/icon_launcher.png'

Path = r'/home/workstation/Desktop/launcher'
Exec = python3 Launcher.py
StartupNotify = True
Terminal = False
Type = Application
Name[it_IT] = 'Launcher_test'

Let me know if this works.让我知道这个是否奏效。 There are a few ways of implementing it.有几种实现它的方法。

The other answer is completely wrong and the actual solution from the OP can be found in the rejected edit of that answer.另一个答案是完全错误的,OP 的实际解决方案可以在该答案的拒绝编辑中找到。

From the OP's edit来自OP的编辑


I think that is a problem of the default desktop of Ubuntu 20.04.我认为这是 Ubuntu 20.04 的默认桌面的问题。

So I decided to try something different.所以我决定尝试一些不同的东西。 I installed Gnome Vanilla on Ubuntu 20.04 LTS Focal Fossa我在 Ubuntu 20.04 LTS Focal Fossa 上安装了 Gnome Vanilla

$ sudo apt install gnome-session gdm3

then然后

$ sudo reboot

But...being Vanilla very basic...I decided to install Full Gnome Desktop on Ubuntu 20.04 LTS Focal Fossa with但是......作为香草非常基本......我决定在 Ubuntu 20.04 LTS Focal Fossa 上安装完整的 Gnome 桌面

first第一的

$ sudo apt install tasksel

second第二

$ sudo tasksel install ubuntu-desktop

then然后

$ sudo reboot

and so it works.所以它起作用了。

I saw the procedure here https://linuxconfig.org/how-to-install-gnome-on-ubuntu-20-04-lts-al-fossa我在这里看到了程序https://linuxconfig.org/how-to-install-gnome-on-ubuntu-20-04-lts-al-fossa

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM