![如何将应用程序与其支持的所有 mime 类型关联起来?](https://linux22.com/image/222535/%E5%A6%82%E4%BD%95%E5%B0%86%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E4%B8%8E%E5%85%B6%E6%94%AF%E6%8C%81%E7%9A%84%E6%89%80%E6%9C%89%20mime%20%E7%B1%BB%E5%9E%8B%E5%85%B3%E8%81%94%E8%B5%B7%E6%9D%A5%EF%BC%9F.png)
假设我已xarchiver
默认安装,并默认与大多数存档类型关联。
我已经安装了engrampa
,现在想将其与各种存档类型相关联。我不想单独更改每个 MIME 关联。
当我卸载时xarchiver
,各种存档类型的关联自动更改为engrampa
.
有没有办法在不卸载的情况下做到这一点xarchiver
?类似于“将应用程序 X 与其支持的所有 MIME 类型相关联”?
如果重要的话,我正在使用 Fedora 38 XFCE spin。
答案1
要设置默认应用程序,请使用此命令(未经测试)(在控制台中复制并粘贴):
xdg-mime default engrampa.desktop application/epub+zip; \
xdg-mime default engrampa.desktop application/x-7z-compressed; \
xdg-mime default engrampa.desktop application/x-7z-compressed-tar; \
xdg-mime default engrampa.desktop application/x-ace; \
xdg-mime default engrampa.desktop application/x-alz; \
xdg-mime default engrampa.desktop application/x-arc; \
xdg-mime default engrampa.desktop application/x-arj; \
xdg-mime default engrampa.desktop application/x-brotli; \
xdg-mime default engrampa.desktop application/x-brotli-compressed-tar; \
xdg-mime default engrampa.desktop application/x-bzip; \
xdg-mime default engrampa.desktop application/x-bzip2; \
xdg-mime default engrampa.desktop application/bzip2; \
xdg-mime default engrampa.desktop application/x-bzip-compressed-tar; \
xdg-mime default engrampa.desktop application/x-bzip1; \
xdg-mime default engrampa.desktop application/x-bzip1-compressed-tar; \
xdg-mime default engrampa.desktop application/x-cabinet; \
xdg-mime default engrampa.desktop application/x-cbr; \
xdg-mime default engrampa.desktop application/x-cbz; \
xdg-mime default engrampa.desktop application/x-cd-image; \
xdg-mime default engrampa.desktop application/x-compress; \
xdg-mime default engrampa.desktop application/x-compressed-tar; \
xdg-mime default engrampa.desktop application/x-cpio; \
xdg-mime default engrampa.desktop application/vnd.debian.binary-package; \
xdg-mime default engrampa.desktop application/x-ear; \
xdg-mime default engrampa.desktop application/x-ms-dos-executable; \
xdg-mime default engrampa.desktop application/x-gtar; \
xdg-mime default engrampa.desktop application/x-gzip; \
xdg-mime default engrampa.desktop application/gzip; \
xdg-mime default engrampa.desktop application/x-gzpostscript; \
xdg-mime default engrampa.desktop application/x-java-archive; \
xdg-mime default engrampa.desktop application/x-lha; \
xdg-mime default engrampa.desktop application/x-lzh-compressed; \
xdg-mime default engrampa.desktop application/x-lrzip; \
xdg-mime default engrampa.desktop application/x-lrzip-compressed-tar; \
xdg-mime default engrampa.desktop application/x-lzip; \
xdg-mime default engrampa.desktop application/x-lzip-compressed-tar; \
xdg-mime default engrampa.desktop application/x-lzma; \
xdg-mime default engrampa.desktop application/x-lzma-compressed-tar; \
xdg-mime default engrampa.desktop application/x-lzop; \
xdg-mime default engrampa.desktop application/x-lzop-compressed-tar; \
xdg-mime default engrampa.desktop application/x-ms-wim; \
xdg-mime default engrampa.desktop application/x-rar; \
xdg-mime default engrampa.desktop application/x-rar-compressed; \
xdg-mime default engrampa.desktop application/x-rpm; \
xdg-mime default engrampa.desktop application/x-source-rpm; \
xdg-mime default engrampa.desktop application/x-rzip; \
xdg-mime default engrampa.desktop application/x-tar; \
xdg-mime default engrampa.desktop application/x-tarz; \
xdg-mime default engrampa.desktop application/x-stuffit; \
xdg-mime default engrampa.desktop application/x-war; \
xdg-mime default engrampa.desktop application/x-xz; \
xdg-mime default engrampa.desktop application/x-xz-compressed-tar; \
xdg-mime default engrampa.desktop application/x-zip; \
xdg-mime default engrampa.desktop application/x-zip-compressed; \
xdg-mime default engrampa.desktop application/x-zoo; \
xdg-mime default engrampa.desktop application/zstd; \
xdg-mime default engrampa.desktop application/x-zstd; \
xdg-mime default engrampa.desktop application/x-zstd-compressed-tar; \
xdg-mime default engrampa.desktop application/zip; \
xdg-mime default engrampa.desktop application/x-archive; \
xdg-mime default engrampa.desktop application/vnd.ms-cab-compressed
输出:
cat engrampa.desktop | grep "MimeType" | cut -d"=" -f2 | tr ";" "\n" | xargs -n1 printf "xdg-mime default engrampa.desktop %s; \\ \n"
该文件engrampa.desktop
应该位于
~/.local/share/applications
看起来像这样
https://github.com/mate-desktop/engrampa/blob/master/data/engrampa.desktop.in.in
如果找不到它使用find
命令