mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -04:00
add support for cursor themes
- uses environment variables SWAY_CURSOR_THEME and SWAY_CURSOR_SIZE
This commit is contained in:
parent
f7568e26e9
commit
cd14e1e64d
2 changed files with 14 additions and 3 deletions
|
|
@ -507,11 +507,15 @@ void seat_remove_device(struct sway_seat *seat,
|
|||
|
||||
void seat_configure_xcursor(struct sway_seat *seat) {
|
||||
// TODO configure theme and size
|
||||
const char *cursor_theme = NULL;
|
||||
const char *cursor_theme = getenv("SWAY_CURSOR_THEME");
|
||||
int cursor_size = atoi(getenv("SWAY_CURSOR_SIZE"));
|
||||
if (cursor_size <= 0) {
|
||||
cursor_size = 24;
|
||||
}
|
||||
|
||||
if (!seat->cursor->xcursor_manager) {
|
||||
seat->cursor->xcursor_manager =
|
||||
wlr_xcursor_manager_create(cursor_theme, 24);
|
||||
wlr_xcursor_manager_create(cursor_theme, cursor_size);
|
||||
if (sway_assert(seat->cursor->xcursor_manager,
|
||||
"Cannot create XCursor manager for theme %s",
|
||||
cursor_theme)) {
|
||||
|
|
|
|||
|
|
@ -93,7 +93,13 @@ bool server_init(struct sway_server *server) {
|
|||
server->xwayland_ready.notify = handle_xwayland_ready;
|
||||
|
||||
// TODO: configurable cursor theme and size
|
||||
server->xwayland.xcursor_manager = wlr_xcursor_manager_create(NULL, 24);
|
||||
char *cursor_theme = getenv("SWAY_CURSOR_THEME");
|
||||
int cursor_size = atoi(getenv("SWAY_CURSOR_SIZE"));
|
||||
if (cursor_size <= 0) {
|
||||
cursor_size = 24;
|
||||
}
|
||||
|
||||
server->xwayland.xcursor_manager = wlr_xcursor_manager_create(cursor_theme, cursor_size);
|
||||
wlr_xcursor_manager_load(server->xwayland.xcursor_manager, 1);
|
||||
struct wlr_xcursor *xcursor = wlr_xcursor_manager_get_xcursor(
|
||||
server->xwayland.xcursor_manager, "left_ptr", 1);
|
||||
|
|
@ -103,6 +109,7 @@ bool server_init(struct sway_server *server) {
|
|||
image->width * 4, image->width, image->height, image->hotspot_x,
|
||||
image->hotspot_y);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
server->server_decoration_manager =
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue