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 7, 2023
1 parent ff2338c commit c5d69e1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/wayland/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1210,8 +1210,19 @@ static gboolean wayland_cursor_reload_theme(guint scale) {
}
cursor_size *= scale;

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

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 c5d69e1

Please sign in to comment.