Merge lp:~ojno/unity/minimize-on-click into lp:unity

Proposed by Jonathan French on 2012-03-19
Status: Rejected
Rejected by: Marco Trevisan (Treviño) on 2012-03-20
Proposed branch: lp:~ojno/unity/minimize-on-click
Merge into: lp:unity
Diff against target: 125 lines (+22/-29) 2 files modified
To merge this branch: bzr merge lp:~ojno/unity/minimize-on-click
Reviewer Review Type Date Requested Status
GonzO (community) Resubmit on 2012-03-21
Marco Trevisan (Treviño) 2012-03-19 Disapprove on 2012-03-20
Review via email: mp+98303@code.launchpad.net

Description of the Change

Implements #733349, specifically comment 58's spec - minimize windows as part of the launcher icon click cycle.

I know that bug was marked wontfix, but this *vastly* improves the everyday usability of Unity, and the change is only a few lines. Please reconsider this.

I realise at this point it won't make it into Precise, but please at least un-wontfix the bug. Open source projects should listen to their users, especially when they aren't just blueskying but actually contribute code! ;)

To post a comment you must log in.
Marco Trevisan (Treviño) (3v1n0) wrote :

Sorry, but I must to reject this MP, since this is an unwanted behavior according to design.

review: Disapprove
GonzO (gonzo) wrote :

The feature shouldn't be rejected - the design should be reconsidered.

review: Resubmit
Jonathan French (ojno) wrote :

I've created a PPA of this: https://launchpad.net/~ojno/+archive/unity-minimize-on-click

This has been covered here: http://www.webupd8.org/2012/03/unity-with-minimize-on-click-patch.html

Please think about this. If you look at the linked bug, you can see people discover it every few days (for nearly a year now!) and express their incredulity that this basic behaviour is missing from Unity.

Vishnu Rao (vishnumrao) wrote :

This is a much needed design change. I vote this up! Minimize on click is intuitive. It maybe a mimicking Windows, but its useful.

Lets try to make Ubuntu different, but lets pick up useful features from other OSes.

Aleve Sicofante (sicofante) wrote :

It's also available on OS X as a dock preference (not the default though).

A big THANK YOU to Jonathan and a big boo to the design team, for not listening and not reasoning.

zwigno (zwigno) wrote :

Seems like they're just being strict about sticking to the design spec. Let's lobby for a design spec change instead. Anybody know how to do that?

dstaubsauger (dickerstaubsauger) wrote :

Meeeh, why can't you add the feature optionally, meaning users would have to turn it on in the settings dialogue? That way everybody will be happy and in the meantime you can ask your design team why they didn't want it.

Jonathan French (ojno) wrote :

New version of the PPA released: Restores the previous behaviour when the launcher icon is clicked with the Spread open, and adds a "Minimize" item to the quicklist.

Hopefully this is more likely to be merged, since it now doesn't touch the Spread behaviour at all.

I'm trying to merge this change into this branch, but I'm having trouble, being new to bzr. I'll figure it out soon.

Dvanzo (danielvanzo) wrote :

HI!,
I was using this patch without problems, but today unity was updated and can't use it anymore... Any plans to apply this patch to the new unity version??? Unity is almost useless without it for me!!!

Regards,

Daniel

Unmerged revisions

2131. By Jonathan French on 2012-03-27

Restore the previous behaviour when the launcher icon is clicked with the Spread open; add a Minimize item to the quicklist

2130. By Jonathan French on 2012-03-27

merge from upstream

2129. By Jonathan French on 2012-03-19

Add window minimize to launcher icon click actions

Preview Diff

