summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
authorvaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-30 21:35:27 +0200
committervaxerski <43317083+vaxerski@users.noreply.github.com>2022-08-30 21:35:27 +0200
commit1cf46fd6a26cb16104a39a4fe73ca7ccd6c1ba36 (patch)
tree151d9420e8d6c3a4220057fae56e0225817bc924 /src/managers/KeybindManager.cpp
parenteb658dcb612806cd801a438f4ec61701e7f26bc4 (diff)
added closewindow dispatcher
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 04cc0d9b..5d791004 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -7,6 +7,7 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["exec"] = spawn;
m_mDispatchers["killactive"] = killActive;
+ m_mDispatchers["closewindow"] = kill;
m_mDispatchers["togglefloating"] = toggleActiveFloating;
m_mDispatchers["workspace"] = changeworkspace;
m_mDispatchers["fullscreen"] = fullscreenActive;
@@ -475,6 +476,17 @@ void CKeybindManager::killActive(std::string args) {
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() {
m_lKeybinds.clear();
}