如何在PCManFM的上下文菜单中添加“使文件可执行”的选项?

Nautilus和Thunar在“属性/权限”下有这样的上下文菜单选项,但是PCManFM没有,它是Lubuntu默认的文件和桌面管理器(至少目前版本1.1还没有)。
但是在“打开方式”/(再次)“打开方式”/“自定义命令行”下,可以添加新的自定义命令。

enter image description here

enter image description here

这将在~/.local/share/applications中创建一个扩展名为.desktop的文件,可以进一步编辑以获得适当的名称和图标。
以这种方式添加文件可执行的命令是什么?
也就是说,如何使用sudo chmod +x filename使其按照这种方式工作?
1个回答

考虑到使用“打开方式”选项的示例:
命令sudo chmod +x必须在终端中运行(gnome-terminal -e "sudo chmod +x %f"),或者可以将Terminal=true这一行添加到位于~/.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;

为了让应用程序出现在上下文菜单中,它可能需要在/usr/share/applications目录下有一个桌面文件,但是你也可能需要以管理员身份编辑/usr/share/applications/mimeinfo.cache文件,并在所需文件类型所在的行添加application.desktop。
所以,在这个例子中,打开/usr/share/applications/mimeinfo.cache文件,在text/plain行中添加make_exec.desktop。
考虑创建自定义操作,类似于Thunar、Nautilus或Dolphin:
PCManFM支持自定义操作。
使用Nautilus配置工具(用于Nautilus)创建的操作也会出现在PCManFM中。这些是在~/.local/share/file-manager/actions目录下创建的.desktop文件。因此,可以手动添加而不使用Nautilus工具。
这些文件的格式应该像这里herehere中所示的那样。
因此,为了当前目的,请创建文件~/.local/share/file-manager/actions/make_executable.desktop,并添加以下内容:
[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