Merge lp:~3v1n0/unity/scale-shortcut-hint into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3698
Proposed branch: lp:~3v1n0/unity/scale-shortcut-hint
Merge into: lp:unity
Diff against target: 124 lines (+34/-13)
2 files modified
shortcuts/CompizShortcutModeller.cpp (+32/-11)
shortcuts/CompizShortcutModeller.h (+2/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/scale-shortcut-hint
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend (community) Approve
Review via email: mp+209326@code.launchpad.net

Commit message

CompizShortcutModeller: use proper keys for Spread and be dependent on workspace setting

Description of the change

Add back Super+W shortcut, and include workspace-depending settings as well.

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
Christopher Townsend (townsend) wrote :

LGTM

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'shortcuts/CompizShortcutModeller.cpp'
2--- shortcuts/CompizShortcutModeller.cpp 2013-12-04 19:42:43 +0000
3+++ shortcuts/CompizShortcutModeller.cpp 2014-03-04 18:35:25 +0000
4@@ -59,6 +59,7 @@
5 const std::string RESIZE_OPTION_INITIATE_BUTTON = "initiate_button";
6
7 // Compiz Scale Options
8+ const std::string SCALE_OPTION_INITIATE_KEY = "initiate_key";
9 const std::string SCALE_OPTION_INITIATE_ALL_KEY = "initiate_all_key";
10
11 // Compiz Unityshell Options
12@@ -68,6 +69,7 @@
13 const std::string UNITYSHELL_OPTION_SHOW_HUD = "show_hud";
14 const std::string UNITYSHELL_OPTION_PANEL_FIRST_MENU = "panel_first_menu";
15 const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD = "alt_tab_forward";
16+ const std::string UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL = "alt_tab_forward_all";
17 const std::string UNITYSHELL_OPTION_ALT_TAB_NEXT_WINDOW = "alt_tab_next_window";
18
19 // Compiz Wall Options
20@@ -90,27 +92,26 @@
21 void CompizModeller::BuildModel(int hsize, int vsize)
22 {
23 std::list<shortcut::AbstractHint::Ptr> hints;
24+ bool workspace_enabled = (hsize * vsize > 1);
25
26- if (hsize * vsize > 1)
27+ if (workspace_enabled)
28 {
29- // Workspaces enabled
30 AddLauncherHints(hints);
31 AddDashHints(hints);
32 AddMenuHints(hints);
33- AddSwitcherHints(hints);
34+ AddSwitcherHints(hints, workspace_enabled);
35 AddWorkspaceHints(hints);
36- AddWindowsHints(hints);
37 }
38 else
39 {
40- // Workspaces disabled
41 AddLauncherHints(hints);
42 AddMenuHints(hints);
43- AddSwitcherHints(hints);
44+ AddSwitcherHints(hints, workspace_enabled);
45 AddDashHints(hints);
46- AddWindowsHints(hints);
47 }
48
49+ AddWindowsHints(hints, workspace_enabled);
50+
51 model_ = std::make_shared<shortcut::Model>(hints);
52 model_changed.emit(model_);
53 }
54@@ -239,7 +240,7 @@
55 _("Cursor Left or Right")));
56 }
57
58-void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints)
59+void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws_enabled)
60 {
61 static const std::string switching(_("Switching"));
62
63@@ -249,6 +250,15 @@
64 UNITYSHELL_PLUGIN_NAME,
65 UNITYSHELL_OPTION_ALT_TAB_FORWARD));
66
67+ if (ws_enabled)
68+ {
69+ hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
70+ _("Switches between applications from all workspaces."),
71+ shortcut::OptionType::COMPIZ_KEY,
72+ UNITYSHELL_PLUGIN_NAME,
73+ UNITYSHELL_OPTION_ALT_TAB_FORWARD_ALL));
74+ }
75+
76 hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
77 _("Switches windows of current applications."),
78 shortcut::OptionType::COMPIZ_KEY,
79@@ -284,15 +294,26 @@
80 WALL_OPTION_LEFT_WINDOW_KEY));
81 }
82
83-void CompizModeller::AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints)
84+void CompizModeller::AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws_enabled)
85 {
86 static const std::string windows(_("Windows"));
87
88 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
89- _("Spreads all windows in the current workspace."),
90+ (ws_enabled ?
91+ _("Spreads all windows in the current workspace.") :
92+ _("Spreads all windows.")),
93 shortcut::OptionType::COMPIZ_KEY,
94 SCALE_PLUGIN_NAME,
95- SCALE_OPTION_INITIATE_ALL_KEY));
96+ SCALE_OPTION_INITIATE_KEY));
97+
98+ if (ws_enabled)
99+ {
100+ hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
101+ _("Spreads all windows in all the workspaces."),
102+ shortcut::OptionType::COMPIZ_KEY,
103+ SCALE_PLUGIN_NAME,
104+ SCALE_OPTION_INITIATE_ALL_KEY));
105+ }
106
107 hints.push_back(std::make_shared<shortcut::Hint>(windows, "", "",
108 _("Minimises all windows."),
109
110=== modified file 'shortcuts/CompizShortcutModeller.h'
111--- shortcuts/CompizShortcutModeller.h 2013-01-23 14:57:58 +0000
112+++ shortcuts/CompizShortcutModeller.h 2014-03-04 18:35:25 +0000
113@@ -39,9 +39,9 @@
114 void AddLauncherHints(std::list<shortcut::AbstractHint::Ptr> &hints);
115 void AddDashHints(std::list<shortcut::AbstractHint::Ptr> &hints);
116 void AddMenuHints(std::list<shortcut::AbstractHint::Ptr> &hints);
117- void AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints);
118+ void AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws);
119 void AddWorkspaceHints(std::list<shortcut::AbstractHint::Ptr> &hints);
120- void AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints);
121+ void AddWindowsHints(std::list<shortcut::AbstractHint::Ptr> &hints, bool ws);
122
123 Model::Ptr model_;
124 };