bevyengine / bevyengine/bevy

CustomCursor Does Not Work On Linux

Open
#18,385 3 comments 0 reactions 0 assignees View on GitHub
A-Rendering A-Windowing C-Bug
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

## Bevy version

v0.15.3

## Relevant system information

```
AdapterInfo { name: "AMD Radeon RX 7600 XT (RADV NAVI33)", vendor: 4098, device: 29824, device_type: DiscreteGpu, driver: "radv", driver_info: "Mesa 24.2.8", backend: Vulkan }
```

## What you did

I need a custom cursor for the game I'm working on. I inserted a `CursorIcon` component with a png:

```rust
const CURSOR_SIZE: u16 = 16;

fn setup_cursor_system(
mut commands: Commands,
mut window_created_events: EventReader,
asset_server: Res,
) {
for WindowCreated { window } in window_created_events.read() {
if let Some(mut window_commands) = commands.get_entity(*window) {
let cursor_texture = asset_server.load("sprites/gui/crosshair.png");

window_commands.insert(CursorIcon::Custom(CustomCursor::Image {
handle: cursor_texture,
hotspot: (CURSOR_SIZE / 2, CURSOR_SIZE / 2),
}));

debug!("Set custom game cursor");
} else {
error!("Failed to lookup window entity for setting game cursor");
}
}
}
```

## What went wrong

On Windows, the cursor does in fact render how I'd expect, but both X11 and Wayland do not render the custom cursor on Linux. Instead, only the default OS cursor is shown.

## Additional information

The work around I'm experimenting with right now is just creating a sprite and moving it to where the cursor is, but this doesn't work well with egui. The problem is that I don't know how to render the sprite in front of the gui. It would be much more ideal for the cursor to be rendered by the OS.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.