[Wiki] Customising Nemo's Context Menu With Nemo Actions

A quick wiki on how to customise Nemo’s context menu to have some options you may want. In this example, I’ve decided to add two archive manager-based options, but you can add more, like “Open in Meld”, “Open in Ranger”, etc.

To find the correct command for the program you’d like to load, open a terminal and type the program name followed by “-h” or “--help”.

Another option is to type “man programName” to open the manual.

Example:

meld -h

NEMO


This first action will extract files from an archive in the current directory and close immediately.

[Nemo Action]
Active=true
Name=Extract Files...
Comment=Extract archives here
Icon-Name=archive-extract
Exec=engrampa -h %F
Selection=Any
Extensions=any;
Quote=double

Note: Where the actions says “Extensions=any;", you may add specific filetypes. However, this is not recommended as there are many filetypes that use a compression method (LibreOffice files, Krita files, etc.) that could be accessed/extracted in case there is an issue opening the file with its default app.

If you decide to add specific filetypes, then do it like so:

Extensions=exe;dll;msi;zip;gz;bz2;7z;rar;tar;xz;iso;zst;cbz;cbr;ora;svg;

The second action will use engrampa to compress all your selected files.

[Nemo Action]
Active=true
Name=Compress...
Comment=Create a compressed archive
Icon-Name=archive
Exec=engrampa -d %F
Selection=Any
Extensions=any;
Quote=double

Finally, like the Arch wiki says: save the actions in the folder below with the extension .nemo_action.

~/.local/share/nemo/actions/coolActionName.nemo_action

Why not just use file-roller?

Well, recently, file-roller has started using libadwaita. This means if I want to compress something, and I use a dark theme, I’ll get a big light-themed window now. So, rather than give myself a headache when compressing files in the dark, I’ve switched to Engrampa instead.


Why not just right-click and choose “Open With”, then click on Engrampa?
Because that’s an extra menu/step (a few, actually), and I don’t want to use the “Open With” dropdown unless I am selecting an alternative to my default program.


What about using Xarchiver instead?
Engrampa uses a similar base as Gnome’s original file-roller prior to the libadwaita update, so it will both look familiar and be more compatible when it comes to the commands and/or UI/UX.

Of course, if you prefer Xarchiver or even Ark, you should be able to create an action with the same or similar functionality.


Why not just use nemo-engrampa from the AUR?
Good point. But also, actions can’t break in a failed AUR update… :eyes:


MELD


[Nemo Action]
Active=true
Name=Compare in Meld
Comment=Compare the selected files and folders in Meld
Icon-Name=meld
Exec=meld --diff %F
Selection=Any
Extensions=any;
Quote=double

PS: If there are any unnecessary parts in the actions I’ve given as examples, please let me know.


Edit: Added icons to the three examples, and added more extension examples.


A few more Nemo Actions I’ve made, including other scripts, can be found below.
Extra: Useful and "Use Less" Scripts

4 Likes

@ddnn "Why not just use file-roller?

Well, recently, file-roller has started using libadwaita. This means if I want to compress something, and I use a dark theme, I’ll get a big light-themed window now. So, rather than give myself a headache when compressing files in the dark, I’ve switched to Engrampa instead."

my nemo-fileroller also ignores system theme but does the opposite: gives me a black so dark like a megasuperArc-Deepest-Darkest or something. I can’t find my way around in that BS like you can’t find your way around the bright room it gives you…

so: theming is the problem according to my anecdote.
also engrampa an xfce thing, right? I think there is an “lx”-prefixed thing in my lxde.

interesting tutorial may give it a whirl.

1 Like

For the only app I have, not following the theme set, I had to modify the .desktop file, in your case it would be something like this :

Exec=env GTK_THEME=my_theme file-roller --extract %F
2 Likes

Maybe lxappearance? Doesn’t work on libadwaita apps for me.

Engrampa is from Mate. I think Xfce uses Xarchiver by default. Engrampa is based on Gnome’s original file-roller, so the features and/or commands are probably the same, making it a better replacement than Xarchiver.

2 Likes

This would be great, except there’s the fact that it would still open a huge window in comparison to the previous version of file-roller and the current version of engrampa.

Don’t need a huge window just for file archiving.

And yes, I can resize the window, but then it’s going to look stupid and clunky.

EDIT: Just reinstalled and tried it. The window is not resizeable, and it is twice the size of the engrampa or previous file-roller window.

Also, where it says “my_theme”, I’d have to place the actual name of my theme, correct? If so, this is inefficient because I have over 10 dark themes that I switch between when I feel like it. I’d have to create a script just to have it check my default theme.

Yes, creating actions are essentially creating scripts, but these are actually more reasonable by a mile imho.

I hate when that happens and it does happen

I use xarchiver, there’s a “save geometry” setting.

Wasn’t your comment for file-roller and not Xarchiver?

You mean for the theme ? yes.
I’m just saying for window geometry issue, there’s another alternative which is xarchiver.

I know. I chose engrampa over Xarchiver for compatibility/familiarity. Will edit the wiki again to indicate this later.

I use the command line for my custom actions in thunar, for example create an archive from a directory :

tar -cf %n.tar.zst -I 'zstd -19 -T0' %n
1 Like