diff options
-rw-r--r-- | swaybar/input.c | 14 | ||||
-rw-r--r-- | swaynag/swaynag.c | 14 |
2 files changed, 24 insertions, 4 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]; |
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]; |