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
=== modified file 'launcher/AbstractLauncherIcon.cpp'
--- launcher/AbstractLauncherIcon.cpp 2014-03-12 18:20:51 +0000
+++ launcher/AbstractLauncherIcon.cpp 2014-03-18 16:39:21 +0000
@@ -23,6 +23,7 @@
23namespace launcher {23namespace launcher {
24 nux::Property<unsigned> AbstractLauncherIcon::icon_size(48);24 nux::Property<unsigned> AbstractLauncherIcon::icon_size(48);
25 nux::Property<bool> AbstractLauncherIcon::scroll_inactive_icons(true);25 nux::Property<bool> AbstractLauncherIcon::scroll_inactive_icons(true);
26 nux::Property<bool> AbstractLauncherIcon::minimize_window_on_click(false);
2627
27 // needed for ungodly stupid reasons28 // needed for ungodly stupid reasons
28 NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);29 NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);
2930
=== modified file 'launcher/AbstractLauncherIcon.h'
--- launcher/AbstractLauncherIcon.h 2014-03-07 18:44:31 +0000
+++ launcher/AbstractLauncherIcon.h 2014-03-18 16:39:21 +0000
@@ -135,6 +135,7 @@
135135
136 static nux::Property<unsigned> icon_size;136 static nux::Property<unsigned> icon_size;
137 static nux::Property<bool> scroll_inactive_icons;137 static nux::Property<bool> scroll_inactive_icons;
138 static nux::Property<bool> minimize_window_on_click;
138 nux::Property<std::string> tooltip_text;139 nux::Property<std::string> tooltip_text;
139 nux::Property<bool> tooltip_enabled;140 nux::Property<bool> tooltip_enabled;
140 nux::Property<Position> position;141 nux::Property<Position> position;
141142
=== modified file 'launcher/ApplicationLauncherIcon.cpp'
--- launcher/ApplicationLauncherIcon.cpp 2014-03-12 23:46:10 +0000
+++ launcher/ApplicationLauncherIcon.cpp 2014-03-18 16:39:21 +0000
@@ -399,7 +399,16 @@
399 {399 {
400 if (arg.source != ActionArg::Source::SWITCHER)400 if (arg.source != ActionArg::Source::SWITCHER)
401 {401 {
402 Spread(true, 0, false);402 WindowList windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP);
403
404 if (windows.size() == 1 && minimize_window_on_click)
405 {
406 wm.Minimize(windows[0]->window_id());
407 }
408 else
409 {
410 Spread(true, 0, false);
411 }
403 }412 }
404 }413 }
405 }414 }
406415
=== modified file 'launcher/Launcher.cpp'
--- launcher/Launcher.cpp 2014-03-13 23:16:47 +0000
+++ launcher/Launcher.cpp 2014-03-18 16:39:21 +0000
@@ -1217,6 +1217,7 @@
1217 SetIconSize(options->tile_size, options->icon_size);1217 SetIconSize(options->tile_size, options->icon_size);
1218 SetHideMode(options->hide_mode);1218 SetHideMode(options->hide_mode);
1219 SetScrollInactiveIcons(options->scroll_inactive_icons);1219 SetScrollInactiveIcons(options->scroll_inactive_icons);
1220 SetLauncherMinimizeWindow(options->minimize_window_on_click);
12201221
1221 if (model_)1222 if (model_)
1222 {1223 {
@@ -1498,6 +1499,11 @@
1498 AbstractLauncherIcon::scroll_inactive_icons = scroll;1499 AbstractLauncherIcon::scroll_inactive_icons = scroll;
1499}1500}
15001501
1502void Launcher::SetLauncherMinimizeWindow(bool click_to_minimize)
1503{
1504 AbstractLauncherIcon::minimize_window_on_click = click_to_minimize;
1505}
1506
1501void Launcher::SetIconSize(int tile_size, int icon_size)1507void Launcher::SetIconSize(int tile_size, int icon_size)
1502{1508{
1503 ui::IconRenderer::DestroyShortcutTextures();1509 ui::IconRenderer::DestroyShortcutTextures();
15041510
=== modified file 'launcher/Launcher.h'
--- launcher/Launcher.h 2014-03-13 23:16:47 +0000
+++ launcher/Launcher.h 2014-03-18 16:39:21 +0000
@@ -80,6 +80,7 @@
80 AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;80 AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;
8181
82 void SetScrollInactiveIcons(bool scroll);82 void SetScrollInactiveIcons(bool scroll);
83 void SetLauncherMinimizeWindow(bool click_to_minimize);
8384
84 void SetIconSize(int tile_size, int icon_size);85 void SetIconSize(int tile_size, int icon_size);
85 int GetIconSize() const;86 int GetIconSize() const;
8687
=== modified file 'launcher/LauncherOptions.cpp'
--- launcher/LauncherOptions.cpp 2014-03-07 18:44:31 +0000
+++ launcher/LauncherOptions.cpp 2014-03-18 16:39:21 +0000
@@ -47,6 +47,7 @@
47 , edge_resist(true)47 , edge_resist(true)
48 , show_for_all(false)48 , show_for_all(false)
49 , scroll_inactive_icons(false)49 , scroll_inactive_icons(false)
50 , minimize_window_on_click(false)
50{51{
51 auto changed_lambda = [this] {52 auto changed_lambda = [this] {
52 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));53 changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
@@ -72,6 +73,7 @@
72 urgent_animation.changed.connect(sigc::hide(changed_lambda));73 urgent_animation.changed.connect(sigc::hide(changed_lambda));
73 edge_resist.changed.connect(sigc::hide(changed_lambda));74 edge_resist.changed.connect(sigc::hide(changed_lambda));
74 scroll_inactive_icons.changed.connect(sigc::hide(changed_lambda));75 scroll_inactive_icons.changed.connect(sigc::hide(changed_lambda));
76 minimize_window_on_click.changed.connect(sigc::hide(changed_lambda));
75}77}
7678
77}79}
7880
=== modified file 'launcher/LauncherOptions.h'
--- launcher/LauncherOptions.h 2014-03-07 18:44:31 +0000
+++ launcher/LauncherOptions.h 2014-03-18 16:39:21 +0000
@@ -103,6 +103,7 @@
103 nux::Property<bool> edge_resist;103 nux::Property<bool> edge_resist;
104 nux::Property<bool> show_for_all;104 nux::Property<bool> show_for_all;
105 nux::Property<bool> scroll_inactive_icons;105 nux::Property<bool> scroll_inactive_icons;
106 nux::Property<bool> minimize_window_on_click;
106107
107 sigc::signal<void> option_changed;108 sigc::signal<void> option_changed;
108109
109110
=== modified file 'plugins/unityshell/src/unityshell.cpp'
--- plugins/unityshell/src/unityshell.cpp 2014-03-13 23:17:17 +0000
+++ plugins/unityshell/src/unityshell.cpp 2014-03-18 16:39:21 +0000
@@ -380,6 +380,7 @@
380 optionSetLauncherCaptureMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));380 optionSetLauncherCaptureMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
381381
382 optionSetScrollInactiveIconsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));382 optionSetScrollInactiveIconsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
383 optionSetLauncherMinimizeWindowNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
383384
384 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,385 ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
385 sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));386 sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
@@ -3401,6 +3402,9 @@
3401 case UnityshellOptions::ScrollInactiveIcons:3402 case UnityshellOptions::ScrollInactiveIcons:
3402 launcher_options->scroll_inactive_icons = optionGetScrollInactiveIcons();3403 launcher_options->scroll_inactive_icons = optionGetScrollInactiveIcons();
3403 break;3404 break;
3405 case UnityshellOptions::LauncherMinimizeWindow:
3406 launcher_options->minimize_window_on_click = optionGetLauncherMinimizeWindow();
3407 break;
3404 case UnityshellOptions::BackgroundColor:3408 case UnityshellOptions::BackgroundColor:
3405 {3409 {
3406 auto override_color = NuxColorFromCompizColor(optionGetBackgroundColor());3410 auto override_color = NuxColorFromCompizColor(optionGetBackgroundColor());
@@ -3827,6 +3831,7 @@
3827 });3831 });
38283832
3829 launcher_controller_->options()->scroll_inactive_icons = optionGetScrollInactiveIcons();3833 launcher_controller_->options()->scroll_inactive_icons = optionGetScrollInactiveIcons();
3834 launcher_controller_->options()->minimize_window_on_click = optionGetLauncherMinimizeWindow();
38303835
3831 ScheduleRelayout(0);3836 ScheduleRelayout(0);
3832}3837}
38333838
=== modified file 'plugins/unityshell/unityshell.xml.in'
--- plugins/unityshell/unityshell.xml.in 2014-03-12 23:44:48 +0000
+++ plugins/unityshell/unityshell.xml.in 2014-03-18 16:39:21 +0000
@@ -362,6 +362,12 @@
362 <default>true</default>362 <default>true</default>
363 </option>363 </option>
364364
365 <option name="launcher_minimize_window" type="bool">
366 <_short>Minimize Single Window Applications (Unsupported)</_short>
367 <_long>Allows minimizing a single windowed application by clicking on its Launcher icon.</_long>
368 <default>false</default>
369 </option>
370
365 <option name="edge_responsiveness" type="float">371 <option name="edge_responsiveness" type="float">
366 <_short>Launcher Reveal Edge Responsiveness</_short>372 <_short>Launcher Reveal Edge Responsiveness</_short>
367 <_long>A conglomerate setting that modifies the overall responsiveness of the Launcher reveal.</_long>373 <_long>A conglomerate setting that modifies the overall responsiveness of the Launcher reveal.</_long>