如何从命令行(特别是从脚本)更改默认应用程序?
下面的链接介绍了如何从 GUI 设置默认应用程序,也可以通过编辑~/.local/share/applications/mimeapps.list
。但是,它似乎mimeapps.list
已被移动或不再存在。
例如,参见 如何设置默认程序?
答案1
使用我的系统一段时间后,似乎我的某个程序导致在 ~/.config/mimeapps.list 中创建了该文件
sudo find / -name "mimeapps.list"
cat ~/.config/mimeapps.list
[Added Associations]
image/jpeg=gimp.desktop;
text/x-java=eclipse_eclipse.desktop;
application/json=sublime_text.desktop;
application/rdf+xml=sublime_text.desktop;
text/x-python=sublime_text.desktop;
video/mp4=vlc.desktop;
application/octet-stream=org.gnome.Software.desktop;
application/pdf=evince.desktop;
text/html=org.gnome.gedit.desktop;
text/plain=firefox.desktop;
[Default Applications]
application/ppdf=FoxitReader.desktop
application/octet-stream=FoxitReader.desktop
application/pdf=FoxitReader.desktop