Skip to content

Commit

Permalink
Fallback wayland cursor theme to XCURSOR_THEME
Browse files Browse the repository at this point in the history
If the wayland environment doesn't set the cursor properly but the
XCURSOR_THEME variable is set, it should fallback to it.
  • Loading branch information
guillaumeboehm committed Sep 11, 2023
1 parent ff2338c commit 6342450
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion source/wayland/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,16 @@ static gboolean wayland_cursor_reload_theme(guint scale) {
}
cursor_size *= scale;

char *cursor_name = wayland->cursor.theme_name;
if(cursor_name == NULL) {
char *env_cursor_theme = (char *)g_getenv("XCURSOR_THEME");
if(strlen(env_cursor_theme) > 0) {
cursor_name = env_cursor_theme;
}
}

wayland->cursor.theme =
wl_cursor_theme_load(wayland->cursor.theme_name, cursor_size, wayland->shm);
wl_cursor_theme_load(cursor_name, cursor_size, wayland->shm);
if (wayland->cursor.theme != NULL) {
const char *const *cname = (const char *const *)wayland->cursor.name;
for (cname = (cname != NULL) ? cname : wayland_cursor_names;
Expand Down

0 comments on commit 6342450

Please sign in to comment.