我发现使用 xdg-mime 程序比编辑 defaults.list 更容易。查找 pdf 查看器,查看它的 adobe,然后将其切换为 KPDF:
$xdg-mime query default application/pdf
AdobeReader.desktop
$xdg-mime default kde-kpdf.desktop application/pdf
$xdg-mime query default application/pdf
kde-kpdf.desktop
Run Code Online (Sandbox Code Playgroud)
您可以使用 xdg-open 用您喜欢的应用程序打开文件:
$xdg-open file.pdf
Run Code Online (Sandbox Code Playgroud)
小智 6
正如曼尼指出的那样,您可以使用文件上的“属性”选项卡来更改用于打开它的程序。
编辑: 看看 Chris089 的回答。我更喜欢直接编辑文件,如下所示。了解 mime 类型是什么以及关联所在的位置可能仍然很有用,但我会使用该工具来修改文件。
但是,如果您想要基于文本的解决方案,或者甚至想了解如何为不同类型配置文件关联:
$ cat ~/.local/share/applications/defaults.list
[默认应用程序]
application/vnd.google-earth.kml+xml=Google-googleearth.desktop
application/keyhole=Google-googleearth.desktop
application/earthviewer=Google- googleearth.desktop
应用程序/vnd.google-earth.kmz=Google-googleearth.desktop
$ cat /usr/share/applications/defaults.list | grep ^audio
audio/3gpp=totem.desktop
audio/ac3=totem.desktop
audio/AMR=totem.desktop
audio/AMR-WB=totem.desktop
audio/basic=totem.desktop
audio/midi=totem.desktop
audio/mp4 =totem.desktop
audio/mpeg=totem.desktop
audio/mpegurl=totem.desktop
audio/ogg=totem.desktop
audio/prs.sid=totem.desktop
audio/vnd.rn-realaudio=totem.desktop
audio/x-ape =totem.desktop
audio/x-flac=totem.desktop
audio/x-gsm=totem.desktop
audio/x-it=totem.desktop
audio/x-m4a=totem.desktop
audio/x-matroska=totem.desktop
audio/x-mod=totem.desktop
audio/x-mp3=totem.desktop
audio/x-mpeg=totem.desktop
audio/x-mpegurl=totem.desktop
audio/x-ms-asf=totem.desktop
audio/x -ms-asx=totem.desktop
audio/x-ms-wax=totem.desktop
audio/x-ms-wma=totem.desktop
audio/x-musepack=totem.desktop
audio/x-pn-aiff=totem.desktop
audio/x-pn-au=totem.desktop
audio/x-pn-realaudio=totem.desktop
audio/x-pn-realaudio-plugin=totem.desktop
audio/x-pn-wav=totem.desktop
audio/x- pn-windows-acm=totem.desktop
audio/x-realaudio=totem.desktop
audio/x-real-audio=totem.desktop
audio/x-sbc=totem.desktop
audio/x-scpls=totem.desktop
audio/x-speex=totem.desktop
audio/x-tta=totem.desktop
audio/x-wav=totem.desktop
audio/x-wavpack=totem.desktop
audio/x-vorbis =totem.desktop
音频/x-vorbis+ogg=totem.desktop
音频/x-xm=totem.desktop
这是桌面条目规范文档,详细说明了 .desktop 文件的需要和使用(而不是使用可执行文件的路径)。
归档时间: |
|
查看次数: |
12101 次 |
最近记录: |