elementary / dock

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

Instance controls: close, minimize, and switch to windows from their Dock icon #73

Closed quequotion closed 2 years ago

quequotion commented 4 years ago

This adds a submenu to the window instance menu items in Dock application icons' right-click menus.

The submenu features "Close" for any window instance, "Minimize" for an active instance, and "Switch to" for an inactive instance.

In addition, I've added another patch to allow transient windows to make menu items.

I assume these were blocked so that modal dialogs wouldn't make entries in Plank. Unfortunately, "transient" isn't quite equivalent to "modal dialog". Several applications use transient windows for other purposes: Transmission's torrent windows, Epiphany's settings dialogs, etc.

One of the handy things these instance controls allow for is removing window controls from windows altogether. This is generally a good thing: windows are less cluttered, no need to look for a window corner to find a button to close it, all window control centralized on the panel, etc.

See it in action here.

quequotion commented 4 years ago

To do:

  1. When a base window has a transient, which is focused, the base window does not really need a "Switch to" menu item because it cannot be brought to focus over its transient. Strictly speaking, the same is true when a base window has a transient which is not focused: in either case, the base window's "Switch to" brings up the group and focuses the transient. I find that behavior intuitive (I'd like to relable this "Switch to (group)"). Gtk.Window doesn't have a convenience like get_has_transient(), but maybe I can use get_group() and/or get_focus() to identify when a window is a base that has a transient.

  2. When a base window has a transient, which is focused, the base window could make use of a "Minimize (all)" menu item. This function is already provided by left-clicking on the application's icon in the dock. However, that functionality becomes complicated when there are multiple base windows and/or viewports.

That said, I am overall satisfied that this is a solid productivity boost as-is. These changes would add a lot of complexity for limited gain, so I may not implement them even if I figure out how.

jeremypw commented 3 years ago

@quequotion I tried installing this but atm I do not see any extra menuitems.

quequotion commented 3 years ago

@quequotion I tried installing this but atm I do not see any extra menuitems.

They only appear if you have multiple instances of an application open, or if an application has multiple windows.

jeremypw commented 3 years ago

Of course, I'm dumb.

The first thing that strikes me about this is that there is often no obvious way of telling which window is which in the instance list. Probably need some kind of thumbnail?

quequotion commented 3 years ago

The first thing that strikes me about this is that there is often no obvious way of telling which window is which in the instance list. Probably need some kind of thumbnail?

Fair point, especially if the instances have identical window titles.

One hint, any window other than the focused instance will have a "switch to" item.

Note: I usually use dock with compiz, which can give the icons thumbnail window previews on mouseover, but I don't recall at the moment what it does with multiple instances (have to check tomorrow, posting from bed). At least the last or currently focused instance is shown.

Does Gala have a similar feature?

jeremypw commented 3 years ago

Does Gala have a similar feature?

I am not a Gala dev so I would have to investigate to answer that I am afraid.

jeremypw commented 3 years ago

I guess it is partly up to the apps themselves to give helpful window titles so my first comment is not necessarily a blocker.

I just noticed a bug where both instance options have a "Switch to" option though.

quequotion commented 3 years ago

I just noticed a bug where both instance options have a "Switch to" option though.

  • Open an app window (e.g. Files)
  • Open a new window in that app from the dock menu
  • Switch to the other window using your menu
  • Now both instances have a "Switch to" option.

I cannot reproduce this in compiz; it may be a focus tracking problem with Gala.

Try this with a window you can easily check if it has focus, like Code or Terminal.

After "Switch to.." you should be able to type without clicking anywhere.

Edit: Perhaps Gala is giving focus to Dock and leaving it there?

danirabbit commented 2 years ago

Thanks for this branch! We're doing a fresh rewrite and this pull no longer applies to the new main