From 39bfff659fc3a419570d12e47503b339ddb8b647 Mon Sep 17 00:00:00 2001 From: Katherine Raye Date: Sun, 30 Nov 2025 19:08:44 -0500 Subject: [PATCH 1/3] Tablet: added option to hide cursor --- src/config/ConfigManager.cpp | 1 + src/managers/input/InputManager.hpp | 3 +++ src/managers/input/Tablets.cpp | 4 ++++ src/render/Renderer.cpp | 10 ++++++++-- src/render/Renderer.hpp | 1 + 5 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp index b6b52d345bf..5f3ef2de46c 100644 --- a/src/config/ConfigManager.cpp +++ b/src/config/ConfigManager.cpp @@ -737,6 +737,7 @@ CConfigManager::CConfigManager() { registerConfigVar("cursor:sync_gsettings_theme", Hyprlang::INT{1}); registerConfigVar("cursor:hide_on_key_press", Hyprlang::INT{0}); registerConfigVar("cursor:hide_on_touch", Hyprlang::INT{1}); + registerConfigVar("cursor:hide_on_pen", Hyprlang::INT{0}); registerConfigVar("cursor:use_cpu_buffer", Hyprlang::INT{2}); registerConfigVar("cursor:warp_back_after_non_mouse_input", Hyprlang::INT{0}); diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp index 9fbf68b4596..2d69efe1e1d 100644 --- a/src/managers/input/InputManager.hpp +++ b/src/managers/input/InputManager.hpp @@ -208,6 +208,9 @@ class CInputManager { // for hiding cursor on touch bool m_lastInputTouch = false; + // for hiding cursor when using a pen + bool m_lastInputPen = false; + // for tracking mouse refocus PHLWINDOWREF m_lastMouseFocus; diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 7a9c359aec7..b0628da6e75 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -169,6 +169,8 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { } void CInputManager::onTabletTip(CTablet::STipEvent e) { + m_lastInputPen = true; + EMIT_HOOK_EVENT_CANCELLABLE("tabletTip", e); const auto PTAB = e.tablet; @@ -214,9 +216,11 @@ void CInputManager::onTabletProximity(CTablet::SProximityEvent e) { PTOOL->m_active = e.in; if (!e.in) { + m_lastInputPen = false; if (PTOOL->getSurface()) unfocusTool(PTOOL); } else { + m_lastInputPen = true; simulateMouseMovement(); refocusTablet(PTAB, PTOOL); } diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index c4c72c41bd6..158fede6750 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -120,12 +120,14 @@ CHyprRenderer::CHyprRenderer() { }); static auto P2 = g_pHookSystem->hookDynamic("mouseMove", [&](void* self, SCallbackInfo& info, std::any param) { - if (!m_cursorHiddenConditions.hiddenOnKeyboard && m_cursorHiddenConditions.hiddenOnTouch == g_pInputManager->m_lastInputTouch && !m_cursorHiddenConditions.hiddenOnTimeout) + if (!m_cursorHiddenConditions.hiddenOnKeyboard && m_cursorHiddenConditions.hiddenOnTouch == g_pInputManager->m_lastInputTouch && + m_cursorHiddenConditions.hiddenOnPen == g_pInputManager->m_lastInputPen && !m_cursorHiddenConditions.hiddenOnTimeout) return; m_cursorHiddenConditions.hiddenOnKeyboard = false; m_cursorHiddenConditions.hiddenOnTimeout = false; m_cursorHiddenConditions.hiddenOnTouch = g_pInputManager->m_lastInputTouch; + m_cursorHiddenConditions.hiddenOnPen = g_pInputManager->m_lastInputPen; ensureCursorRenderingMode(); }); @@ -2148,19 +2150,23 @@ void CHyprRenderer::ensureCursorRenderingMode() { static auto PINVISIBLE = CConfigValue("cursor:invisible"); static auto PCURSORTIMEOUT = CConfigValue("cursor:inactive_timeout"); static auto PHIDEONTOUCH = CConfigValue("cursor:hide_on_touch"); + static auto PHIDEONPEN = CConfigValue("cursor:hide_on_pen"); static auto PHIDEONKEY = CConfigValue("cursor:hide_on_key_press"); if (*PCURSORTIMEOUT <= 0) m_cursorHiddenConditions.hiddenOnTimeout = false; if (*PHIDEONTOUCH == 0) m_cursorHiddenConditions.hiddenOnTouch = false; + if (*PHIDEONPEN == 0) + m_cursorHiddenConditions.hiddenOnPen = false; if (*PHIDEONKEY == 0) m_cursorHiddenConditions.hiddenOnKeyboard = false; if (*PCURSORTIMEOUT > 0) m_cursorHiddenConditions.hiddenOnTimeout = *PCURSORTIMEOUT < g_pInputManager->m_lastCursorMovement.getSeconds(); - m_cursorHiddenByCondition = m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnKeyboard; + m_cursorHiddenByCondition = + m_cursorHiddenConditions.hiddenOnTimeout || m_cursorHiddenConditions.hiddenOnTouch || m_cursorHiddenConditions.hiddenOnPen || m_cursorHiddenConditions.hiddenOnKeyboard; const bool HIDE = m_cursorHiddenByCondition || (*PINVISIBLE != 0); diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 1980984d267..3e01a4845bc 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -155,6 +155,7 @@ class CHyprRenderer { struct { bool hiddenOnTouch = false; + bool hiddenOnPen = false; bool hiddenOnTimeout = false; bool hiddenOnKeyboard = false; } m_cursorHiddenConditions; From 303c5eaf8838144ac7c30ec83d6b442c525f0020 Mon Sep 17 00:00:00 2001 From: Katherine Raye Date: Sun, 30 Nov 2025 20:27:38 -0500 Subject: [PATCH 2/3] forgot to format --- src/render/Renderer.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/render/Renderer.hpp b/src/render/Renderer.hpp index 3e01a4845bc..83a5f2d9498 100644 --- a/src/render/Renderer.hpp +++ b/src/render/Renderer.hpp @@ -155,7 +155,7 @@ class CHyprRenderer { struct { bool hiddenOnTouch = false; - bool hiddenOnPen = false; + bool hiddenOnPen = false; bool hiddenOnTimeout = false; bool hiddenOnKeyboard = false; } m_cursorHiddenConditions; From c55276ec07fcabb41e7a43463cfbbc5116477792 Mon Sep 17 00:00:00 2001 From: Katherine Raye Date: Sun, 30 Nov 2025 21:27:39 -0500 Subject: [PATCH 3/3] added entry in ConfigDescriptions --- src/config/ConfigDescriptions.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/config/ConfigDescriptions.hpp b/src/config/ConfigDescriptions.hpp index 6ef7c263489..fa940503995 100644 --- a/src/config/ConfigDescriptions.hpp +++ b/src/config/ConfigDescriptions.hpp @@ -1670,6 +1670,12 @@ inline static const std::vector CONFIG_OPTIONS = { .type = CONFIG_OPTION_BOOL, .data = SConfigOptionDescription::SBoolData{true}, }, + SConfigOptionDescription{ + .value = "cursor:hide_on_pen", + .description = "Hides the cursor when the last input was a pen input until a mouse input is done.", + .type = CONFIG_OPTION_BOOL, + .data = SConfigOptionDescription::SBoolData{true}, + }, SConfigOptionDescription{ .value = "cursor:use_cpu_buffer", .description = "Makes HW cursors use a CPU buffer. Required on Nvidia to have HW cursors. Experimental",