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 /swaynag/swaynag.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 'swaynag/swaynag.c')
-rw-r--r-- | swaynag/swaynag.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c index 26411ab3..87199a74 100644 --- a/swaynag/swaynag.c +++ b/swaynag/swaynag.c | |||
@@ -129,8 +129,18 @@ static void update_cursor(struct swaynag *swaynag) { | |||
129 | if (swaynag->pointer.cursor_theme) { | 129 | if (swaynag->pointer.cursor_theme) { |
130 | wl_cursor_theme_destroy(swaynag->pointer.cursor_theme); | 130 | wl_cursor_theme_destroy(swaynag->pointer.cursor_theme); |
131 | } | 131 | } |
132 | pointer->cursor_theme = wl_cursor_theme_load(NULL, 24 * swaynag->scale, | 132 | const char *cursor_theme = getenv("XCURSOR_THEME"); |
133 | swaynag->shm); | 133 | unsigned cursor_size = 24; |
134 | const char *env_cursor_size = getenv("XCURSOR_SIZE"); | ||
135 | if (env_cursor_size) { | ||
136 | char *end; | ||
137 | unsigned size = strtoul(env_cursor_size, &end, 10); | ||
138 | if (!*end) { | ||
139 | cursor_size = size; | ||
140 | } | ||
141 | } | ||
142 | pointer->cursor_theme = wl_cursor_theme_load( | ||
143 | cursor_theme, cursor_size * swaynag->scale, swaynag->shm); | ||
134 | struct wl_cursor *cursor = | 144 | struct wl_cursor *cursor = |
135 | wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); | 145 | wl_cursor_theme_get_cursor(pointer->cursor_theme, "left_ptr"); |
136 | pointer->cursor_image = cursor->images[0]; | 146 | pointer->cursor_image = cursor->images[0]; |