You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Ubuntu 22.04.2 GNOME环境下如何阻止LibreOffice频繁抢占默认办公应用设置

Ubuntu 22.04.2 GNOME环境下如何阻止LibreOffice频繁抢占默认办公应用设置

嗨,我完全懂你的困扰——LibreOffice每次更新后偷偷抢回默认办公应用的设置,真的太烦人了。下面几个实用方法能帮你把Softmaker Office 21牢牢设为永久默认,再也不用反复手动修改:

方法1:用xdg-mime命令锁定用户级默认应用(最推荐)

这个方法会把你的偏好写到用户专属配置文件里,优先级比系统级设置高,LibreOffice更新时也不会被覆盖。

首先你需要确认Softmaker Office各组件对应的.desktop文件名(通常在/usr/share/applications/目录下):

  • Softmaker Writer对应 textmaker21.desktop
  • Softmaker PlanMaker对应 planmaker21.desktop
  • Softmaker Presentations对应 presentations21.desktop

然后打开终端,针对不同格式执行以下命令:

  • 锁定docx格式默认用Softmaker Writer:
    xdg-mime default textmaker21.desktop application/vnd.openxmlformats-officedocument.wordprocessingml.document
    
  • 锁定xlsx格式默认用Softmaker PlanMaker:
    xdg-mime default planmaker21.desktop application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
    
  • 锁定pptx格式默认用Softmaker Presentations:
    xdg-mime default presentations21.desktop application/vnd.openxmlformats-officedocument.presentationml.presentation
    

执行完后可以验证设置是否生效,比如查询docx的默认应用:

xdg-mime query default application/vnd.openxmlformats-officedocument.wordprocessingml.document

如果输出是textmaker21.desktop,说明设置成功了。

方法2:修改LibreOffice的关联配置,让它不再抢格式

如果你不想用命令行,也可以直接修改LibreOffice的.desktop文件,移除它对Office格式的关联:

  1. 打开终端,编辑LibreOffice Writer的配置文件:
    sudo nano /usr/share/applications/libreoffice-writer.desktop
    
  2. 找到MimeType这一行,把里面的application/vnd.openxmlformats-officedocument.wordprocessingml.document(也就是docx格式)删掉;
  3. 同理,对libreoffice-calc.desktop(移除xlsx格式)和libreoffice-impress.desktop(移除pptx格式)做相同操作;
  4. 保存退出后,重启GNOME会话(注销再登录)即可。

不过这个方法有个小缺点:LibreOffice更新时,这些.desktop文件可能会被重新覆盖,到时需要再改一次。所以更推荐方法1。

方法3:阻止LibreOffice更新时重置默认应用

如果上面的方法还是不管用,可以通过dpkg的配置来跳过LibreOffice更新时的默认应用重置步骤:

  1. 创建一个dpkg配置文件:
    sudo nano /etc/dpkg/dpkg.cfg.d/99-no-libreoffice-mime
    
  2. 在文件里添加以下内容:
    path-exclude=/usr/share/applications/libreoffice-*.desktop
    
  3. 保存退出,这样后续LibreOffice更新时,系统不会替换它的.desktop文件,你的自定义关联就不会被重置了。

备注:内容来源于stack exchange,提问作者Hinz

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.23 09:42:40