Adding "Extract here" back to the right click menu?

So, today I finally uninstalled Ark since I decided to use Engrampa, and I was wondering if the "Extract here" option could be manually added somehow to the right click context menu. I already found a tutorial for Thunar:

In order to fix this, you will need to create a file in /usr/lib/x86_64-linux-gnu/thunar-archive-plugin called "engrampa.tap" and paste the following code into it.

!/bin/sh
#
# engrampa.tap - Wrapper script to create and extract archive files
#                   in Thunar, via the thunar-archive-plugin, using the
#                   engrampa archive manager.

# determine the action and the folder, $@ then contains only the files
action=$1; shift;
folder=$1; shift;

# check the action
case $action in
create)
	exec engrampa "--default-dir=$folder" --add "$@"
	;;

extract-here)
	exec engrampa "--extract-to=$(pwd)" --extract-here --force "$@"
	;;

extract-to)
	exec engrampa "--default-dir=$folder" --extract "$@"
	;;

*)
	echo "Unsupported action '$action'" >&2
	exit 1
esac

After you save it, all you need to do is make it executable with a "chmod +x" and then restart Thunar and you should be good to go.

...but I am using Dolphin. Is this possible? Thank you very much in advance.

Yes, is possible. You can play around more if you want too, but i'm not impressed by what it performs in KDE Plasma Dolphin (totally different than Thunar or Caja in a GTK environment) ...
Create ~/.local/share/kservices5/ServiceMenus/extracthere_engrampa.desktop folders/file and paste this code in it:

[Desktop Entry]
Actions=extractHere;extractTo;compress
Icon=engrampa
Name=Engranpa Archiver
ServiceTypes=KonqPopupMenu/Plugin,inode/directory,all/allfiles
Type=Service
Encoding=UTF-8
X-KDE-Priority=TopLevel
X-KDE-StartupNotify=false

[Desktop Action extractHere]
Exec=engrampa "--extract-to=$(pwd)" --extract-here --force "$@"
Icon=engrampa
Name=Extract Here

[Desktop Action extractTo]
Exec=engrampa "--default-dir=$folder" --extract "$@"
Icon=engrampa
Name=Extract to ...

[Desktop Action compress]
Exec=engrampa "--default-dir=$folder" --add "$@"
Icon=engrampa
Name=Create Archive

Open Dolphin > Configure > Services and activate the 3 that have then Engranpa icon.
The problem with this approach is that all files/folders/archive will display those options ALWAYS.

The smart way is to define, for the extract part what filetype of archives to handle, so they display only for those particular files/archives. That is why, for instance if you compare with the 7z actions menu that you can download, you will see that each has a long and different list of ServiceTypes for extract ... and only the compress has the ServiceTypes i used above in my generic example. So, that means you will have to create at least two desktop files, one for extract and one for compress aka create archive, but i honestly will not continue with examples as it takes way too much time to explain.
Here is a list for the ServiceTypes extract part:

ServiceTypes=KonqPopupMenu/Plugin,KonqPopupMenu/Plugin,application/x-7z-compressed,application/x-lha,application/x-arj,application/x-cd-image,application/x-rpm,application/x-deb,application/x-cpio,application/x-cpio-compressed,application/zip,application/x-ace,application/x-bzip,application/x-gzip,application/x-rar,application/x-bzip-compressed-tar,application/x-tar,application/x-compressed-tar

In order for those options to be seen without subMenu (Ark and 7z has that submenu), the X-KDE-Submenu entry has to not exist in the desktop file (the way i have it in my example if it happens that you will look at the 7z menu actions).

Cheers!

5 Likes

It is working like a charm now. Thank you very much!

1 Like

Took a while to find, so here's a link:

Just what I wanted, but I didn't know such a thing existed, and until I went looking for it, I didn't know there are Service Menus in the KDE store.

Forum kindly sponsored by Bytemark