summaryrefslogtreecommitdiff
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2015-10-27 18:33:31 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2015-10-27 18:33:31 +0100
commit68f74570088266f4c9b230f87e34ad2e64564259 (patch)
tree0cdcc92b62025c49c01559a049cec6f9eec8afb8
parent3ec9ed31729eea4e9fb76fab937553a6c6902f09 (diff)
UnityScreen: add ability to spread app windows depending on workspace
(bzr r4027.2.4)
-rw-r--r--plugins/unityshell/src/unityshell.cpp21
-rw-r--r--plugins/unityshell/src/unityshell.h2
-rw-r--r--plugins/unityshell/unityshell.xml.in6
-rw-r--r--shortcuts/CompizShortcutModeller.cpp10
4 files changed, 35 insertions, 4 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp
index 26e5b3a92..69fb6037d 100644
--- a/plugins/unityshell/src/unityshell.cpp
+++ b/plugins/unityshell/src/unityshell.cpp
@@ -382,6 +382,7 @@ UnityScreen::UnityScreen(CompScreen* screen)
optionSetPanelFirstMenuTerminate(boost::bind(&UnityScreen::showPanelFirstMenuKeyTerminate, this, _1, _2, _3));
optionSetPanelFirstMenuNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetSpreadAppWindowsInitiate(boost::bind(&UnityScreen::spreadAppWindowsInitiate, this, _1, _2, _3));
+ optionSetSpreadAppWindowsAnywhereInitiate(boost::bind(&UnityScreen::spreadAppWindowsAnywhereInitiate, this, _1, _2, _3));
optionSetAutomaximizeValueNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetDashTapDurationNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
optionSetAltTabTimeoutNotify(boost::bind(&UnityScreen::optionChanged, this, _1, _2));
@@ -2280,9 +2281,7 @@ bool UnityScreen::showDesktopKeyInitiate(CompAction* action,
return true;
}
-bool UnityScreen::spreadAppWindowsInitiate(CompAction* action,
- CompAction::State state,
- CompOption::Vector& options)
+void UnityScreen::SpreadAppWindows(bool anywhere)
{
if (ApplicationPtr const& active_app = ApplicationManager::Default().GetActiveApplication())
{
@@ -2290,13 +2289,27 @@ bool UnityScreen::spreadAppWindowsInitiate(CompAction* action,
for (auto& window : active_app->GetWindows())
{
- if (WM.IsWindowOnCurrentDesktop(window->window_id()))
+ if (anywhere || WM.IsWindowOnCurrentDesktop(window->window_id()))
windows.push_back(window->window_id());
}
WM.ScaleWindowGroup(windows, 0, true);
}
+}
+
+bool UnityScreen::spreadAppWindowsInitiate(CompAction* action,
+ CompAction::State state,
+ CompOption::Vector& options)
+{
+ SpreadAppWindows(false);
+ return true;
+}
+bool UnityScreen::spreadAppWindowsAnywhereInitiate(CompAction* action,
+ CompAction::State state,
+ CompOption::Vector& options)
+{
+ SpreadAppWindows(true);
return true;
}
diff --git a/plugins/unityshell/src/unityshell.h b/plugins/unityshell/src/unityshell.h
index eca658e28..42853a67f 100644
--- a/plugins/unityshell/src/unityshell.h
+++ b/plugins/unityshell/src/unityshell.h
@@ -186,6 +186,7 @@ public:
bool executeCommand(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool showDesktopKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool spreadAppWindowsInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
+ bool spreadAppWindowsAnywhereInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool setKeyboardFocusKeyInitiate(CompAction* action, CompAction::State state, CompOption::Vector& options);
bool altTabInitiateCommon(CompAction* action, switcher::ShowMode mode);
@@ -319,6 +320,7 @@ private:
void DamageBlurUpdateRegion(nux::Geometry const&);
void ShowFirstRunHints();
+ void SpreadAppWindows(bool anywhere);
std::unique_ptr<na::TickSource> tick_source_;
std::unique_ptr<na::AnimationController> animation_controller_;
diff --git a/plugins/unityshell/unityshell.xml.in b/plugins/unityshell/unityshell.xml.in
index 2d53fcb6f..56a95842a 100644
--- a/plugins/unityshell/unityshell.xml.in
+++ b/plugins/unityshell/unityshell.xml.in
@@ -93,6 +93,12 @@
<default>&lt;Control&gt;&lt;Super&gt;w</default>
</option>
+ <option name="spread_app_windows_anywhere" type="key">
+ <_short>Key to spread the current application windows in any workspace</_short>
+ <_long>Initiate the window Spread for the current application windows, for the all the windows.</_long>
+ <default>&lt;Control&gt;&lt;Super&gt;&lt;Shift&gt;w</default>
+ </option>
+
<option name="panel_opacity" type="float">
<_short>Panel Opacity</_short>
<_long>The opacity of the Panel background.</_long>
diff --git a/shortcuts/CompizShortcutModeller.cpp b/shortcuts/CompizShortcutModeller.cpp
index 2ee1e14c7..f415d39a2 100644
--- a/shortcuts/CompizShortcutModeller.cpp
+++ b/shortcuts/CompizShortcutModeller.cpp
@@ -69,6 +69,7 @@ namespace
const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud";
const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu";
const std::string UNITYSHELL_OPTION_SPREAD_APP_WINDOWS = "spread_app_windows";
+ const std::string UNITYSHELL_OPTION_SPREAD_APP_WINDOWS_ANYWHERE = "spread_app_windows_anywhere";
const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward";
const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL = "alt_tab_forward_all";
const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window";
@@ -324,6 +325,15 @@ void CompizModeller::AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hin
UNITYSHELL_PLUGIN_NAME,
UNITYSHELL_OPTION_SPREAD_APP_WINDOWS));
+ if (ws_enabled)
+ {
+ hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
+ _("Spreads all windows of the focused application in all the workspaces."),
+ shortcut::OptionType::COMPIZ_KEY,
+ UNITYSHELL_PLUGIN_NAME,
+ UNITYSHELL_OPTION_SPREAD_APP_WINDOWS_ANYWHERE));
+ }
+
hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
_("Minimises all windows."),
shortcut::OptionType::COMPIZ_KEY,