1=== modified file 'plugins/unityshell/src/BamfLauncherIcon.cpp'
2--- plugins/unityshell/src/BamfLauncherIcon.cpp 2012-03-16 01:48:22 +0000
3+++ plugins/unityshell/src/BamfLauncherIcon.cpp 2012-03-19 23:17:20 +0000
4@@ -231,10 +231,11 @@
5
6 /* Behaviour:
7 * 1) Nothing running, or nothing visible -> launch application
8- * 2) Running and active -> spread application
9+ * 2a) Running and active with more than one window -> spread application
10+ * 2b) Running and active with only one window -> minimize application
11 * 3) Running and not active -> focus application
12 * 4) Spread is active and different icon pressed -> change spread
13- * 5) Spread is active -> Spread de-activated, and fall through
14+ * 5) Spread is active -> minimize application
15 */
16
17 if (!IsRunning() || (IsRunning() && !user_visible)) // #1 above
18@@ -257,13 +258,17 @@
19 if (scaleWasActive) // #5 above
20 {
21 WindowManager::Default()->TerminateScale();
22- Focus(arg);
23+ Minimize(Windows(true));
24 }
25 else // #2 above
26 {
27 if (arg.source != ActionArg::SWITCHER)
28 {
29- Spread(true, 0, false);
30+ std::vector<Window> windowList = Windows(true);
31+ if (windowList.size() == 1) // #2b above
32+ Minimize(windowList);
33+ else // #2a above
34+ Spread(windowList, 0, false);
35 }
36 }
37 }
38@@ -274,7 +279,7 @@
39 WindowManager::Default()->TerminateScale();
40 Focus(arg);
41 if (arg.source != ActionArg::SWITCHER)
42- Spread(true, 0, false);
43+ Spread(Windows(true), 0, false);
44 }
45 else // #3 above
46 {
47@@ -287,7 +292,7 @@
48 ubus_server_send_message(ubus_server_get_default(), UBUS_LAUNCHER_ACTION_DONE, nullptr);
49 }
50
51-std::vector<Window> BamfLauncherIcon::Windows()
52+std::vector<Window> BamfLauncherIcon::Windows(bool current_desktop)
53 {
54 std::vector<Window> results;
55 GList* children, *l;
56@@ -301,7 +306,7 @@
57
58 Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
59
60- if (wm->IsWindowMapped(xid))
61+ if (wm->IsWindowMapped(xid) && (!current_desktop || wm->IsWindowOnCurrentDesktop(xid)))
62 {
63 results.push_back(xid);
64 }
65@@ -609,30 +614,17 @@
66 }
67 }
68
69-bool BamfLauncherIcon::Spread(bool current_desktop, int state, bool force)
70+bool BamfLauncherIcon::Spread(std::vector<Window> windowList, int state, bool force)
71 {
72- GList* children, *l;
73- children = bamf_view_get_children(BAMF_VIEW(_bamf_app.RawPtr()));
74- WindowManager* wm = WindowManager::Default();
75-
76- std::vector<Window> windowList;
77- for (l = children; l; l = l->next)
78- {
79- if (!BAMF_IS_WINDOW(l->data))
80- continue;
81-
82- Window xid = bamf_window_get_xid(static_cast<BamfWindow*>(l->data));
83-
84- if (!current_desktop || (current_desktop && wm->IsWindowOnCurrentDesktop(xid)))
85- {
86- windowList.push_back(xid);
87- }
88- }
89-
90- g_list_free(children);
91 return WindowManager::Default()->ScaleWindowGroup(windowList, state, force);
92 }
93
94+void BamfLauncherIcon::Minimize(std::vector<Window> windowList)
95+{
96+ for (unsigned int i = 0; i < windowList.size(); i++)
97+ WindowManager::Default()->Minimize(windowList[i]);
98+}
99+
100 void BamfLauncherIcon::EnsureWindowState()
101 {
102 GList* children, *l;
103
104=== modified file 'plugins/unityshell/src/BamfLauncherIcon.h'
105--- plugins/unityshell/src/BamfLauncherIcon.h 2012-02-12 10:43:11 +0000
106+++ plugins/unityshell/src/BamfLauncherIcon.h 2012-03-19 23:17:20 +0000
107@@ -60,7 +60,7 @@
108 virtual bool ShowInSwitcher(bool current);
109 virtual unsigned long long SwitcherPriority();
110
111- std::vector<Window> Windows();
112+ std::vector<Window> Windows(bool current_desktop = false);
113 std::vector<Window> WindowsForMonitor(int monitor);
114 std::string NameForWindow(Window window);
115
116@@ -96,7 +96,8 @@
117
118 void OpenInstanceWithUris(std::set<std::string> uris);
119 void Focus(ActionArg arg);
120- bool Spread(bool current_desktop, int state, bool force);
121+ bool Spread(std::vector<Window>, int state, bool force);
122+ void Minimize(std::vector<Window> current_desktop);
123
124 void OnWindowMinimized(guint32 xid);
125 void OnWindowMoved(guint32 xid);