So, I’d prefer to use squashfs images as compressed archives, instead of something like tar. You don’t have to decompress the whole thing to see what’s inside, and once mounted they’re transparent to applications.
Ideally, I’d be able to double-click a .squashfs file in Dolphin, and get a mountpoint. A real one, that anything can understand, not a kio mount point. Nautilus can do this, with the gnome-disk-image-mounter handler.
I was hoping I could hook a script up to the application/vnd.squashfs mime type and have it Just Work. What I have so far is this:
#!/usr/bin/env bash
set -eux
loopdev="$(udisksctl loop-setup --file "$@" --read-only | grep --only-matching -E "/dev/loop\w+")"
udisksctl mount -b "$loopdev"
It half-works, in that if I run the script with the squashfs as the argument, it gets mounted at /run/media/$USER/disk. But, the mount point doesn’t appear on the left panel of Dolphin under “devices”, like with regular removable disks. Which means there is no way to un-mount it.
Un-mounting also needs to be followed by a udisksctl loop-delete, which I assume I will need to hook up to the eject button somehow.
And ideally, Dolphin would automatically cd into the just-mounted squashfs.
Any tips on what all I need to touch to make this work?
I thought you had pointed me down a rabbit hole, but in fact the hole turned out to be quite a bit shallower than it first appeared
If I name a squashfs foo.iso instead of foo.squashfs… the mountiso plugin mounts it. So I think if application/vnd.squashfs is added to the list of mimetypes it accepts, that might just be enough to get it working as well as mountiso does. However… there are two warts.
Once I have mounted and unmounted an .iso (even a real one) this way, the item is not removed from the devices list. It seems to be lacking the dbus equivalent of udisksctl loop-delete.
The UX would be better if this could be bound as the default association for application/vnd.squashfs, instead of being buried in the context menu.
The path device.udi() might not be matching or the call might be incorrect, or not handled in KIO PlacesModel.
There is no way to have dolphin allow this, by design. This would at least require some user input. Because we don’t want plugins to silently replace a very common entry point.
We have an option “Open archives as folder”, but given iso/squashfs is not a very common use case, I wouldn’t consider specific code for those.
There X-KDE-Priority=TopLevel for the desktop file you can tweak locally.
Yes and you can minimally build only dolphin and dolphin-plugins, no need to build KDE Frameworks and plasma with kde-builder --no-include-dependencies dolphin dolphin-plugins.
This will save you some time, you need a distro with fresh versions for this method to work.