Merge lp:~townsend/unity/click-to-minimize into lp:unity

Proposed by Christopher Townsend
Status: Merged
Approved by: Brandon Schaefer
Approved revision: no longer in the source branch.
Merged at revision: 3728
Proposed branch: lp:~townsend/unity/click-to-minimize
Merge into: lp:unity
Diff against target: 160 lines (+33/-1)
9 files modified
launcher/AbstractLauncherIcon.cpp (+1/-0)
launcher/AbstractLauncherIcon.h (+1/-0)
launcher/ApplicationLauncherIcon.cpp (+10/-1)
launcher/Launcher.cpp (+6/-0)
launcher/Launcher.h (+1/-0)
launcher/LauncherOptions.cpp (+2/-0)
launcher/LauncherOptions.h (+1/-0)
plugins/unityshell/src/unityshell.cpp (+5/-0)
plugins/unityshell/unityshell.xml.in (+6/-0)
To merge this branch: bzr merge lp:~townsend/unity/click-to-minimize
Reviewer Review Type Date Requested Status
Brandon Schaefer (community) Approve
PS Jenkins bot (community) continuous-integration Needs Fixing
Review via email: mp+211531@code.launchpad.net

Commit message

Add ability to minimize a single window application when clicking on the Launcher icon of the application.

Description of the change

Add ability to minimize a single window application when clicking on the Launcher icon of the application. This is turned off by default.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Brandon Schaefer (brandontschaefer) wrote :

