diff options
author | Daniel Eklöf <daniel@ekloef.se> | 2019-06-05 17:34:28 +0200 |
---|---|---|
committer | Brian Ashworth <bosrsf04@gmail.com> | 2019-06-05 14:40:29 -0400 |
commit | 900d3287f9b63df6320fa159aa0a842e8e8afd3d (patch) | |
tree | f2cb8940f6b06fd90337637cf4626303d9447cae /swaybar/input.c | |
parent | criteria: reset on semicolon separation (diff) | |
download | sway-900d3287f9b63df6320fa159aa0a842e8e8afd3d.tar.gz sway-900d3287f9b63df6320fa159aa0a842e8e8afd3d.tar.zst sway-900d3287f9b63df6320fa159aa0a842e8e8afd3d.zip |
swaybar/nag: use xcursor theme defined by XCURSOR_THEME/SIZE
If the XCURSOR_THEME and/or XCURSOR_SIZE environment variables are
set, use the theme and size they define.
If they're not set, use the same defaults as before (system default
theme, size=24).
Diffstat (limited to 'swaybar/input.c')
-rw-r--r-- | swaybar/input.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/swaybar/input.c b/swaybar/input.c index 92972146..8a83f38f 100644 --- a/swaybar/input.c +++ b/swaybar/input.c | |||
@@ -67,9 +67,19 @@ void update_cursor(struct swaybar_seat *seat) { | |||
67 | if (pointer->cursor_theme) { | 67 | if (pointer->cursor_theme) { |
68 | wl_cursor_theme_destroy(pointer->cursor_theme); | 68 | wl_cursor_theme_destroy(pointer->cursor_theme); |
69 | } | 69 | } |
70 | const char *cursor_theme = getenv("XCURSOR_THEME"); | ||
71 | unsigned cursor_size = 24; | ||
72 | const char *env_cursor_size = getenv("XCURSOR_SIZE"); | ||
73 | if (env_cursor_size) { | ||
74 | char *end; | ||
75 | unsigned size = strtoul(env_cursor_size, &end, 10); | ||
76 | if (!*end) { | ||
77 | cursor_size = size; | ||
78 | } | ||
79 | } | ||
70 | int scale = pointer->current ? pointer->current->scale : 1; | 80 | int scale = pointer->current ? pointer->current->scale : 1; |
71 | pointer->cursor_theme = wl_cursor_theme_load(NULL, 24 * scale, | 81 | pointer->cursor_theme = wl_cursor_theme_load( |
72 | seat->bar->shm); | 82 | cursor_theme, cursor_size * scale, seat->bar->shm); |
73 | struct wl_cursor *cursor; | 83 | struct wl_cursor *cursor; |
74 | cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); | 84 | cursor = wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); |
75 | pointer->cursor_image = cursor->images[0]; | 85 | pointer->cursor_image = cursor->images[0]; |