From 0f6f7ea46f770e5fe05337fc3553a26029888666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?= Date: Thu, 20 Jun 2024 19:35:50 -0600 Subject: [PATCH] allow setting the default cursor theme/size --- config.def.h | 2 ++ dwl.c | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config.def.h b/config.def.h index a784eb4..a67fb69 100644 --- a/config.def.h +++ b/config.def.h @@ -7,6 +7,8 @@ static const int sloppyfocus = 1; /* focus follows mouse */ static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */ static const unsigned int borderpx = 1; /* border pixel of windows */ +static const char *cursor_theme = NULL; +static const char cursor_size[] = "24"; /* Make sure it's a valid integer, otherwise things will break */ static const float rootcolor[] = COLOR(0x222222ff); static const float bordercolor[] = COLOR(0x444444ff); static const float focuscolor[] = COLOR(0x005577ff); diff --git a/dwl.c b/dwl.c index 2cdc819..8eee53e 100644 --- a/dwl.c +++ b/dwl.c @@ -2509,8 +2509,12 @@ setup(void) * Xcursor themes to source cursor images from and makes sure that cursor * images are available at all scale factors on the screen (necessary for * HiDPI support). Scaled cursors will be loaded with each output. */ - cursor_mgr = wlr_xcursor_manager_create(NULL, 24); - setenv("XCURSOR_SIZE", "24", 1); + cursor_mgr = wlr_xcursor_manager_create(cursor_theme, atoi(cursor_size)); + setenv("XCURSOR_SIZE", cursor_size, 1); + if (cursor_theme) + setenv("XCURSOR_THEME", cursor_theme, 1); + else + unsetenv("XCURSOR_THEME"); /* * wlr_cursor *only* displays an image on screen. It does not move around