summaryrefslogtreecommitdiff
path: root/shortcuts
diff options
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2013-01-23 16:29:43 +0100
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2013-01-23 16:29:43 +0100
commit73661027ebb7c5671a3ea103fd32b293180d21ee (patch)
treee8cfaf480ea938c0cf1bd0ff356c2b1df7e81772 /shortcuts
parentb6e08c0093f83f188cbdce366db9e4e06a963353 (diff)
StandaloneShortcuts: update to new API, add timeout to switch model
(bzr r2919.3.65)
Diffstat (limited to 'shortcuts')
-rw-r--r--shortcuts/StandaloneShortcuts.cpp67
1 files changed, 65 insertions, 2 deletions
diff --git a/shortcuts/StandaloneShortcuts.cpp b/shortcuts/StandaloneShortcuts.cpp
index 2471821b9..95b604a46 100644
--- a/shortcuts/StandaloneShortcuts.cpp
+++ b/shortcuts/StandaloneShortcuts.cpp
@@ -43,9 +43,9 @@ struct StandaloneController : Controller
: Controller(raiser, modeller)
{}
- nux::Geometry GetGeometryPerMonitor(int monitor) override
+ nux::Point GetOffsetPerMonitor(int monitor) override
{
- return nux::Geometry(0, 0, 1024, 700);
+ return nux::Point();
}
};
}
@@ -55,6 +55,18 @@ struct StandaloneModeller : shortcut::AbstractModeller
{
StandaloneModeller()
{
+ BuildFullModel();
+
+ model_switcher.reset(new glib::TimeoutSeconds(5, [this] {
+ static bool toggle = false;
+ if (toggle) BuildFullModel(); else BuildLightModel();
+ toggle = !toggle;
+ return true;
+ }));
+ }
+
+ void BuildFullModel()
+ {
std::list<shortcut::AbstractHint::Ptr> hints;
// Launcher...
@@ -251,6 +263,56 @@ struct StandaloneModeller : shortcut::AbstractModeller
"resize",
"initiate_key")));
model = std::make_shared<shortcut::Model>(hints);
+ model_changed.emit(model);
+ }
+
+ void BuildLightModel()
+ {
+ std::list<shortcut::AbstractHint::Ptr> hints;
+
+ // Launcher...
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", _(" (Hold)"),
+ _("Opens the Launcher, displays shortcuts."),
+ shortcut::OptionType::COMPIZ_KEY,
+ "unityshell",
+ "show_launcher" )));
+
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Launcher"), "", "",
+ _("Opens Launcher keyboard navigation mode."),
+ shortcut::OptionType::COMPIZ_KEY,
+ "unityshell",
+ "keyboard_focus")));
+
+ // Dash...
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Dash"), "", _(" (Tap)"),
+ _("Opens the Dash Home."),
+ shortcut::OptionType::COMPIZ_KEY,
+ "unityshell",
+ "show_launcher")));
+
+ // Is it really std::shared_ptr<shortcut::AbstractHint>(hard coded?
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("HUD & Menu Bar"), "", _(" (Hold)"),
+ _("Reveals the application menu."),
+ shortcut::OptionType::HARDCODED,
+ "Alt")));
+
+ // Switching
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Switching"), "", "",
+ _("Switches between applications."),
+ shortcut::OptionType::COMPIZ_KEY,
+ "unityshell",
+ "alt_tab_forward")));
+
+
+ // Windows
+ hints.push_back(std::shared_ptr<shortcut::AbstractHint>(new shortcut::MockHint(_("Windows"), "", "",
+ _("Spreads all windows in the current workspace."),
+ shortcut::OptionType::COMPIZ_KEY,
+ "scale",
+ "initiate_output_key")));
+
+ model = std::make_shared<shortcut::Model>(hints);
+ model_changed.emit(model);
}
shortcut::Model::Ptr GetCurrentModel() const
@@ -259,6 +321,7 @@ struct StandaloneModeller : shortcut::AbstractModeller
}
shortcut::Model::Ptr model;
+ glib::Source::UniquePtr model_switcher;
};
struct ShortcutsWindow