1

Let's say I have xarchiver installed by default, and associated by default with most archive types.

I've installed engrampa, and now want to assciate it with the various archive types instead. I don't want to change each MIME association individually.

When I uninstalled xarchiver, the associations for various archive types automatically changed to engrampa.

Is there a way to do this without uninstalling xarchiver? Something like "assciate application X with all MIME types it supports"?


I'm using Fedora 38 XFCE spin, if it matters.

4
  • superuser.com/questions/720754/…
    – Michael D.
    Commented Jul 16, 2023 at 10:03
  • @MichaelD. With what flags should I run mimeopen? Commented Jul 16, 2023 at 10:07
  • You can query a file with xdg-mime and change it either systemwide /usr/share/applications/mimeapps.list or per user ~/.local/share/applications/defaults.list (see link). However, there should be a xfce system dialog setting to change it as well. See "Others - MIME Type Editor" near end of this page docs.xfce.org/xfce/xfce4-settings/preferred-apps
    – Michael D.
    Commented Jul 16, 2023 at 10:37
  • @MichaelD. Note the "I don't want to change each MIME association individually." part of the question. I know how to change the association for an individual MIME type. I'm asking how to do it for all types an application supports at once. I believe it's possible, since uninstalling xarchiver automatically associated numerous archive types with the remaining archiver engrampa. Commented Jul 16, 2023 at 11:06

1 Answer 1

2

To set default application use this command (untested) (copy & paste in console):

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

Output of:

cat engrampa.desktop | grep "MimeType" | cut -d"=" -f2 | tr ";" "\n" | xargs -n1 printf "xdg-mime default engrampa.desktop %s; \\ \n"

the file engrampa.desktop should could be located at

~/.local/share/applications

and looks like this

https://github.com/mate-desktop/engrampa/blob/master/data/engrampa.desktop.in.in

If you don't find it use the find command

2
  • The xarchiver vs engrampa situation was used only as an example, and hardcoding the list of archive formats in this answer is probably not the best idea. It should be possible to grep the desktop file for a list of supported MIMEs to automate this. And it's a little sad that there's no built-in tool for this. :( Commented Jul 16, 2023 at 11:55
  • 1
    I did "grep" the desktop file and generated this list - cat engrampa.desktop | grep "MimeType" | cut -d"=" -f2 | tr ";" "\n" | xargs -n1 printf "xdg-mime default engrampa.desktop %s; \\ \n"
    – Michael D.
    Commented Jul 16, 2023 at 12:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .