← Back to team overview

dx-packages team mailing list archive

[Bug 733349] Re: Minimize Application's Windows upon clicking its Launcher Icon

 

This is the code I asked about:

=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp	2014-03-12 23:46:10 +0000
+++ launcher/ApplicationLauncherIcon.cpp	2014-03-17 20:58:25 +0000
@@ -399,7 +399,16 @@
{
if (arg.source != ActionArg::Source::SWITCHER)
{
-Spread(true, 0, false);
+WindowList windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP);
+
+if (windows.size() == 1 && minimize_window_on_click)
+{
+wm.Minimize(windows[0]->window_id());
+}
+else
+{
+Spread(true, 0, false);
+}
}
}
}

Looks like it checks how many windows are in the group (windows.size()
== 1) and if the setting is enabled (minimize_window_on_click); and the
function is limited to windows on the current desktop
(WindowFilter::ON_CURRENT_DESKTOP); but I don't see anything about
focused/unfocused state.

Most of the time it will be fine as-is, especially for users who don't
clutter a single workspace with lots of windows, but there may be
occasions when a single window on the current desktop may be under
another window or a group of windows and clicking on the icon will
minimize it behind them ("Aunt Suzy"). Since there's a minimize
animation to see, most users will probably realize what happened and
click the icon one more time to get the desired window out and on top.

Adding an additional if statement to cover this case would be a nice
improvement. Please excuse my ignorance of the proper names of the
functions and variables involved; consider this a blueprint for actual
code:

if (windows.size() == 1 && minimize_window_on_click)
{
+if ( windows[0]->window_state() == unfocused )
+{
+wm.Raise(windows[0]->window_id());
+}
+else
+{
 wm.Minimize(windows[0]->window_id());
 }

I know how hard it was to get this feature in even "as-is" with "no more
tweaks or enhancements", and I'm happy to see it happen at all, so I
won't hold it against anyone if this behavior is never updated; just a
suggestion (and reiteration of the same from several comments in this
report).

-- 
You received this bug notification because you are a member of DX
Packages, which is subscribed to unity in Ubuntu.
Matching subscriptions: dx-packages
https://bugs.launchpad.net/bugs/733349

Title:
  Minimize Application's Windows upon clicking its Launcher Icon

Status in Ayatana Design:
  Won't Fix
Status in Obsolete project please ignore:
  Invalid
Status in Unity:
  Fix Committed
Status in Unity Tweak Tool:
  Won't Fix
Status in “unity” package in Ubuntu:
  Fix Released

Bug description:
  What I do miss in Unity is the possibility to click on the app. icon on the Unity launcher bar to minimize all windows of that application, not only to launch/restore it.
  mlaverdiere's futher addition: https://bugs.launchpad.net/ayatana-design/+bug/733349/comments/2

  My suggestion would be to modify the interaction-design/process like
  this (*=my modification proposal/2 cents!):

  1) start it, if it hasn't been started yet;
  *2) restore it, if it is minimized;
  *3) focus the app, if it's started, not minimized and has not the focus yet;
  4) spread windows (of app), if app is focused and has multiple windows open;
  *5) minimize it if it is in spread-mode (see 4).

  Note that this bug has over 300 comments and several working but
  rejected patches. This means that this feature probably will never
  land in official Unity! So if you want it, you have to use a patched
  version of Unity.

  There is a working patch for 13.04 ( from comment #322,
  https://bugs.launchpad.net/ayatana-
  design/+bug/733349/+attachment/3573380/+files/minimize.patch ).
  Somebody should set up a PPA (and note it here) to make it easy to
  install the patched version.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ayatana-design/+bug/733349/+subscriptions