Works beautifully :).

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/AbstractLauncherIcon.cpp'
2--- launcher/AbstractLauncherIcon.cpp 2014-03-12 18:20:51 +0000
3+++ launcher/AbstractLauncherIcon.cpp 2014-03-18 16:39:21 +0000
4@@ -23,6 +23,7 @@
5 namespace launcher {
6 nux::Property<unsigned> AbstractLauncherIcon::icon_size(48);
7 nux::Property<bool> AbstractLauncherIcon::scroll_inactive_icons(true);
8+ nux::Property<bool> AbstractLauncherIcon::minimize_window_on_click(false);
9
10 // needed for ungodly stupid reasons
11 NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);
12
13=== modified file 'launcher/AbstractLauncherIcon.h'
14--- launcher/AbstractLauncherIcon.h 2014-03-07 18:44:31 +0000
15+++ launcher/AbstractLauncherIcon.h 2014-03-18 16:39:21 +0000
16@@ -135,6 +135,7 @@
17
18 static nux::Property<unsigned> icon_size;
19 static nux::Property<bool> scroll_inactive_icons;
20+ static nux::Property<bool> minimize_window_on_click;
21 nux::Property<std::string> tooltip_text;
22 nux::Property<bool> tooltip_enabled;
23 nux::Property<Position> position;
24
25=== modified file 'launcher/ApplicationLauncherIcon.cpp'
26--- launcher/ApplicationLauncherIcon.cpp 2014-03-12 23:46:10 +0000
27+++ launcher/ApplicationLauncherIcon.cpp 2014-03-18 16:39:21 +0000
28@@ -399,7 +399,16 @@
29 {
30 if (arg.source != ActionArg::Source::SWITCHER)
31 {
32- Spread(true, 0, false);
33+ WindowList windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP);
34+
35+ if (windows.size() == 1 && minimize_window_on_click)
36+ {
37+ wm.Minimize(windows[0]->window_id());
38+ }
39+ else
40+ {
41+ Spread(true, 0, false);
42+ }
43 }
44 }
45 }
46
47=== modified file 'launcher/Launcher.cpp'
48--- launcher/Launcher.cpp 2014-03-13 23:16:47 +0000
49+++ launcher/Launcher.cpp 2014-03-18 16:39:21 +0000
50@@ -1217,6 +1217,7 @@
51 SetIconSize(options->tile_size, options->icon_size);
52 SetHideMode(options->hide_mode);
53 SetScrollInactiveIcons(options->scroll_inactive_icons);
54+ SetLauncherMinimizeWindow(options->minimize_window_on_click);
55
56 if (model_)
57 {
58@@ -1498,6 +1499,11 @@
59 AbstractLauncherIcon::scroll_inactive_icons = scroll;
60 }
61
62+void Launcher::SetLauncherMinimizeWindow(bool click_to_minimize)
63+{
64+ AbstractLauncherIcon::minimize_window_on_click = click_to_minimize;
65+}
66+
67 void Launcher::SetIconSize(int tile_size, int icon_size)
68 {
69 ui::IconRenderer::DestroyShortcutTextures();
70
71=== modified file 'launcher/Launcher.h'
72--- launcher/Launcher.h 2014-03-13 23:16:47 +0000
73+++ launcher/Launcher.h 2014-03-18 16:39:21 +0000
74@@ -80,6 +80,7 @@
75 AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;
76
77 void SetScrollInactiveIcons(bool scroll);
78+ void SetLauncherMinimizeWindow(bool click_to_minimize);
79
80 void SetIconSize(int tile_size, int icon_size);
81 int GetIconSize() const;
82
83=== modified file 'launcher/LauncherOptions.cpp'
84--- launcher/LauncherOptions.cpp 2014-03-07 18:44:31 +0000
85+++ launcher/LauncherOptions.cpp 2014-03-18 16:39:21 +0000
86@@ -47,6 +47,7 @@
87 , edge_resist(true)
88 , show_for_all(false)
89 , scroll_inactive_icons(false)
90+ , minimize_window_on_click(false)
91 {
92 auto changed_lambda = [this] {
93 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
94@@ -72,6 +73,7 @@
95 urgent_animation.changed.connect(sigc::hide(changed_lambda));
96 edge_resist.changed.connect(sigc::hide(changed_lambda));
97 scroll_inactive_icons.changed.connect(sigc::hide(changed_lambda));
98+ minimize_window_on_click.changed.connect(sigc::hide(changed_lambda));
99 }
100
101 }
102
103=== modified file 'launcher/LauncherOptions.h'
104--- launcher/LauncherOptions.h 2014-03-07 18:44:31 +0000
105+++ launcher/LauncherOptions.h 2014-03-18 16:39:21 +0000
106@@ -103,6 +103,7 @@
107 nux::Property<bool> edge_resist;
108 nux::Property<bool> show_for_all;
109 nux::Property<bool> scroll_inactive_icons;
110+ nux::Property<bool> minimize_window_on_click;
111
112 sigc::signal<void> option_changed;
113
114
115=== modified file 'plugins/unityshell/src/unityshell.cpp'
116--- plugins/unityshell/src/unityshell.cpp 2014-03-13 23:17:17 +0000
117+++ plugins/unityshell/src/unityshell.cpp 2014-03-18 16:39:21 +0000
118@@ -380,6 +380,7 @@
119 optionSetLauncherCaptureMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
120
121 optionSetScrollInactiveIconsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
122+ optionSetLauncherMinimizeWindowNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
123
124 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
125 sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
126@@ -3401,6 +3402,9 @@
127 case UnityshellOptions::ScrollInactiveIcons:
128 launcher_options->scroll_inactive_icons = optionGetScrollInactiveIcons();
129 break;
130+ case UnityshellOptions::LauncherMinimizeWindow:
131+ launcher_options->minimize_window_on_click = optionGetLauncherMinimizeWindow();
132+ break;
133 case UnityshellOptions::BackgroundColor:
134 {
135 auto override_color = NuxColorFromCompizColor(optionGetBackgroundColor());
136@@ -3827,6 +3831,7 @@
137 });
138
139 launcher_controller_->options()->scroll_inactive_icons = optionGetScrollInactiveIcons();
140+ launcher_controller_->options()->minimize_window_on_click = optionGetLauncherMinimizeWindow();
141
142 ScheduleRelayout(0);
143 }
144
145=== modified file 'plugins/unityshell/unityshell.xml.in'
146--- plugins/unityshell/unityshell.xml.in 2014-03-12 23:44:48 +0000
147+++ plugins/unityshell/unityshell.xml.in 2014-03-18 16:39:21 +0000
148@@ -362,6 +362,12 @@
149 <default>true</default>
150 </option>
151
152+ <option name="launcher_minimize_window" type="bool">
153+ <_short>Minimize Single Window Applications (Unsupported)</_short>
154+ <_long>Allows minimizing a single windowed application by clicking on its Launcher icon.</_long>
155+ <default>false</default>
156+ </option>
157+
158 <option name="edge_responsiveness" type="float">
159 <_short>Launcher Reveal Edge Responsiveness</_short>
160 <_long>A conglomerate setting that modifies the overall responsiveness of the Launcher reveal.</_long>