summaryrefslogtreecommitdiff
diff options
-rw-r--r--launcher/SwitcherView.cpp16
-rw-r--r--launcher/SwitcherView.h1
-rw-r--r--shortcuts/CompizShortcutModeller.cpp37
-rw-r--r--unity-shared/XKeyboardUtil.h1
4 files changed, 46 insertions, 9 deletions
diff --git a/launcher/SwitcherView.cpp b/launcher/SwitcherView.cpp
index e073b1261..3419ee467 100644
--- a/launcher/SwitcherView.cpp
+++ b/launcher/SwitcherView.cpp
@@ -24,6 +24,7 @@
#include "unity-shared/IconRenderer.h"
#include "unity-shared/TimeUtil.h"
#include "unity-shared/UScreen.h"
+#include "unity-shared/XKeyboardUtil.h"
#include <Nux/Nux.h>
@@ -72,6 +73,7 @@ SwitcherView::SwitcherView(ui::AbstractIconRenderer::Ptr const& renderer)
, last_detail_icon_selected_(-1)
, last_mouse_scroll_time_(0)
, check_mouse_first_time_(true)
+ , key_right_to_tab_(NUX_VK_q)
{
icon_renderer_->pip_style = OVER_TILE;
icon_renderer_->monitor = monitors::MAX;
@@ -105,6 +107,14 @@ SwitcherView::SwitcherView(ui::AbstractIconRenderer::Ptr const& renderer)
return geo;
});
+ if (Display* dpy = nux::GetGraphicsDisplay()->GetX11Display())
+ {
+ KeySym sym = keyboard::get_key_right_to_key_symbol(dpy, XStringToKeysym("Tab"));
+
+ if (sym != NoSymbol)
+ key_right_to_tab_ = sym;
+ }
+
animation_.updated.connect(sigc::hide(sigc::mem_fun(this, &SwitcherView::PreLayoutManagement)));
}
@@ -500,9 +510,9 @@ bool SwitcherView::InspectKeyEvent(unsigned int eventType, unsigned int keysym,
case NUX_VK_DOWN:
switcher_start_detail.emit();
break;
- case NUX_VK_q:
- switcher_close_current.emit();
- break;
+ default:
+ if (keysym == key_right_to_tab_)
+ switcher_close_current.emit();
}
}
diff --git a/launcher/SwitcherView.h b/launcher/SwitcherView.h
index 1e2caf61d..00a690358 100644
--- a/launcher/SwitcherView.h
+++ b/launcher/SwitcherView.h
@@ -160,6 +160,7 @@ private:
int last_detail_icon_selected_;
uint64_t last_mouse_scroll_time_;
bool check_mouse_first_time_;
+ KeySym key_right_to_tab_;
DeltaTracker delta_tracker_;
diff --git a/shortcuts/CompizShortcutModeller.cpp b/shortcuts/CompizShortcutModeller.cpp
index f415d39a2..5d4b373fe 100644
--- a/shortcuts/CompizShortcutModeller.cpp
+++ b/shortcuts/CompizShortcutModeller.cpp
@@ -21,7 +21,9 @@
#include <glib/gi18n-lib.h>
#include "CompizShortcutModeller.h"
#include "ShortcutHint.h"
+#include "ShortcutHintPrivate.h"
#include "unity-shared/WindowManager.h"
+#include "unity-shared/XKeyboardUtil.h"
namespace unity
{
@@ -246,11 +248,12 @@ void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hi
{
static const std::string switching(_("Switching"));
- hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
- _("Switches between applications."),
- shortcut::OptionType::COMPIZ_KEY,
- UNITYSHELL_PLUGIN_NAME,
- UNITYSHELL_OPTION_ALT_TAB_FORWARD));
+ auto switcher_init = std::make_shared<shortcut::Hint>(switching, "", "",
+ _("Switches between applications."),
+ shortcut::OptionType::COMPIZ_KEY,
+ UNITYSHELL_PLUGIN_NAME,
+ UNITYSHELL_OPTION_ALT_TAB_FORWARD);
+ hints.push_back(switcher_init);
if (ws_enabled)
{
@@ -271,6 +274,30 @@ void CompizModeller::AddSwitcherHints(std::list<shortcut::AbstractHint::Ptr> &hi
_("Moves the focus."),
shortcut::OptionType::HARDCODED,
_("Cursor Left or Right")));
+
+ hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
+ _("Enter / Exit from spread mode or Select windows."),
+ shortcut::OptionType::HARDCODED,
+ _("Cursor Up or Down")));
+
+ if (Display *dpy = nux::GetGraphicsDisplay()->GetX11Display())
+ {
+ if (const char* key = XKeysymToString(keyboard::get_key_right_to_key_symbol(dpy, XStringToKeysym("Tab"))))
+ {
+ std::string closekey = key;
+ switcher_init->Fill();
+ auto const& switcher_init_key = switcher_init->shortkey();
+ auto meta_separator = switcher_init_key.find("+");
+
+ if (meta_separator != std::string::npos)
+ closekey = switcher_init_key.substr(0, meta_separator-1) + " + " + closekey;
+
+ hints.push_back(std::make_shared<shortcut::Hint>(switching, "", "",
+ _("Closes the selected application / window."),
+ shortcut::OptionType::HARDCODED,
+ impl::ProperCase(closekey)));
+ }
+ }
}
void CompizModeller::AddWorkspaceHints(std::list<shortcut::AbstractHint::Ptr> &hints)
diff --git a/unity-shared/XKeyboardUtil.h b/unity-shared/XKeyboardUtil.h
index b71169a9c..8f99adc27 100644
--- a/unity-shared/XKeyboardUtil.h
+++ b/unity-shared/XKeyboardUtil.h
@@ -32,7 +32,6 @@ KeySym get_key_below_key_symbol(Display* display, KeySym key_symbol);
KeySym get_key_right_to_key_symbol(Display* display, KeySym key_symbol);
KeySym get_key_left_to_key_symbol(Display* display, KeySym key_symbol);
-
}
}