mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 05:25:58 +01:00
Handle TTY switching
but bugs rn when coming back :-/
This commit is contained in:
parent
07612534dd
commit
ba7b2d0db2
2 changed files with 21 additions and 1 deletions
|
@ -28,6 +28,10 @@ uint32_t CKeybindManager::stringToModMask(std::string mods) {
|
||||||
|
|
||||||
bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t& key) {
|
bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t& key) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
|
if (handleInternalKeybinds(key))
|
||||||
|
return true;
|
||||||
|
|
||||||
for (auto& k : m_dKeybinds) {
|
for (auto& k : m_dKeybinds) {
|
||||||
if (modmask != k.modmask)
|
if (modmask != k.modmask)
|
||||||
continue;
|
continue;
|
||||||
|
@ -56,6 +60,21 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
||||||
|
// Handles the CTRL+ALT+FX TTY keybinds
|
||||||
|
if (!(keysym >= XKB_KEY_XF86Switch_VT_1 && keysym <= XKB_KEY_XF86Switch_VT_12))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
const auto PSESSION = wlr_backend_get_session(g_pCompositor->m_sWLRBackend);
|
||||||
|
if (PSESSION) {
|
||||||
|
const auto TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||||
|
wlr_session_change_vt(PSESSION, TTY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Dispatchers
|
// Dispatchers
|
||||||
|
|
||||||
void CKeybindManager::spawn(std::string args) {
|
void CKeybindManager::spawn(std::string args) {
|
||||||
|
|
|
@ -21,6 +21,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::deque<SKeybind> m_dKeybinds;
|
std::deque<SKeybind> m_dKeybinds;
|
||||||
|
|
||||||
|
bool handleInternalKeybinds(xkb_keysym_t);
|
||||||
|
|
||||||
// -------------- Dispatchers -------------- //
|
// -------------- Dispatchers -------------- //
|
||||||
void killActive(std::string);
|
void killActive(std::string);
|
||||||
|
|
Loading…
Reference in a new issue