summaryrefslogtreecommitdiff
diff options
authorChris Townsend <christopher.townsend@canonical.com>2014-03-17 16:58:25 -0400
committerChris Townsend <christopher.townsend@canonical.com>2014-03-17 16:58:25 -0400
commitb519337dae780937eb4f40bb2dc7a4d672ff2765 (patch)
treee3f6163bb44b981081089627ce74cc31361b43bd
parented7b183e158285175c4a96a7bb6b7bb3c5ae7c55 (diff)
Add in a CCSM option to enable the click-launcher-icon-to-minimize-window behavior.
(bzr r3725.2.2)
-rw-r--r--launcher/AbstractLauncherIcon.cpp1
-rw-r--r--launcher/AbstractLauncherIcon.h1
-rw-r--r--launcher/ApplicationLauncherIcon.cpp2
-rw-r--r--launcher/Launcher.cpp6
-rw-r--r--launcher/Launcher.h1
-rw-r--r--launcher/LauncherOptions.cpp2
-rw-r--r--launcher/LauncherOptions.h1
-rw-r--r--plugins/unityshell/src/unityshell.cpp5
-rw-r--r--plugins/unityshell/unityshell.xml.in6
9 files changed, 24 insertions, 1 deletions
diff --git a/launcher/AbstractLauncherIcon.cpp b/launcher/AbstractLauncherIcon.cpp
index 55c398c18..734ace38f 100644
--- a/launcher/AbstractLauncherIcon.cpp
+++ b/launcher/AbstractLauncherIcon.cpp
@@ -23,6 +23,7 @@ namespace unity {
namespace launcher {
nux::Property<unsigned> AbstractLauncherIcon::icon_size(48);
nux::Property<bool> AbstractLauncherIcon::scroll_inactive_icons(true);
+ nux::Property<bool> AbstractLauncherIcon::minimize_window_on_click(false);
// needed for ungodly stupid reasons
NUX_IMPLEMENT_OBJECT_TYPE(AbstractLauncherIcon);
diff --git a/launcher/AbstractLauncherIcon.h b/launcher/AbstractLauncherIcon.h
index 6cf92b458..fe2600062 100644
--- a/launcher/AbstractLauncherIcon.h
+++ b/launcher/AbstractLauncherIcon.h
@@ -135,6 +135,7 @@ public:
static nux::Property<unsigned> icon_size;
static nux::Property<bool> scroll_inactive_icons;
+ static nux::Property<bool> minimize_window_on_click;
nux::Property<std::string> tooltip_text;
nux::Property<bool> tooltip_enabled;
nux::Property<Position> position;
diff --git a/launcher/ApplicationLauncherIcon.cpp b/launcher/ApplicationLauncherIcon.cpp
index 621fa9a1b..bf6192394 100644
--- a/launcher/ApplicationLauncherIcon.cpp
+++ b/launcher/ApplicationLauncherIcon.cpp
@@ -401,7 +401,7 @@ void ApplicationLauncherIcon::ActivateLauncherIcon(ActionArg arg)
{
WindowList windows = GetWindows(WindowFilter::ON_CURRENT_DESKTOP);
- if (windows.size() == 1)
+ if (windows.size() == 1 && minimize_window_on_click)
{
wm.Minimize(windows[0]->window_id());
}
diff --git a/launcher/Launcher.cpp b/launcher/Launcher.cpp
index 4bf6e7ff7..512a48574 100644
--- a/launcher/Launcher.cpp
+++ b/launcher/Launcher.cpp
@@ -1217,6 +1217,7 @@ void Launcher::UpdateOptions(Options::Ptr options)
SetIconSize(options->tile_size, options->icon_size);
SetHideMode(options->hide_mode);
SetScrollInactiveIcons(options->scroll_inactive_icons);
+ SetLauncherMinimizeWindow(options->minimize_window_on_click);
if (model_)
{
@@ -1498,6 +1499,11 @@ void Launcher::SetScrollInactiveIcons(bool scroll)
AbstractLauncherIcon::scroll_inactive_icons = scroll;
}
+void Launcher::SetLauncherMinimizeWindow(bool click_to_minimize)
+{
+ AbstractLauncherIcon::minimize_window_on_click = click_to_minimize;
+}
+
void Launcher::SetIconSize(int tile_size, int icon_size)
{
ui::IconRenderer::DestroyShortcutTextures();
diff --git a/launcher/Launcher.h b/launcher/Launcher.h
index 4e1a9cb61..33fee1f1c 100644
--- a/launcher/Launcher.h
+++ b/launcher/Launcher.h
@@ -80,6 +80,7 @@ public:
AbstractLauncherIcon::Ptr GetSelectedMenuIcon() const;
void SetScrollInactiveIcons(bool scroll);
+ void SetLauncherMinimizeWindow(bool click_to_minimize);
void SetIconSize(int tile_size, int icon_size);
int GetIconSize() const;
diff --git a/launcher/LauncherOptions.cpp b/launcher/LauncherOptions.cpp
index 20ef3b303..6a06cf759 100644
--- a/launcher/LauncherOptions.cpp
+++ b/launcher/LauncherOptions.cpp
@@ -47,6 +47,7 @@ Options::Options()
, edge_resist(true)
, show_for_all(false)
, scroll_inactive_icons(false)
+ , minimize_window_on_click(false)
{
auto changed_lambda = [this] {
changed_idle_.reset(new glib::Idle(glib::Source::Priority::HIGH));
@@ -72,6 +73,7 @@ Options::Options()
urgent_animation.changed.connect(sigc::hide(changed_lambda));
edge_resist.changed.connect(sigc::hide(changed_lambda));
scroll_inactive_icons.changed.connect(sigc::hide(changed_lambda));
+ minimize_window_on_click.changed.connect(sigc::hide(changed_lambda));
}
}
diff --git a/launcher/LauncherOptions.h b/launcher/LauncherOptions.h
index 7339f7188..d95b9d2df 100644
--- a/launcher/LauncherOptions.h
+++ b/launcher/LauncherOptions.h
@@ -103,6 +103,7 @@ public:
nux::Property<bool> edge_resist;
nux::Property<bool> show_for_all;
nux::Property<bool> scroll_inactive_icons;
+ nux::Property<bool> minimize_window_on_click;
sigc::signal<void> option_changed;
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 7dd6bb267..60afa28f5 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -380,6 +380,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
optionSetLauncherCaptureMouseNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetScrollInactiveIconsNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
+ optionSetLauncherMinimizeWindowNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
ubus_manager_.RegisterInterest(UBUS_LAUNCHER_START_KEY_NAV,
sigc::mem_fun(this, &UnityScreen::OnLauncherStartKeyNav));
@@ -3401,6 +3402,9 @@ void UnityScreen::optionChanged(CompOption* opt, UnityshellOptions::Options num)
case UnityshellOptions::ScrollInactiveIcons:
launcher_options->scroll_inactive_icons = optionGetScrollInactiveIcons();
break;
+ case UnityshellOptions::LauncherMinimizeWindow:
+ launcher_options->minimize_window_on_click = optionGetLauncherMinimizeWindow();
+ break;
case UnityshellOptions::BackgroundColor:
{
auto override_color = NuxColorFromCompizColor(optionGetBackgroundColor());
@@ -3827,6 +3831,7 @@ void UnityScreen::initLauncher()
});
launcher_controller_->options()->scroll_inactive_icons = optionGetScrollInactiveIcons();
+ launcher_controller_->options()->minimize_window_on_click = optionGetLauncherMinimizeWindow();
ScheduleRelayout(0);
}
diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in
index 86ab214b5..f00320269 100644
--- a/plugins/unityshell/unityshell.xml.in
+++ b/plugins/unityshell/unityshell.xml.in
@@ -362,6 +362,12 @@
<default>true</default>
</option>
+ <option name="launcher_minimize_window" type="bool">
+ <_short>Minimize Single Window Applications</_short>
+ <_long>Allows minimizing a single windowed application by clicking on its Launcher icon.</_long>
+ <default>false</default>
+ </option>
+
<option name="edge_responsiveness" type="float">
<_short>Launcher Reveal Edge Responsiveness</_short>
<_long>A conglomerate setting that modifies the overall responsiveness of the Launcher reveal.</_long>