Context menu in File managers for Ubuntu 24.04 - Nautilus vs Nemo vs Dolphin vs Caja

Where is a context menu customisation in Nautilus?

Page content

After installing fresh linux on fresh PC I was surprised that I could not find an easy way to customise context menu in Ubuntu 24.04.

I’ve got used to Customising Context Menu in Nemo / Linux Mint, and now such a surprise! New shiny Ubuntu doesn’t have it…

fish and submarine

The standard way it used to be and How it is now

To add a custom context menu (right-click menu) item to the Nautilus file manager in Ubuntu, you could use several methods depending on the needs and Ubuntu version:

1. Using Nautilus-Actions (FileManager-Actions)

This is the most user-friendly way to add custom actions to the Nautilus context menu.

Steps:

  1. Install Nautilus-Actions:
    sudo apt-get install nautilus-actions
    
  2. Launch the Nautilus-Actions Configuration Tool:
    nautilus-actions-config-tool
    
  3. Create a New Action:
    • Click on “Define New Action”.
    • In the Action tab, set the menu label and (optionally) an icon.
    • In the Command tab, specify the command or script you want to run when the menu item is clicked (e.g., /usr/bin/gedit for opening files in Gedit).
    • Use the Legend button to see available parameters (e.g., %f for the selected file).
    • In the Execution tab, choose whether the action should run in a terminal or normally.
  4. Save your action and reload Nautilus:
    nautilus -q
    
    Reopen Nautilus and your new context menu item should appear under the “Nautilus Actions” submenu. If not, log out and back in.

2. Using Python Nautilus Extensions

If you want more advanced or integrated functionality, you can write a Python script as a Nautilus extension.

Steps:

  1. Install the Python extension support:

    sudo apt-get install python3-nautilus
    
  2. Create the extensions directory (if it doesn’t exist):

    mkdir -p ~/.local/share/nautilus-python/extensions/
    
  3. Write your extension script (e.g., my_extension.py) in that directory. You can use the some example code as a template.

  4. Reload Nautilus:

    nautilus -q
    

    Your extension will add new context menu entries as defined in your script.

Method Difficulty GUI Support Custom Scripts Best For
Nautilus-Actions Easy Yes Yes Most users, simple actions
Python Nautilus Extensions Medium No Yes Advanced, integrated actions
  • Since Ubuntu 19.04, Nautilus-Actions is transitioning to FileManager-Actions, but the process remains similar.
  • For Ubuntu 21.10 and later, Python extensions and scripts are the most integrated way to add custom menu items.

The harsh reality of today

nautilus-actions is now abandoned in Debian and Ubuntu doesn’t have it anymore too. And same the filemanager-actions-nautilus-extension too.

there is still the way - Python scripts as Nautilus extensions though

And you can create a file in Templates folder and it will be used in the New Document context menu, but it’s not enough of customisation was looking for.

Alternative file managers

In place of Nautilus we can use Nemo, Caja, Dolphin or Thunar for context menu customisation.

Here is a comparison of context menu customisation capabilities in Nemo, Caja, Dolphin, and Thunar:

File Manager Custom Context Menu Support Method & Flexibility Notes
Nemo Yes Nemo Actions—GUI or manual editing; highly flexible You can add custom context menu entries for specific file types, commands, and scripts. Many users praise its extensibility.
Caja Limited No direct, built-in custom actions GUI Context menu customisation is not as robust as Nemo or Thunar. Some plugins exist, but flexibility is limited.
Dolphin Yes Service Menus—add .desktop files in specific folders; highly flexible Allows powerful custom actions for files and folders via service menu scripts. Good documentation, but setup is manual.
Thunar Yes Custom Actions—GUI for adding/editing; very user-friendly Easily add custom actions via GUI. You can specify file types and conditions for when actions appear.

Summary of strengths:

  • Nemo: Excellent, user-friendly customisation via Nemo Actions. Supports scripts, commands, and file type conditions.
  • Dolphin: Very flexible with service menus, though setup is more manual (editing files in ~/.local/share/kservices5/ServiceMenus/).
  • Thunar: Simple, intuitive GUI for custom actions. Great for quick, basic customisations.
  • Caja: Lacks a dedicated, user-friendly custom actions interface; less flexible than the others.

Recommendation:
For the most powerful and user-friendly context menu customisation, Nemo and Dolphin are top choices. Thunar is excellent for straightforward needs, while Caja is more limited in this aspect.

Installing and configuring Nemo

To install Nemo file manager, execute

sudo apt-get install nemo

There is a way to replace Nautilus with Nemo completely, but let’s not spend our time on this.

For Nemo configuring steps - see blog post Nemo Context Menu Customisation

Configuring the context menu in Dolphin

Install Doplpin

sudo apt update
sudo apt install dolphin
# sudo apt autoremove --purge dolphin

Notes:

  • On GNOME-based systems, installing Dolphin will add extra KDE libraries and dependencies (about 174MB or more)
  • If you are using Ubuntu Desktop or Server and get a “package not found” error, make sure the “universe” repository is enabled

