bugGNU Octave - Bugs: bug #44880, Allow the Exec key in the desktop...

 
 

bug #44880: Allow the Exec key in the desktop file to launch a script file

Submitter:  Rafael Laboissière <rlaboiss>
Submitted:  Sun 19 Apr 2015 11:23:32 AM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Wed 28 Mar 2018 05:21:27 PM UTC, comment #11: 

Ok, then I'll close this bug as won't fix, since this was particularly about keeping the GUI open when running a script from the desktop, not opening a file in the editor. I will try to summarize the remaining issues on the other bug.

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 11:34:57 AM UTC, comment #10: 


> Should we apply this patch for 4.4 to add the --persist option for now as a temporary measure?


I don't think so.  This would not even open the file on the editor tab, the user would have to open it from the GUI again. But it would execute the script which may start Octave with a modified environment and that's not clear it happened.

So unless we are also adding the '--eval edit %f', which we are not, might be better to leave it.

Carnë Draug <carandraug>
Group Member
Wed 28 Mar 2018 11:02:39 AM UTC, comment #9: 


> Should we apply this patch for 4.4 to add the --persist option for now as a temporary measure?

Carnë Draug <carandraug>
Group Member
Wed 28 Mar 2018 02:27:44 AM UTC, comment #8: 

Yeah, thanks for the summary, sorry if I wasn't clear before.

I think for 4.5 or 5.0 or whatever we are calling the next default branch, we could put some effort into carefully defining how the command line will work to support things like this, add some remote IPC like your dbus idea from bug #42603, and so on.

Should we apply this patch for 4.4 to add the --persist option for now as a temporary measure?

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 02:02:40 AM UTC, comment #7: 


> What I don't want is to click on the "GNU Octave" icon in my GNOME deskop Applications menu and have it start Octave with the editor tab open.


Oh! So what you are trying to avoid is that it starts on the editor tab (vs starting on the GUI console) and not that it starts the GUI (vs starting the GUI)?

Took me a while to figure this out, so I'm writing it down all:

The desktop files controls both the action to open m files and to
start Octave from the main menu.  This needs to be the same
command.

Currently, the desktop entry uses '--gui %f'.  From the applications
menu, this starts the GUI on the console tab and persists (because %f
is empty).  From double clicking a file, it executes %f and then exit
the GUI.

Changing to '--gui --persist %f' will not change the start from the
application menu.  When double clicking on a file, it would execute %f
and then keep the Octave window open on the console tab.  However, %f
will not even be appear in the editor tab.  There would be no clue
that %f actually got executed.

Changing to '--gui --persist --edit "edit %f"' would make start from
the applications menu on the editor tab instead of the console tab.
It would make double click on a file open the editor tab and not
execute the file at all.

---

I think what we really need is that 'octave --gui %f' will implicit
open the editor if %f is not empty.  This would even add support for
%F (multiple files).

Carnë Draug <carandraug>
Group Member
Wed 28 Mar 2018 12:48:48 AM UTC, comment #6: 

Looking back at bug #44368, I had the idea earlier to have two different .desktop files, one that would show up in the system applications menu to launch Octave as normal, and one that would be used for file associations and not show up in the menu.

It would be useful if that were possible with the alternative desktop actions in a single .desktop file.

What I don't want is to click on the "GNU Octave" icon in my GNOME deskop Applications menu and have it start Octave with the editor tab open.

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 12:43:53 AM UTC, comment #5: 

Ok, thanks for the clarification on the desktop actions.

And I'll give you the executable bit and say that the file manager can take care of "edit" vs "run" this file.

The difference between GNU/Linux and Windows as I understand it is that Windows has two different launchers, one for running the program from the Start menu, and one for file associations. On GNU/Linux it's the same .desktop file for both.

At the very least I just want to make sure that any changes to make opening files nicer still just works with the default application menu to just start Octave with the command window open.

IMHO adding the --persist option alone as in the patch attached here is safe. The '--eval edit' option as mentioned on bug #44368 is not.

Mike Miller <mtmiller>
Group Member
Wed 28 Mar 2018 12:32:23 AM UTC, comment #4: 


> [...] For example the org.gnome.gedit.desktop on my system defines actions to open a new window or create a new text document in addition to the default.


It only does that from the gnome shell. It doesn't have two options when you are opening a file.  In that case, it uses the Desktop Entry section (which only has one section), instead of the Desktop Action sections.  If we ever get D-bus working in Octave (see bug #42603), the same options would be nice, to create new document in existing Octave instance, or open new document in new instance.

> I think we can support both actions to "run this .m file as a program" and "open this .m file in the editor", and both make sense depending on your use case, so why not do both?


I think the 'run this .m file as a program' is for the file manager to handle. On my system, nautilus will ask if it should run the program if it has executable permissions or open it as a file.

Also, we have at least 3 bugs about not opening the file for edition on Linux. In windows, where that happens, we have no bugs from users wanting to run the program.

Carnë Draug <carandraug>
Group Member
Tue 27 Mar 2018 11:34:00 PM UTC, comment #3: 

The Desktop Entry standards now allow multiple Actions to be associated with a Desktop entry. I think that would be preferable, to add a new "Desktop Action Edit" section to the .desktop file rather than changing the default action. For example the org.gnome.gedit.desktop on my system defines actions to open a new window or create a new text document in addition to the default.

I think we can support both actions to "run this .m file as a program" and "open this .m file in the editor", and both make sense depending on your use case, so why not do both?

Mike Miller <mtmiller>
Group Member
Tue 27 Mar 2018 11:23:32 PM UTC, comment #2: 

So I found out that the windows releases from mxe-octave already do this and better (it also use the --edit option so it opens on the text editor). See

http://hg.octave.org/mxe-octave/file/tip/tools/makeinst-script.sh.in#l365

So I guess we should do the same for our desktop entry. I can push this change but I was wondering if this go in stable.  Just because we are effectively already doing but only on windows builds.

This is also the same as bug #44368

Carnë Draug <carandraug>
Group Member
Sun 19 Apr 2015 11:39:46 PM UTC, comment #1: 

I attached the wrong cset file when submitting this bug report, sorry.  The correct one is attached now.

(file #33725)

Rafael Laboissière <rlaboiss>
Sun 19 Apr 2015 11:23:32 AM UTC, original submission:  

According to the Desktop Entry Specification [1], if the MimeType key is defined in a .desktop file, then the application is expected to be able to reasonably open files of these types using the command listed in the Exec key.  The cset attached to this bug report adds "%f" to the Exec key (notice that %F would be useless, since only the first file given in the command line is executed) and also specifies the --persist option.  This option is perhaps not needed, but in a desktop environment, it would be better to have the GUI persisting after dragging and dropping a file on the Octave icon.

1. http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html

Rafael Laboissière <rlaboiss>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #33725:  exec-key-launch-file.diff added by rlaboiss (1KiB - text/x-patch)
file #33717:  fix-spelling-grammar.diff added by rlaboiss (11KiB - text/x-patch)

 

Digest:
   bug dependencies.

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by rlaboiss (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-28 mtmiller StatusDuplicate Wont Fix
        Open/ClosedOpen Closed
    2015-06-05 carandraug StatusNone Duplicate
        Dependencies- Depends on bugs #44368
    2015-04-19 rlaboiss Attached File- Added exec-key-launch-file.diff, #33725
    2015-04-19 rlaboiss Attached File- Added fix-spelling-grammar.diff, #33717

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code