Skip to content
Michael Webster edited this page Sep 9, 2024 · 5 revisions

Nemo actions allow the user to add custom menu actions to apply to selected files. These can be one-shot commands or call their own scripts, and can be restricted to specific files by defining various conditions for the action.

Documentation and Quick Reference


About

Action files are just text files that end in .nemo_action and are stored in system and user data locations - /usr/share/nemo/actions, ~/.local/usr/share/nemo/actions (all of your environment's XDG_DATA_DIRS are scanned, though typically only the aforementioned are used).

These files are structured as follows (this is a standard keyfile syntax also used in application .desktop and config files):

[Nemo Action]

Name=Test action on file %f
Comment=If you click this menu entry, %F will be acted upon!
Exec=notify-send "Hey there" "This is the result of an action you ran on the file '%F' - well done"
Selection=s
Extensions=any;
Terminal=true
Icon-Name=face-smile

If you add this to a newly created file ~/.local/share/nemo/actions/my-test-action.nemo_action, and right-click on a single file in Nemo, this will appear in the menu. You should get the system notification immediately after you activate it.


Troubleshooting

For debugging actions, you can run Nemo as follows:

# First, kill any existing instances
nemo --quit
# Then relaunch with debugging enabled
NEMO_DEBUG=Actions nemo --debug

Tip

When debugging actions, it's usually a good idea to temporarily disable all but the action you're working with, to reduce the amount of logging output generated

With debugging enabled, you should get output that looks something like this when testing your action:

Nemo-DEBUG: nemo_action_update_display_state: ../libnemo-private/nemo-action.c:2011: Action 'new-sample' determined VISIBLE
Nemo-DEBUG: get_final_label: ../libnemo-private/nemo-action.c:1538: Action Label: Test action on file Documents
Nemo-DEBUG: get_final_tt: ../libnemo-private/nemo-action.c:1563: Action Tooltip: If you click this menu entry, /home/mtwebster/Documents will be acted upon!
Nemo-DEBUG: nemo_action_activate: ../libnemo-private/nemo-action.c:1462: Action Spawning: notify-send "Hey there" "This is the result of an action you ran on the file '/home/mtwebster/Documents' - well done"
Clone this wiki locally