rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.89k stars 914 forks source link

Cursor icon doesn't follow system cursor theme #3863

Closed HaoliangXu closed 3 months ago

HaoliangXu commented 3 months ago

Description

This is the theme showing on a winit window: Screenshot from 2024-08-13 16-09-56

This is the cursor theme(Yaru on Ubuntu) showing on another application: Screenshot from 2024-08-13 16-12-36

It's inconsistent experience for an end user, especially for "resize" icons.

Debugging output

No response

Window isn't shown unless you draw

Winit version

0.30.5

kchibisov commented 3 months ago

Set XCURSOR_THEME to the cursor you're using.

You're likely setting your from the dbus.

HaoliangXu commented 3 months ago

I actually did this before the post. It works. I know it can be made permanently. But other applications, even the ones made all by rust, don't need to set this variable. Like what I said, to the end users, who may not know how to set it, it's not a good experience.

kchibisov commented 3 months ago

We use the default theme when the variable is missing and also use the cursor-shape-v1 protocol.

If the rust app is using dbus it won't have this issue.

Nothing winit can do about it, since it tries to look for default theme and you have nothing set as default in traditional way of setting it(~/.icons/default).

HaoliangXu commented 3 months ago

Thank you for the reply, I think I understand now. Do you mean the variable is missing and "not" using cursor-shape-v1 protocol? So the way to solve it is to use dbus in addition with winit in the application.

kchibisov commented 3 months ago

cursor-shape-v1 means that compositor sets the cursor, so it's not used, likely because your system is too lod.

The way to solve it is to set the theme in your configuration. You certainly can use dbus to get the GTK variable, but it's GTK specific.