mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-22 18:49:49 +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 found = false;
|
||||
|
||||
if (handleInternalKeybinds(key))
|
||||
return true;
|
||||
|
||||
for (auto& k : m_dKeybinds) {
|
||||
if (modmask != k.modmask)
|
||||
continue;
|
||||
|
@ -56,6 +60,21 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
|
|||
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
|
||||
|
||||
void CKeybindManager::spawn(std::string args) {
|
||||
|
@ -201,4 +220,4 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition - g_pCompositor->getMonitorFromID(OLDWORKSPACE->monitorID)->vecPosition;
|
||||
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition + g_pCompositor->getMonitorFromID(NEWWORKSPACE->monitorID)->vecPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ public:
|
|||
private:
|
||||
std::deque<SKeybind> m_dKeybinds;
|
||||
|
||||
bool handleInternalKeybinds(xkb_keysym_t);
|
||||
|
||||
// -------------- Dispatchers -------------- //
|
||||
void killActive(std::string);
|
||||
|
|
Loading…
Reference in a new issue