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

1.2
closed-fixed
libfm (242)
6
2014-08-23
2014-05-13
gregor_b
No

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).

Discussion

1 2 > >> (Page 1 of 2)
    • 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
      gregor_b
      2014-05-17

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

      1
      2
      #!/bin/bash
      echo "Hello World" > ~/Desktop/foo
      

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

      and

      1
      2
      3
      4
      5
      #!/usr/bin/env python
      import os.path, sys
      
      with open(os.path.expanduser('~/Desktop/foo'), 'w') as f:
          f.write('\n'.join(sys.argv))
      

      (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
      gregor_b
      2014-06-13

      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
      gregor_b
      2014-06-30

      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.

         
1 2 > >> (Page 1 of 2)