added closewindow dispatcher

This commit is contained in:
vaxerski 2022-08-30 21:35:27 +02:00
parent eb658dcb61
commit 1cf46fd6a2
2 changed files with 13 additions and 0 deletions

View file

@ -7,6 +7,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["exec"] = spawn; m_mDispatchers["exec"] = spawn;
m_mDispatchers["killactive"] = killActive; m_mDispatchers["killactive"] = killActive;
m_mDispatchers["closewindow"] = kill;
m_mDispatchers["togglefloating"] = toggleActiveFloating; m_mDispatchers["togglefloating"] = toggleActiveFloating;
m_mDispatchers["workspace"] = changeworkspace; m_mDispatchers["workspace"] = changeworkspace;
m_mDispatchers["fullscreen"] = fullscreenActive; m_mDispatchers["fullscreen"] = fullscreenActive;
@ -475,6 +476,17 @@ void CKeybindManager::killActive(std::string args) {
g_pCompositor->closeWindow(g_pCompositor->m_pLastWindow); g_pCompositor->closeWindow(g_pCompositor->m_pLastWindow);
} }
void CKeybindManager::kill(std::string args) {
const auto PWINDOW = g_pCompositor->getWindowByRegex(args);
if (!PWINDOW) {
Debug::log(ERR, "kill: no window found");
return;
}
g_pCompositor->closeWindow(PWINDOW);
}
void CKeybindManager::clearKeybinds() { void CKeybindManager::clearKeybinds() {
m_lKeybinds.clear(); m_lKeybinds.clear();
} }

View file

@ -78,6 +78,7 @@ private:
// -------------- Dispatchers -------------- // // -------------- Dispatchers -------------- //
static void killActive(std::string); static void killActive(std::string);
static void kill(std::string);
static void spawn(std::string); static void spawn(std::string);
static void toggleActiveFloating(std::string); static void toggleActiveFloating(std::string);
static void toggleActivePseudo(std::string); static void toggleActivePseudo(std::string);