summaryrefslogtreecommitdiff
path: root/src/managers/KeybindManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/managers/KeybindManager.cpp')
-rw-r--r--src/managers/KeybindManager.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index c9008c2f..d04d6ba7 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -4,6 +4,7 @@
#include "../protocols/LayerShell.hpp"
#include "../protocols/ShortcutsInhibit.hpp"
#include "../protocols/GlobalShortcuts.hpp"
+#include "../protocols/IdleNotify.hpp"
#include "../protocols/core/DataDevice.hpp"
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
#include "KeybindManager.hpp"
@@ -143,6 +144,7 @@ CKeybindManager::CKeybindManager() {
m_dispatchers["event"] = event;
m_dispatchers["global"] = global;
m_dispatchers["setprop"] = setProp;
+ m_dispatchers["forceidle"] = forceIdle;
m_scrollTimer.reset();
@@ -3257,6 +3259,19 @@ SDispatchResult CKeybindManager::setProp(std::string args) {
return {};
}
+SDispatchResult CKeybindManager::forceIdle(std::string args) {
+ std::optional<float> duration = getPlusMinusKeywordResult(args, 0);
+
+ if (!duration.has_value()) {
+ Debug::log(ERR, "Duration invalid in forceIdle!");
+ return {.success = false, .error = "Duration invalid in forceIdle!"};
+ }
+
+ PROTO::idle->setTimers(duration.value() * 1000.0);
+
+ return {};
+}
+
SDispatchResult CKeybindManager::sendkeystate(std::string args) {
// args=<NEW_MODKEYS><NEW_KEY><STATE>[,WINDOW_RULES]
const auto ARGS = CVarList(args, 4);