swaybar: add support for cursor themes

- uses environment variables SWAY_CURSOR_THEME and SWAY_CURSOR_SIZE
This commit is contained in:
Jiayi Zhao 2018-09-09 11:26:47 -04:00
parent cd14e1e64d
commit 5280b9510f

View file

@ -417,8 +417,14 @@ void bar_setup(struct swaybar *bar,
} }
} }
const char *cursor_theme = getenv("SWAY_CURSOR_THEME");
int cursor_size = atoi(getenv("SWAY_CURSOR_SIZE"));
if (cursor_size <= 0) {
cursor_size = 24;
}
pointer->cursor_theme = wl_cursor_theme_load( pointer->cursor_theme = wl_cursor_theme_load(
NULL, 24 * max_scale, bar->shm); cursor_theme, cursor_size * max_scale, bar->shm);
assert(pointer->cursor_theme); assert(pointer->cursor_theme);
struct wl_cursor *cursor; struct wl_cursor *cursor;
cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr");