[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

@anon93652015 "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

Hello :slight_smile: Thank you for the wiki !

I found somewhere on the web on how to add Thunar’s bulk-rename as context menu for those interested.

Here’s the Nemo action:

[Nemo Action]
Name=Bulk Rename 
Comment=Bulk Rename
Exec=Thunar --bulk-rename %F
Icon-Name=system-file-manager
Selection=Any
Extensions=any;
EscapeSpaces=true

If there’s something wrong with it, don’t hesitate to give me some heads-up ! It works as expected but I’m not sure about all those “variables” ? (EscapeSpaces?).

Nice. You could instead use Nemo’s built-in command for using a bulk renaming tool/command and add the same command, or a different one, like krename

The main variable is that you would need to have Thunar installed. :wink:

2 Likes

Oh wow thank you :slight_smile: Didn’t knew that was possible in Nemo, I searched for hours and the only solution that popped up was a Nemo action.

As XFCE default’s to Thunar and because I’m very new to EOS I’m not very keen to completely delete Thunar without fearing to break anything (But that’s out of topic).

I’m glad I posted this :slight_smile: Learned 2 new things ! Thank you.

You couldn’t remove Thunar from Xfce without forcing the removal of Xfce anyway.

Each DE has a file manager that cannot be removed without removing the DE as well. I mean, you could remove it, but you’d have to force it with an unrecommended command, like sudo pacman -Rdd pkgname. ← Don’t ever use this unless you are sure you need to.

The opposite is not true, though.

A file manager does not need a specific DE, so these can be installed on any DE without having to install the entire DE itself. I have both Dolphin and Nemo installed on my system, but I mostly use Openbox and i3 (for daily tasks and work) and Hyprland (for gaming).
I also have Cinnamon installed, but I can remove it and keep Nemo if I no longer want it.

So, if you’d like to use Nemo while also using Xfce, you can if you want. :wink:

PS: Openbox and i3 are window managers (WM), not desktop environments (DE).
To limit issues, you should only have one DE installed, though Xfce doesn’t usually have issues with other DEs because it is not a full DE, and is component-based.