Set*_*eth 14
你没有提到你尝试过的东西,所以试试这个:
[Desktop Entry]
Name=someName
Comment=
Exec=/path/to/script.sh
Icon=/path/to/icon
Terminal=false
Type=Application
Run Code Online (Sandbox Code Playgroud)
确保您的脚本是可执行的,如下所示:
sudo chmod +x /path/to/script.sh
Run Code Online (Sandbox Code Playgroud)
如果您的脚本使用该sudo
命令或任何其他需要用户输入的内容,它也将无法使用。
如果您希望它在运行时打开终端窗口(如果您需要添加输入或观察输出),请设置Terminal
为 true。
Terminal=true
Run Code Online (Sandbox Code Playgroud)
使用gnome-desktop-item-edit
:
gnome-desktop-item-edit --create-new /path/to/new/launcher
# Usually, one does (create launcher in current directory) :
gnome-desktop-item-edit --create-new .
Run Code Online (Sandbox Code Playgroud)
系统会以图形方式提示您进行这些设置。这是我使用此工具创建的启动器之一:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Icon[en_GB]=/path/to/icon/for/en_GB.png
Name[en_GB]=Name_for_en_GB
Exec=/path/to/shell/script.sh
Comment[en_GB]=Some comment for en_GB
Name=Launcher Name
Comment=Some comment.
Icon=/path/to/icon/file.png
Run Code Online (Sandbox Code Playgroud)
在en_GB
特定的设置都不是强制性的。随意填写相同的值。