config: add general:hide_cursor

This commit is contained in:
Vaxry 2024-02-20 02:54:19 +00:00
parent b8fcfe8352
commit 868e85e362
4 changed files with 12 additions and 1 deletions

View file

@ -20,6 +20,7 @@ CConfigManager::CConfigManager() : m_config(getMainConfigPath().c_str(), Hyprlan
void CConfigManager::init() { void CConfigManager::init() {
m_config.addConfigValue("general:disable_loading_bar", Hyprlang::INT{0}); m_config.addConfigValue("general:disable_loading_bar", Hyprlang::INT{0});
m_config.addConfigValue("general:hide_cursor", Hyprlang::INT{0});
m_config.addSpecialCategory("background", Hyprlang::SSpecialCategoryOptions{.key = nullptr, .anonymousKeyBased = true}); m_config.addSpecialCategory("background", Hyprlang::SSpecialCategoryOptions{.key = nullptr, .anonymousKeyBased = true});
m_config.addSpecialConfigValue("background", "monitor", Hyprlang::STRING{""}); m_config.addSpecialConfigValue("background", "monitor", Hyprlang::STRING{""});

View file

@ -14,3 +14,7 @@ void CCursorShape::setShape(const uint32_t serial, const wp_cursor_shape_device_
wp_cursor_shape_device_v1_set_shape(dev, serial, shape); wp_cursor_shape_device_v1_set_shape(dev, serial, shape);
} }
void CCursorShape::hideCursor(const uint32_t serial) {
wl_pointer_set_cursor(g_pHyprlock->m_pPointer, serial, nullptr, 0, 0);
}

View file

@ -8,6 +8,7 @@ class CCursorShape {
CCursorShape(wp_cursor_shape_manager_v1* mgr); CCursorShape(wp_cursor_shape_manager_v1* mgr);
void setShape(const uint32_t serial, const wp_cursor_shape_device_v1_shape shape); void setShape(const uint32_t serial, const wp_cursor_shape_device_v1_shape shape);
void hideCursor(const uint32_t serial);
private: private:
wp_cursor_shape_manager_v1* mgr = nullptr; wp_cursor_shape_manager_v1* mgr = nullptr;

View file

@ -255,6 +255,11 @@ static void handlePointerEnter(void* data, struct wl_pointer* wl_pointer, uint32
if (!g_pHyprlock->m_pCursorShape) if (!g_pHyprlock->m_pCursorShape)
return; return;
static auto* const PHIDE = (Hyprlang::INT* const*)g_pConfigManager->getValuePtr("general:hide_cursor");
if (**PHIDE)
g_pHyprlock->m_pCursorShape->hideCursor(serial);
else
g_pHyprlock->m_pCursorShape->setShape(serial, wp_cursor_shape_device_v1_shape::WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER); g_pHyprlock->m_pCursorShape->setShape(serial, wp_cursor_shape_device_v1_shape::WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER);
} }