【发布时间】:2017-09-20 13:21:32
【问题描述】:
我在 /home/user/.local/share/applications 中有这个 .desktop 文件
[Desktop Entry]
Categories=AudioVideo;Video;
Comment=This Bash script compresses the specified video files (wildcards supported) to lossy h.264 format in an MP4 container
Exec="\\$HOME/Scripts/Git/compress2mp4.sh" %F
GenericName=Batch compress to mp4
Icon=folder-video
MimeType=video/x-msvideo;video/quicktime;video/mpeg;video/mp4;
Name=Compress to mp4
NoDisplay=false
Path=
StartupNotify=true
Terminal=true
TerminalOptions=\s--noclose
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=none
X-KDE-SubstituteUID=false
X-KDE-Username=
它显示在“打开方式”菜单中并且可以完美运行。
然后我创建了另一个 .desktop 文件并将其复制到 /home/user/.local/share/kservices5/ServiceMenus
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=video/x-msvideo;video/quicktime;video/mpeg;video/mp4;
Icon=folder-video
Actions=compress2mp4
X-KDE-Priority=TopLevel
X-KDE-StartupNotify=false
X-KDE-Submenu=Video
[Desktop Action compress2mp4]
Name=Compress to mp4
Icon=video-mp4
Exec="$HOME/Scripts/Git/compress2mp4.sh" %F
服务菜单显示,但出现此错误:
Could not find the program '$HOME/Scripts/Git/compress2mp4.sh'
我尝试将$HOME 替换为\\$HOME 和~/,但没有帮助。
如果我输入/home/my-user-name/... 而不是$HOME,则会在后台打开一个窗口并立即关闭,因此我无法捕捉到那里发生的事情。
有没有人知道为什么 .desktop 文件 Type=service 不起作用而非常相似的文件 Type=application 起作用?
【问题讨论】: