diff options
author | Richard Tamin <richard.tamin@gmail.com> | 2020-08-23 04:01:43 (GMT) |
---|---|---|
committer | Mathias Gumz <mgumz@users.noreply.github.com> | 2022-04-18 19:50:06 (GMT) |
commit | 174e62ff66fee78d83231b1f0f9ea083370ae55d (patch) | |
tree | 59168c7cc06e7a0d0ef0a3d55976db2fb733092c /src/fluxbox.hh | |
parent | 8e32f098bd94cb14ae80c3621c3db74fbdfa7bb6 (diff) | |
download | fluxbox-174e62ff66fee78d83231b1f0f9ea083370ae55d.zip fluxbox-174e62ff66fee78d83231b1f0f9ea083370ae55d.tar.bz2 |
Initial implementation of shortcut to windows
[PURPOSE]
In editors such as vi and emacs, a user can mark a line in a file with
a shortcut key and afterwards jump back to that line using the shortcut.
The idea is extended to opened windows. A user can assign a keyboard
shortcut to an opened window. Afterwards, the shortcut can be used to
switch focus back to the marked window.
Such shortcuts save the user from pressing "alt+tab" multiple times to
cycle through windows until the desired one is found.
[EXAMPLE USAGE]
The following binding is added to file "~/.fluxbox/keys":
Mod1 m ARG :MarkWindow
Mod1 g ARG :GotoMarkedWindow
User enters "alt+m x" to mark the currently focused window with shortcut
key 'x'
User enters "alt+g x" to switch focus to the marked window
[IMPLEMENTATION SUMMARY]
- Two new commands were added :MarkWindow and :GotoMarkedWindow
- Keys.cc was modified:
- addBinding() method supports parsing an argument placeholder where
the user can pass in a shortcut key
- doAction() method forwards the shortcut key to the command to execute
- Class Keys::t_key was modified to recognize a placeholder key
- New class ShortcutManager was added to maintain mapping of shortcut
keys to marked windows
Diffstat (limited to 'src/fluxbox.hh')
-rw-r--r-- | src/fluxbox.hh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fluxbox.hh b/src/fluxbox.hh index 42739fb..d300102 100644 --- a/src/fluxbox.hh +++ b/src/fluxbox.hh | |||
@@ -32,6 +32,7 @@ | |||
32 | #include "FbTk/MenuSearch.hh" | 32 | #include "FbTk/MenuSearch.hh" |
33 | 33 | ||
34 | #include "AttentionNoticeHandler.hh" | 34 | #include "AttentionNoticeHandler.hh" |
35 | #include "ShortcutManager.hh" | ||
35 | 36 | ||
36 | #include <X11/Xresource.h> | 37 | #include <X11/Xresource.h> |
37 | 38 | ||
@@ -185,6 +186,7 @@ public: | |||
185 | const XEvent &lastEvent() const { return m_last_event; } | 186 | const XEvent &lastEvent() const { return m_last_event; } |
186 | 187 | ||
187 | AttentionNoticeHandler &attentionHandler() { return m_attention_handler; } | 188 | AttentionNoticeHandler &attentionHandler() { return m_attention_handler; } |
189 | ShortcutManager &shortcutManager() { return *m_shortcut_manager; } | ||
188 | 190 | ||
189 | private: | 191 | private: |
190 | std::string getRcFilename(); | 192 | std::string getRcFilename(); |
@@ -306,6 +308,7 @@ private: | |||
306 | } m_state; | 308 | } m_state; |
307 | 309 | ||
308 | int m_server_grabs; | 310 | int m_server_grabs; |
311 | std::unique_ptr<ShortcutManager> m_shortcut_manager; | ||
309 | }; | 312 | }; |
310 | 313 | ||
311 | 314 | ||