AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题 / 1286360
Accepted
Lu Kas
Lu Kas
Asked: 2020-10-24 10:35:01 +0800 CST2020-10-24 10:35:01 +0800 CST 2020-10-24 10:35:01 +0800 CST

通过扩展而不是 mimetype 设置默认应用程序

  • 772

是否可以将默认应用程序设置为按扩展名而不是 mimetype 打开文件?

MuseScore 将其文件保存为 .mscz 文件,这些文件实际上只是包含 MuseScore 文件数据的 zip 存档。由于 Ubuntu 将其识别为 zip 存档,因此它会使用存档管理器打开它们。所以我总是必须右键单击并说Open with MuseScore,这很烦人。

如果我将 MuseScore 设置为 .mscz 文件的默认值,它将成为所有 zip 存档的默认值,这显然不是我想要的。因此,如果我可以将 MuseScore 设置为所有扩展名为 .mscz 的文件的默认值,那将很有用。

据我所知,我没有任何不是 MuseScore 文件的 .mscz 档案,所以这不是问题。如果我确实遇到了一些,我不介意处理。

default-programs mime-type extension
  • 1 1 个回答
  • 536 Views

1 个回答

  • Voted
  1. Best Answer
    BeastOfCaerbannog
    2020-10-24T10:49:51+08:002020-10-24T10:49:51+08:00

    尝试以下操作:

    1. 用于nano创建/usr/share/mime/packages/musescore3.xml文件:

      sudo nano /usr/share/mime/packages/musescore3.xml
      
    2. 复制并粘贴(使用Ctrl++ Shift)V以下内容:

      <?xml version="1.0" encoding="UTF-8"?>
      <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
        <mime-type type="application/x-musescore3">
          <comment>MuseScore file</comment>
          <sub-class-of type="application/zip"/>
          <glob pattern="*.mscz"/>
        </mime-type>
        <mime-type type="application/x-musescore3+xml">
          <comment>uncompressed MuseScore file</comment>
          <sub-class-of type="application/xml"/>
          <glob pattern="*.mscx" />
        </mime-type>
        <mime-type type="application/vnd.recordare.musicxml3">
          <!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
          <_comment>compressed MusicXML file</_comment>
          <sub-class-of type="application/zip"/>
      <!-- Note: a custom icon is used for MusicXML files. You can change this below -->
      <!--  <icon name="application-x-musescore"/> Uncomment to use MuseScore file icon -->
      <!--  <generic-icon name="audio-x-generic"/> Uncomment to use generic audio file icon -->
          <glob pattern="*.mxl"/>
        </mime-type>
        <mime-type type="application/vnd.recordare.musicxml3+xml">
          <!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
          <_comment>uncompressed MusicXML file</_comment>
          <sub-class-of type="application/xml"/>
      <!--  <icon name="application-x-musescore"/> Uncomment to use MuseScore file icon -->
      <!--  <generic-icon name="audio-x-generic"/> Uncomment to use generic audio file icon -->
          <magic>
            <match type="string" value="&lt;?xml" offset="0">
              <match type="string" value="score-partwise" offset="0:128"/>
              <match type="string" value="score-timewise" offset="0:128"/>
            </match>
            <match type="string" value="&lt;!--" offset="0">
              <match type="string" value="score-partwise" offset="0:128"/>
              <match type="string" value="score-timewise" offset="0:128"/>
            </match>
          </magic>
          <glob pattern="*.xml" weight="40"/>
        </mime-type>
        <mime-type type="application/vnd.recordare.musicxml3+xml">
              <!-- http://www.musicxml.com/for-developers/musicxml-dtd/ -->
              <_comment>uncompressed MusicXML file</_comment>
              <sub-class-of type="application/xml"/>
              <!--  <icon name="application-x-musescore"/> Uncomment to use MuseScore file icon -->
              <!--  <generic-icon name="audio-x-generic"/> Uncomment to use generic audio file icon -->
              <magic>
                    <match type="string" value="&lt;?xml" offset="0">
                          <match type="string" value="score-partwise" offset="0:128"/>
                          <match type="string" value="score-timewise" offset="0:128"/>
                    </match>
                    <match type="string" value="&lt;!--" offset="0">
                          <match type="string" value="score-partwise" offset="0:128"/>
                          <match type="string" value="score-timewise" offset="0:128"/>
                    </match>
              </magic>
              <glob pattern="*.musicxml" weight="40"/>
        </mime-type>
      </mime-info>
      
    3. nano使用Ctrl+O和Ctrl+保存并关闭X。

    4. 跑:

      sudo update-mime-database /usr/share/mime
      
    5. 然后right-click是 .mscz 文件,然后转到属性→打开方式 →从列表中选择MuseScoreSet as default → 。

    6. 如果这不能立即起作用,请重复步骤 5 为 zip 文件设置默认程序(存档管理器),然后对 Musescore 重复。

    以下屏幕截图是“属性”窗口的示例。

    特性

    • 2

相关问题

  • 文件扩展名/mime-types/icons/default 应用程序是如何关联的?

  • 更改 TreeStyleTab 选项卡栏中使用的字体 [关闭]

  • 如何调试 Nautilus 扩展?

  • 如何从命令行获取文件的 mime 类型?

  • 更改 Ubuntu 桌面应用程序启动器中显示的 Web 浏览器?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve