Page 1 of 1

mount .iso file with custom action in Dolphin

Posted: Sun May 23, 2021 12:09 pm
by tony37
Sometimes I want to check some files on the file system of an .iso file, and instead of using a Virtualbox, I found out someone has written the very useful /usr/local/bin/isomount program, which mounts .iso files at /mnt/iso.
And to make live a tad easier, I created a custom action for Dolphin (in KDE), so I can right-click an .iso file and select 'isomount'. For this I created a file called /usr/share/kservices5/ServiceMenus/isomount.desktop with following content:

Code: Select all

[Desktop Entry]
Type=Service
X-KDE-ServiceTypes=KonqPopupMenu/Plugin
MimeType=application/x-cd-image;
Actions=isomount;
X-KDE-AuthorizeAction=shell_access

[Desktop Action isomount]
TryExec=konsole
Exec=konsole -e bash -c 'isomount "${@}"; ANYKEY="Press any key to close"; ANYKEY=$(gettext -d mx-goodies "$ANYKEY"); echo; read -n 1 -s -r -p "$ANYKEY"' bash %F
Icon=emblem-mounted
Name=Isomount

Comment=mount iso file at /mnt/iso
If anyone else finds this useful, then maybe someone can write a custom action for Thunar and maybe this could be added to MX 21...

Re: mount .iso file with custom action in Dolphin

Posted: Mon May 24, 2021 2:44 am
by m_pav
Nice! Not a KDE user myself, but maybe you could get Adrians attention for his next build.

Re: mount .iso file with custom action in Dolphin

Posted: Mon May 24, 2021 10:14 am
by dolphin_oracle
quick question: do dolphin custom actions show up even if the target utility is not present? (I presume yes, but thought I would ask).

Re: mount .iso file with custom action in Dolphin

Posted: Mon May 24, 2021 10:17 am
by tony37
so you mean when there's no 'isomount' installed? yes, it still shows, opening bash with 'command not found'
or do you mean if there's no 'konsole' installed? well, if I deliberately misspell 'konsole' as 'konsol', then I still have a custom action for .iso files, but getting a window with: can't find program 'konsol'

Re: mount .iso file with custom action in Dolphin

Posted: Mon May 24, 2021 11:08 am
by dolphin_oracle
tony37 wrote: Mon May 24, 2021 10:17 am so you mean when there's no 'isomount' installed? yes, it still shows, opening bash with 'command not found'
or do you mean if there's no 'konsole' installed? well, if I deliberately misspell 'konsole' as 'konsol', then I still have a custom action for .iso files, but getting a window with: can't find program 'konsol'
I meant about isomount, but either works for my purposes, thanks.

Re: mount .iso file with custom action in Dolphin

Posted: Mon May 24, 2021 11:39 am
by tony37
I've noticed one tiny bug with this custom action: in the resulting terminal, I get errors about 'line 1366: losetup: command not found'
This doesn't cause problems, but I don't get these errors when I manually do 'isomount path_to_iso_file'

edit: now I remember my solution (I had reinstalled the isomount package): change line 1366 to

Code: Select all

    /usr/sbin/losetup -nl -O name,back-file | grep "^$dev " | sed -r 's/^[^ ]+ +//'
(so specifying the location of losetup)