mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-11-16 23:05:58 +01:00
config: add general:hide_cursor
This commit is contained in:
parent
b8fcfe8352
commit
868e85e362
4 changed files with 12 additions and 1 deletions
|
@ -20,6 +20,7 @@ CConfigManager::CConfigManager() : m_config(getMainConfigPath().c_str(), Hyprlan
|
|||
|
||||
void CConfigManager::init() {
|
||||
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.addSpecialConfigValue("background", "monitor", Hyprlang::STRING{""});
|
||||
|
|
|
@ -13,4 +13,8 @@ void CCursorShape::setShape(const uint32_t serial, const wp_cursor_shape_device_
|
|||
return;
|
||||
|
||||
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);
|
||||
}
|
|
@ -8,6 +8,7 @@ class CCursorShape {
|
|||
CCursorShape(wp_cursor_shape_manager_v1* mgr);
|
||||
|
||||
void setShape(const uint32_t serial, const wp_cursor_shape_device_v1_shape shape);
|
||||
void hideCursor(const uint32_t serial);
|
||||
|
||||
private:
|
||||
wp_cursor_shape_manager_v1* mgr = nullptr;
|
||||
|
|
|
@ -255,7 +255,12 @@ static void handlePointerEnter(void* data, struct wl_pointer* wl_pointer, uint32
|
|||
if (!g_pHyprlock->m_pCursorShape)
|
||||
return;
|
||||
|
||||
g_pHyprlock->m_pCursorShape->setShape(serial, wp_cursor_shape_device_v1_shape::WP_CURSOR_SHAPE_DEVICE_V1_SHAPE_POINTER);
|
||||
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);
|
||||
}
|
||||
|
||||
static void handlePointerLeave(void* data, struct wl_pointer* wl_pointer, uint32_t serial, struct wl_surface* surface) {
|
||||
|
|
Loading…
Reference in a new issue