From 0e4fbb602c699b1bfb7128e111d7f580ecd1b146 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Tue, 21 May 2019 21:43:12 +0200 Subject: [PATCH] bar/wayland: read cursor theme/size from XCURSOR_* environment variables --- bar/wayland.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/bar/wayland.c b/bar/wayland.c index 151dc66..3d78d97 100644 --- a/bar/wayland.c +++ b/bar/wayland.c @@ -18,6 +18,7 @@ #include #define LOG_MODULE "bar:wayland" +#define LOG_ENABLE_DBG 0 #include "../log.h" #include "../tllist.h" @@ -619,8 +620,22 @@ setup(struct bar *_bar) return false; } + unsigned cursor_size = 24; + const char *cursor_theme = getenv("XCURSOR_THEME"); + + { + const char *env_cursor_size = getenv("XCURSOR_SIZE"); + if (env_cursor_size != NULL) { + unsigned size; + if (sscanf(env_cursor_size, "%u", &size) == 1) + cursor_size = size; + } + } + + LOG_INFO("cursor theme: %s, size: %u", cursor_theme, cursor_size); + backend->pointer.theme = wl_cursor_theme_load( - NULL, 24 * backend->monitor->scale, backend->shm); + cursor_theme, cursor_size * backend->monitor->scale, backend->shm); if (backend->pointer.theme == NULL) { LOG_ERR("failed to load cursor theme"); return false;