4

Nautilus and Thunar have a such context menu option under Properties/Permissions, but not PCManFM, Lubuntu's default file and desktop manager (at least not yet in the present v. 1.1.).

But under "Open with"/(again)"Open with"/"Custom command line", it is possible to add new custom commands.

enter image description here

enter image description here

This creates a file with extension .desktop in ~/.local/share/applications which can be edited further so as to get a proper name and icon.

What is the command to add in this way for making a file executable?

That is: how to use sudo chmod +x filename to make it work in this way?

1 Answer 1

3

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

You must log in to answer this question.