diff options
author | Drew DeVault <sir@cmpwn.com> | 2016-07-17 10:59:03 -0400 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2016-07-17 11:26:30 -0400 |
commit | a9767ad2f742dc37896b3cae07d3ced80df28682 (patch) | |
tree | c091e801634666a9c4b0b68152b657a17ec93b55 /wayland | |
parent | Merge pull request #757 from siddharthist/master (diff) | |
download | sway-a9767ad2f742dc37896b3cae07d3ced80df28682.tar.gz sway-a9767ad2f742dc37896b3cae07d3ced80df28682.tar.zst sway-a9767ad2f742dc37896b3cae07d3ced80df28682.zip |
Allow users to customize the cursor on clients
This also sets the default size to 16 and documents all of the other
environment variables in use in sway(1).
Diffstat (limited to 'wayland')
-rw-r--r-- | wayland/window.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/wayland/window.c b/wayland/window.c index 9bc0d4a2..3f48d39f 100644 --- a/wayland/window.c +++ b/wayland/window.c | |||
@@ -112,7 +112,17 @@ struct window *window_setup(struct registry *registry, uint32_t width, uint32_t | |||
112 | get_next_buffer(window); | 112 | get_next_buffer(window); |
113 | 113 | ||
114 | if (registry->pointer) { | 114 | if (registry->pointer) { |
115 | window->cursor.cursor_theme = wl_cursor_theme_load("default", 32, registry->shm); // TODO: let you customize this | 115 | char *cursor_theme = getenv("SWAY_CURSOR_THEME"); |
116 | if (!cursor_theme) { | ||
117 | cursor_theme = "default"; | ||
118 | } | ||
119 | char *cursor_size = getenv("SWAY_CURSOR_SIZE"); | ||
120 | if (!cursor_size) { | ||
121 | cursor_size = "16"; | ||
122 | } | ||
123 | |||
124 | window->cursor.cursor_theme = wl_cursor_theme_load(cursor_theme, | ||
125 | atoi(cursor_size), registry->shm); | ||
116 | window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr"); | 126 | window->cursor.cursor = wl_cursor_theme_get_cursor(window->cursor.cursor_theme, "left_ptr"); |
117 | window->cursor.surface = wl_compositor_create_surface(registry->compositor); | 127 | window->cursor.surface = wl_compositor_create_surface(registry->compositor); |
118 | 128 | ||