Considering the example from the answer - of using the "Open with" option:
The command sudo chmod +x
must run in a terminal (gnome-terminal -e "sudo chmod +x %f"
) or alternatively the line Terminal=true
should be in a desktop file in ~/.local/share/applications/make_exec.desktop
:
[Desktop Entry]
Name=Make file executable
Exec=sudo chmod +x %f
Icon=path/to/icon
Terminal=true
Type=Application
StartupNotify=true
NoDisplay=true
MimeType=text/plain;
For an application to appear in the context menu, it may need a desktop file in /usr/share/applications
, but also you may need to edit as administrator /usr/share/applications/mimeinfo.cache
and in the line of the intended file type to add the application.desktop.
So, in the present case, open /usr/share/applications/mimeinfo.cache
and add make_exec.desktop
to the line text/plain
.
Considering the creation of custom actions - like in Thunar, Nautilus or Dolphin:
PCManFM supports custom actions.
Those created with Nautilus configuration tool (for Nautilus) appear in PCManFM too. These are .desktop files created in ~/.local/share/file-manager/actions
. So, they can be added manually without the Nautilus tool.
The form of these files should be like those presented here or here.
So, for the present purpose, create the file ~/.local/share/file-manager/actions/make_executable.desktop
with these lines:
[Desktop Entry]
Name = Make executable
Tooltip = Make this file executable
Icon = terminal
Profiles = make_exec;
[X-Action-Profile make_exec]
Name = Make executable
MimeTypes = text/plain;
SelectionCount = 1
Schemes = file;
Exec = sudo chmod +x %f