Actions enable you to add custom entries in Nemo's context menus.
At its most basic, an action can be defined by a single file.
- An action file must end in
.nemo_action
- It can be placed in any data location under nemo/actions (for instance, /usr/share/nemo/actions, or ~/.local/share/nemo/actions). You should install user actions under your home folder.
[Nemo Action]
Name=Start glxgears
Exec=glxgears
Selection=any
- Name is the label for the action to display in the menu.
- Exec is the command to be executed when the menu item is selected.
- Selection allows you to set some basic selection criteria for showing the menu item. In this case, the menu item will always be visible in the context menu.
Tokens allow you to insert additional information into certain fields based on the current selection.
[Nemo Action]
Name=Perform magic in %f
Exec=magic %F
Selection=single
Note the Selection field here is single
, which causes this action to only be displayed if the current selection is of exactly one file.
- The
%f
token in the Name field will be replaced by the selected file's display name (anything left of the final.
in a filename). If you were to right click on fileMundania.txt
, the menu item would be labeledPerform magic in Mundania
. - The
%F
token in the Exec field will be replaced by the file's full path. Activating this action will result inmagic /home/you/Mundania.txt
being executed.
Token | Description |
---|---|
%U | insert URI list of selection |
%F | insert path list of selection |
%P | insert path of parent (current) directory |
%f | insert display name of first selected file |
%p | insert display name of parent directory |
%D | insert device path of file (i.e. /dev/sdb1) |
%e | insert display name of first selected file with the extension stripped |
%% | insert a literal percent sign, don't treat the next character as a token |
%X | insert the XID for the NemoWindow this action is being activated in. |
%N | (deprecated) insert display name of first selected file - same as %f |