我的.desktop文件有问题。我有一个shell脚本,它经常监视要放入“下载”文件夹中的文件。当文件被放入文件夹中时,它会自动执行我在终端中编写的C程序,并为我提供不同的选项来移动文件。
一切都很好。但是,我想要一个桌面快捷的程序。我尝试使用快捷编辑器指定要运行的命令,并在终端中删除它,并在命令执行后保持终端运行。命令中的所有内容都是cd ~/Documents/prog/c/learn/inotify-tools && ./notifyscript.sh
然而,这是行不通的。另外,我试着编写一个C程序,它基本上告诉系统上面的命令,认为快捷编辑器搞砸了。
有趣的是,当我在它的目录中并键入./'Download Manager'时,它运行良好。
但是,我不想在每次重新启动时继续切换到目录,然后运行程序。相反,我想要一个.desktop快捷方式,或者更好的是,一种自动重新启动的方式。我不明白为什么不起作用。如果我不在终端机上执行,它就不能工作.
以下是桌面文件:
[Desktop Entry]
Name=Download Manager
Comment=
Exec=cd ~/Documents/prog/c/learn/inotify-tools && ./notifyscript.sh
Icon=icon name
Terminal=true
Type=Application
StartupNotify=true
X-KeepTerminal=true这里还有C源代码及其桌面文件,这也是另一种选择:
[Desktop Entry]
Name=Download Manager
Comment=
Exec=./'Download Manager'
Icon=icon name
Terminal=true
Type=Application
StartupNotify=true
X-KeepTerminal=trueC源代码:
/*
desktoplauncher.c Source Code
Written by me
This program is used to launch
the inotify monitor shell script
which in turn launches the
download manager program
whenever a file is placed in the
"Downloads" folder.
*/
#include <stdio.h>
int main()
{
system("cd ~/Documents/prog/c/learn/inotify-tools && ./notifyscript.sh");
}发布于 2014-09-02 18:47:23
我通过将脚本移动到我的主文件夹并编辑桌面配置文件使其工作如下。
[Desktop Entry]
Name=Download Manager
Comment=
Exec=lxterminal --command="./.notifyscript.sh"
Icon=icon name
Terminal=false
Type=Application
StartupNotify=true这听起来很奇怪,尤其是因为终端机是假的.不管怎样,我很高兴!谢谢大家的帮助!
https://askubuntu.com/questions/519211
复制相似问题