context menu in Dolphin

To configure the context menu in Dolphin (the KDE file manager), you primarily use the concept of Service Menus. These are custom actions that appear when you right-click files or folders. Here’s how you can add and manage them:

1. Add Pre-made Actions via Dolphin’s GUI

  • Open Dolphin.
  • Go to SettingsConfigure Dolphin.
  • Select Services from the side menu.
  • Here, you can enable/disable installed context menu actions.
  • To add more, click Download New Services. This opens a window with easy-to-install add-ons for your context menus.

2. Create Custom Service Menus (Manual Method)

If you want to add your own custom actions—such as running scripts or commands—create a .desktop file in the ~/.local/share/kservices5/ServiceMenus/ directory.

Basic Example:

[Desktop Entry]
Type=Service
MimeType=all/all;
Actions=myCustomAction

[Desktop Action myCustomAction]
Name=Run My Script
Icon=utilities-terminal
Exec=/path/to/your/script.sh %F
  • MimeType controls when the menu appears (e.g., image/* for images, inode/directory for folders).
  • %F passes the selected files to your script.
  • Save the file with a .desktop extension in the ServiceMenus directory.
  • Restart Dolphin to see the new menu item.

3. Enable/Disable Context Menu Items

  • The enabled/disabled state for service menus is stored in ~/.config/kservicemenurc.
  • You can manually edit this file to control which service menus appear.

4. No Built-in GUI for Custom Actions

  • There isn’t a built-in GUI in Dolphin for creating your own custom service menus from scratch; you must create or install .desktop files as described above.

OK.

Method GUI Support Custom Commands Location
Download New Services Yes No Settings → Configure Dolphin → Services
Custom Service Menus No Yes ~/.local/share/kservices5/ServiceMenus/
Enable/Disable Actions Partial No ~/.config/kservicemenurc

Just remember to restart Dolphin after adding or editing service menus to apply your changes.

Caja

To configure the context menu in Caja (the MATE desktop’s file manager), you have several options depending on your needs:

1. Add Custom Actions with Caja-Actions Extension

The most powerful and flexible way to add custom entries to Caja’s right-click menu is by using the Caja-Actions extension. This tool lets you add arbitrary programs, scripts, or commands to the context menu.

How to use Caja-Actions:

  1. Install Caja-Actions:

    sudo apt install caja-actions
    
  2. Open the configuration tool:

    caja-actions-config-tool
    
  3. Create and manage actions:

    • Use the graphical interface to add new actions, specify the command or script to run, set conditions (like file types), and configure menu labels and icons.
    • You can also organize actions into submenus, reorder them, or import/export configurations.
  4. Restart Caja to apply changes:

    caja -q
    

    Then reopen Caja.

2. Use Caja Scripts

Caja also supports a Scripts submenu in the context menu. Any executable script you place in ~/.config/caja/scripts/ will appear here.

  • Create the scripts directory if it doesn’t exist:
    mkdir -p ~/.config/caja/scripts
    
  • Add executable scripts to this folder. They will show up under the “Scripts” submenu when you right-click a file or folder.

3. “Open With” Menu

The “Open With” context menu lets you open files with any installed application. You can customize which applications appear here by managing default applications or using the “Open With Other Application…” option.

Take away:

Method Custom Commands GUI Support Location/Tool
Caja-Actions Yes Yes caja-actions-config-tool
Scripts Submenu Yes (scripts) No ~/.config/caja/scripts/
“Open With” Menu No (apps only) Built-in Context menu → Open With

The same hint: After making changes, restart Caja with caja -q to ensure new menu items appear.

To add a context menu item to Thunar, the file manager for XFCE, use the built-in Custom Actions feature. This allows you to add commands, scripts, or applications directly to the right-click menu for files and folders.

Thunar: How to Add a Custom Context Menu Item

  1. Open Thunar.
  2. Go to Edit → Configure custom actions…
  3. In the dialog that appears, click the "+" button to add a new action.

Configure Your Custom Action

  • Name: Enter the name you want to appear in the context menu.
  • Description: Optionally, add a description.
  • Command: Enter the command, script, or application you want to run. You can use parameters like %f (selected file), %F (all selected files), etc.
  • Icon: Optionally, choose an icon for your menu entry.

Set Appearance Conditions

  • Go to the Appearance Conditions tab.
  • Specify when the action should appear:
    • File Pattern: e.g., *.txt for text files, or * for all files.
    • MIME Types: Check the boxes for file types (e.g., Text Files, Image Files).
    • Directories: Check if you want the action to appear for folders.
  1. Save your custom action.

The new action will now appear in the context menu when you right-click files or folders that match your specified conditions.

Some notes:

  • All custom actions are stored in ~/.config/Thunar/uca.xml for backup or manual editing.
  • You cannot rearrange the position of context menu items or remove built-in actions through the GUI.
  • For more advanced usage, see the Thunar documentation on custom actions.