[Desktop] 类url schema 使用xdg-open一直打不开
Tofloor
poster avatar
小黄鱼
deepin
2025-03-10 17:08
Author

root: cat JTPrint.desktop
[Desktop Entry]
Name=FastReport Application
Exec=/data/home/jtzx/Program/fastreport/linux-arm64/linux-arm64/FastreportRegister %u
Terminal=true
Type=Application
Icon=/data/home/jtzx/Program/fastreport/linux-arm64/linux-arm64/source/img/report.png
MimeType=x-scheme-handler/JTPrint;
StartupNotify=true
Categories=Utility

root:xdg-open JTPrint://action
root:open failed: failed to get appInfo

手动点击FastreportRegister没问题,路劲调用也没问题,用这.desktop走xdg一直都是 main.go:63: open failed: failed to get appInfo

尝试调用了一下普通的.sh文件,也不行。

Reply Favorite View the author
All Replies
hotime
deepin
2025-03-10 21:10
#1

一、确保这个文件JTPrint.desktop在相应的桌面入口文件目录:~/.local/share/applications//usr/share/applications/

二、确保~/.config/mimeapps.list中存储了这个类型的默认打开方式,例如:

x-scheme-handler/jtprint=JTPrint.desktop;

注意在~/.config/mimeapps.list中,x-scheme-handler/后面的类型似乎不接受大写字母,例如:x-scheme-handler/JTPrint

如果有这种情形,在使用xdg-open这个类型的时候就会得到上面的结果: main.go:75: open failed: failed to get appInfo
(当然,没有这行配置,也会是这个结果)

Reply View the author