I need to set up a script to run when various types of files are run in PCManFM. I right clicked on a file and used "Open With" to enter the name of the script. After that, I could see the new entry in the context menu when I right clicked, but only on files of the same MIME type as the one I originally created the entry for. So I went into the userapp-...desktop file and edited the MIMEType entry in various ways - first I tried completely deleting it, as I want all files to have this option. Then I tried adding additional MIME types separated by semi-colons. Nothing worked. I tried both running lxpanelctl restart as well as logging out and logging back in after each change. In addition, I tried killall pcmanfm && pcmanfm --desktop --profile lubuntu &.

I also tried selecting multiple files of different types, right clicking, "open with", "Custom Command Line" and then entering the command to execute and an application name. However, when I do this, the command is not run, nothing is added to the context menu nor is anything created in ~/.local/share/applications.

What am I doing wrong?

Update: I tried rebooting the machine and I can now see the entry I created when I right click for all the MIME types I manually added in the .desktop file in `~/.local/share/applications". But having to reboot my machine after any change isn't acceptable and I'm pretty sure there should be a command to refresh PCManFM. Also, I'm still not able to get anything to happen when I try to create a new userapp via "Open With" when multiple different files/types are selected.

Update 2: I have found that the following command almost works:

update-desktop-database ~/.local/share/applications

I have set several MIME types to be recognized (5 video formats and 4 image formats) but after running the above commands (and even going as far as rebooting, which has no additional effect), only 1 image format and all 5 video formats have the new right click content menu item show up, even though I see the correct entries for all image types in ~/.local/share/applications/mimeinfo.cache.

Update 3: It appears that the reason the image formats weren't working is that they were referenced by multiple userapp custom actions. Why can't I have multiple custom actions for a single MIME type? I see it in the system actions and it works fine!

Update 4: I have been playing around with this for a while now, and at some point about half of my MIME types started showing both custom actions, while the rest did not. But I just discovered that all the custom actions are showing up under the "Open With" sub-menu, whereas in the ones that show up directly in the right-click menu, "Open With" is not a sub-menu. How do I get a consistent behavior across all types to avoid the sub-menu???

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.