diff --git a/src/Compositor.hpp b/src/Compositor.hpp index fd40d911..15e22014 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -94,6 +94,7 @@ public: bool m_bReadyToProcess = false; bool m_bSessionActive = true; + bool m_bDPMSStateON = true; // ------------------------------------------------- // diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index 88ed90e3..f327c0aa 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -52,6 +52,7 @@ void CConfigManager::setDefaultVars() { configValues["misc:disable_splash_rendering"].intValue = 0; configValues["misc:no_vfr"].intValue = 1; configValues["misc:damage_entire_on_snapshot"].intValue = 0; + configValues["misc:mouse_move_enables_dpms"].intValue = 0; configValues["debug:int"].intValue = 0; configValues["debug:log_damage"].intValue = 0; diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 9da1b0b6..155cc38b 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -1340,4 +1340,6 @@ void CKeybindManager::dpms(std::string arg) { if (enable) g_pHyprRenderer->damageMonitor(m.get()); } + + g_pCompositor->m_bDPMSStateON = enable; } diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp index b938c557..4f0d29f9 100644 --- a/src/managers/KeybindManager.hpp +++ b/src/managers/KeybindManager.hpp @@ -6,6 +6,8 @@ #include #include +class CInputManager; + struct SKeybind { std::string key = ""; int keycode = -1; @@ -101,6 +103,7 @@ private: static void dpms(std::string); friend class CCompositor; + friend class CInputManager; }; inline std::unique_ptr g_pKeybindManager; diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 21c3be68..29b16c3b 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -29,6 +29,7 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) { void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { static auto *const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue; + static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue; if (!g_pCompositor->m_bReadyToProcess) return; @@ -41,6 +42,11 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) { if (g_pCompositor->m_sSeat.mouse->virt) return; // don't refocus on virt + if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) { + // enable dpms + g_pKeybindManager->dpms("on"); + } + Vector2D mouseCoords = getMouseCoordsInternal(); const auto MOUSECOORDSFLOORED = mouseCoords.floor();