allow setting the default cursor theme/size

This commit is contained in:
Leonardo Hernández Hernández 2024-06-20 19:35:50 -06:00
parent 650a918010
commit 0f6f7ea46f
No known key found for this signature in database
GPG Key ID: E538897EE11B9624
2 changed files with 8 additions and 2 deletions

View File

@ -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);

8
dwl.c
View File

@ -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