elementary / dock

A quick app launcher and window switcher for Pantheon and elementary OS
https://elementary.io
GNU General Public License v3.0
88 stars 23 forks source link

Implement "Open New Window" with Middle/Ctrl Click with DesktopAction #82

Closed jeremypw closed 3 years ago

jeremypw commented 3 years ago

Fixes #77

Use the app's Desktop Action for opening a new window when one exists.

cassidyjames commented 3 years ago

This feels fragile to me with matching strings. Isn't there a better way for the dock and/or apps to handle this?

jeremypw commented 3 years ago

@cassidy I agree. All I can think of is to make the match fuzzier so that it matches any action name with both "New" and "Window" in it (without matching case). I do not think there is any specification that limits action names except I think they should be primarily in English. I cannot think of any other way of getting the specific command that opens a new window for an arbitrary app.

Blast-City commented 3 years ago

What happens if the app doesn't have a new window action? Does the icon flashes like when you try to scroll on an app with just one window open?

jeremypw commented 3 years ago

@Blast-City If there is no New Window action then the behaviour falls back to the current behaviour - the application is relaunched as normal and it is up to the application whether or not a new window is opened.

decathorpe commented 3 years ago

This feels fragile to me with matching strings. Isn't there a better way for the dock and/or apps to handle this?

Not sure if fuzzy matching is better or not. For example, I see Firefox on Fedora has two actions that are "New Window" and "New Private Window" - which one of those should be launched in this case? Why not rely on application handling this themselves internally - most ones using GLib.Application do this by now, I think?

jeremypw commented 3 years ago

@decathorpe

which one of those should be launched in this case?

Clearly one shortcut can only have one action - in this case open a "normal" new window. So opening a private window or a window as administrator would still have to be done using the context menu.

Why not rely on application handling this themselves internally - most ones using GLib.Application do this by now, I think.

I am unclear what you mean by this. If there is a way of achieving the aim of the PR without using the .desktop file then I am more than happy to do that. Can you post any code?

jeremypw commented 3 years ago

I guess maybe you mean using the applications own interface/shortcut to open a new window? This does not fix the reported issue and in that case we should withdraw the dock shortcut to do this (which is a valid point of view but should be raised as a separate issue).

decathorpe commented 3 years ago

I meant ... how should plank figure out from the desktop file which action is the right one? I don't think there's metadata for this.

And by the second thing, I meant: At least some GNOME apps are "singletons", and executing the binary a second time just opens a second window in the first process - which is what I meant by "let the application handle this itself"

jeremypw commented 3 years ago

@decathorpe Ah OK. Well at the moment the first match would be used which I agree is not ideal - but otherwise we are back to matching "New Window" exactly (or case insensitive). I don't think there is an ideal solution.

Your other suggestion is essentially what is happening in master, I think. So the three options seem to be

  1. Remove the shortcut altogether
  2. Do nothing
  3. Try to fix it as best we can.

I have enquired on Slack about potentially removing the shortcut.

jeremypw commented 3 years ago

I tend to agree that fuzzy matching may be worse as it could have unexpected effects rather than an exact match possibly not working in some cases.

jeremypw commented 3 years ago

Obviously any app that actively prevents a second window opening is never going to work.

jeremypw commented 3 years ago

Setting back to draft pending a decision on whether we want to go in this direction or perhaps remove the shortcut.

Blast-City commented 3 years ago

I think that is better to remove the shortcut than having a "feeling lucky" shortcut.

I don't agree that the Calculator shouldn't have a "New Window" action. If you have a internet workspace and a work workspace you shouldn't have to be moving the Calculator window through workspaces every time you want to use it in front of a browser or a text editor.

jeremypw commented 3 years ago

I don't agree that the Calculator shouldn't have a "New Window" action. If you have a internet workspace and a work workspace you shouldn't have to be moving the Calculator window through workspaces every time you want to use it in front of a browser or a text editor.

Yes, I hadn't thought of that - perhaps you should open a Calculator issue?

jeremypw commented 3 years ago

There are too many unresolved questions about this. They should be decided in the linked issue and then maybe a PR can be produced.