This is an old revision of the document!
Scripts for PCManFM
PCMan File Manager (PCManFM) is a file manager designed to be a lightweight and fast replacement for Nautilus or Konqueror, for example. It aims to be a usable file manager (and nothing more) and follows the Freedesktop.org standards. For basic usage and on which platforms the program is available [:built_file_manager|read more about here].
MIME types
Unlike Windows systems, it is much less common in Linux to identify files by their ‘file extensions’. Instead, the operating system recognises the file type based on file permissions and metadata, not just the extension. However, common file extensions are still used for organisation and compatibility, for example for compressed archives such as .gz and .bz2 or Office formats such as .odt and .docx or for some special usage like make
So yes, we are talking about MIME (aka Multipurpose Internet Mail Extensions) types, rather then file extenions. Best praxis to determine the MIME-type that PCManFM uses is, if you just right-click the file and then read it's properties. Or you can just select the file and you'll the file-description into the down-left corner of the filemanager. Valid descriptions are plain/text or inode/directory (for directories) or application/zip - you've got the idea.
Link a MIME type to an application (manual)
You doubleclick on a file that is not yet bound to an application then a small window appears, asking which application should be used in future to open. You click on Custom Command Line and from there type the command or browse through your filesystem.
Important steps:
- Fill in Application name (name it as you like)
- tick: Set selected application as default for this file type
So the needed data was set to: /userdata/system/.config/mimeapps.list, if you edit this file you will see an entry like
[Default Applications] font/ttf=userapp-l3afpad-UMKSE3.desktop
So you see: I associated MIME font/ttf and used l3afpad as application.
The .desktop-file contains all the additional data and can be found in /userdata/system/.local/share/applications from here you can change some values or set your own script in the EXE-Section and see even the Name you gave it. Type=Application is important here, this will indicate PCManFM that this file is an application type.
[Desktop Entry] Type=Application Name=Open TTF Exec=l3afpad %f Categories=Other; NoDisplay=true MimeType=font/ttf Terminal=false
PCManFM special descriptors
….. write here how %F &f works and some other thing like general MIME
PCManFM creating an entry in Contextmenu and using Cascaded Contextmenus
Set an entry as Contextmenu
If you place your .desktop files to /userdata/system/.local/share/file-manager/actions/ you can create entries in context menus by right clicking on a file or folder. I've created a small application that calculates the md5sum of all selected files. Talking about the Type you see here the Type=Action is present. You'll also need the profile settings.
[Desktop Entry] Type=Action Name=Show md5 Checksum Profiles=Desktop [X-Action-Profile Desktop] MimeTypes=all/allfiles Exec=bash -c "md5sum %F | yad --text-info"
Creating a Cascaded Contextmenu
Again, just change the Type you want to descripe into the .desktop file and use Type=Menu - rather undocumented it seems not to work to set the Name only instead use Tooltip to get the name readable. Then arrange just types of .desktop-files you want into your ItemList (remember, only the one placed in the DIR action will work) and just dismiss the desktop-extension.
[Desktop Entry] Type=Menu Icon=menu Name= Tooltip=★ Misc. Actions > ItemsList=md5sum;further-action-1;further-action-2;
- scripting_pcmanfm.1761566880.txt.gz
- Last modified: 6 months ago
- by crcerror