#871 "Open With..." doesn't work with scripts or terminal applications.

libfm (284)

How to reproduce:

1) Create a small script which echoes to a file (I tried python and bash with "#!/usr/bin/env python" and "#!/bin/bash")

2) Make sure it works when called from command line.

3) PCManFM, any file, Open With... -> Custom Command Line.
The other options don't seem to change anything, a terminal window isn't seen. However a .desktop-File in ~/.local/share/applications is created which reflects the chosen settings.

If pcmanfm is run from a terminal the output is

"(pcmanfm:18673): GLib-GObject-CRITICAL **: g_object_weak_ref: assertion 'G_IS_OBJECT (object)' failed"

The same happens for command line applications like "cat", however it seems to work for applications which have a .desktop file (tested with "leafpad" or "lxterminal", where the latter is started and prints its help message).

Tested with pcmanfm 1.2 and libfm 1.2 which come with Lubuntu 14.04, also tested with current libfm (git from today).


    • labels: --> libfm
    • Priority: 5 --> 7
  • Could you give me exact steps to reproduce your problem (including the script contents and which settings you set in the 'Custom Command Line' tab)? It works just fine for me. Thank you very much.

    • gregor_b

      It doesn't seem to depend on the settings or the script. I tested with

      echo "Hello World" > ~/Desktop/foo

      (saved with chmod +x in ~/bin/fooscript1)


      #!/usr/bin/env python
      import os.path, sys
      with open(os.path.expanduser('~/Desktop/foo'), 'w') as f:

      (saved with chmod +x in ~/bin/fooscript2)

      Command line in pcmanfm fails either with absolute or relative path. If I try to run the created userapp-*.desktop-file with pcmanfm it works in either case.

      As for the settings I tried any combination, with/without terminal, with/without name "Fooscript", with/without "standard app". Standard Application doesn't seem to have any effect (should change mimeapps.list?), however the other options are reflected in the created desktop file.

      Best regards.

  • That is very strange. I've tested it few times. Well, there was some issue with adding non-existing applications to list of last used, I've fixed that in the GIT sources, but it would not affect your question anyway. Though there is some ancient code which prevents the same executable to be used more than in one application, may be that affects you in some strange way? Could you erase your ~/.local/share/applications directory from all userapp-*.desktop and try again? If that will fix your issue then may be we should disable that mentioned code and add MIME associations editing in next version of LibFM instead. Note that you cannot use relative path in your command line on 'Custom Command Line' tab, only absolute path or executable name that can be found in any path from your $PATH list can be used, that is because GUI has no 'current directory' concept, that's different from shell prompt which have one.
    Thank you very much.

  • I'm still waiting your response. Tell me your word, please.

    • gregor_b

      It seems like my last answer got lost (or I clicked on "preview" and closed the browser, who knows).

      Deleting my ~/.local/share/applications inluding the userapp*-files doesn't change anything (I also tried deleting the global /usr/share/applications in qemu).

      "Relative" was a mistake, I meant "from $PATH".

      Sorry for your wait and best regards.

  • Unfortunately, I still have no idea what is wrong in your setup since it works just fine for me, with 1.2.0 version. If I follow your steps and set two lines in the 'Custom Command Line' tab:

    • fooscript1 in the Command field
    • Fooscrpt in the Name field

    (other options are not touched) then I can see the file foo created in the ~/Desktop folder and next time I see the Fooscript in the 'Open With' choices which also creates file foo when is chosen. What have I missed?

    • gregor_b

      Might be something distribution specific then, I only tried freshly installed Lubuntu 14.04 so far.

      • OK, I'll try the same on 14.04 when I get to it, I'll tell you results. Thank you.

  • artemgy

    I have had the same issue on Lubuntu 14.04 and successfully used the workaround mentioned in https://bugs.launchpad.net/ubuntu/+source/pcmanfm/+bug/975152

    I suggest that this is an issue with the distro, NOT specifically with PCManFM

    • gregor_b

      This bug is not releated to the "Execute in Terminal"-option but command line applications without .desktop-File in general.

    • status: open --> pending-fixed
    • assigned_to: Lonely Stranger
    • Priority: 7 --> 6
  • I hope this issue is completely fixed by recent commit into GIT. Check it when you can, please. Thank you very much.

    • gregor_b

      I tested with git-libfm from about 10 minutes ago and pcmanfm 1.2.1 release. Seems to work fine in all possible combinations of options.

      "Keep Terminal open" works with xterm but not Gnome Terminal, however this is propably not at all releated to pcmanfm or libfm... so bug is fixed.

      Thank you very much.

      Last edit: gregor_b 2014-08-23
  • Yes, you are right, not every terminal supports that option. Thank you.

    • status: pending-fixed --> closed-fixed