This is a short and sweet post about creating Nemo Actions in Linux Mint.
Since moving from Windows 10 and daily-driving Linux Mint. There’s been few things I’ve missed. However, one small feature of the Windows file explorer I’ve been missing has been the “Copy Full Path” when you select a file, hold shift and right click.
This small feature copies the full path of the file to your clipboard. And I’ve just come to realise how much I miss it.
Luckily, instead of formatting the SSD and re-installing Windows 10/11 (with all the AI crapware it now comes with), I can just customise my Linux install.
The default file browser in Linux Mint is called Nemo. It’s simple, does the job and is extensible.
The Nemo Action
Writing your own menu items (the options that pop up in this menu when you right click a file) is really simple. You create a file per action inside the following folder on your machine:
~/.local/share/nemo/actions
Call the file anything you like, however it has to have the following file extension:
.nemo_action
Then, we just have to follow a specific format, which will allow Nemo to pickup our action and display it in the context menu.
My Nemo action to mimic the Windows functionality I talked about earlier (without the inconvenience of having to hold shift) looks like this:
[Nemo Action]
Name=Copy Full Filepath
Comment=Full Path: %F
Exec=sh -c "readlink -f %F | xclip -selection clipboard"
Icon-Name=gtk-copy
Selection=notnone
Extensions=nodirs
Separator=,
Dependencies=readlink;xclip;
Here’s a quick rundown of the options I’ve entered and what they do:
- Name - the Name of the action which will be displayed in the menu
- Comment - this is some text which appears of the current Nemo window, it shows up when the mouse is hovered over this action
- Exec - what commands you want to run when it is clicked
- Icon-name - Choose a nice/appropriate icon for your action
- Selection - “notnone” - a file must be selected for this action to be visible
- Dependencies - these are the packages that must be installed for this action to work. If these aren’t installed, Nemo wont show the action
Dependencies
This action relies on readlink
to be installed, which given a file, outputs its full filepath. I then pipe the output into xclip
which copies the full file path to the clipboard.
Simple as that. My new Nemo action looks like this:
Further readings
This Github repo has a ton of great examples to give you inspiration/get you started on more complex actions.
Thanks for reading!
- Previous
F# and Home Assistant helping take the bins out on time - Next
2024 - My year of the Linux desktop