Smithay / client-toolkit

Smithay's toolkit for writing wayland clients
MIT License
285 stars 80 forks source link

egui layer shell example #349

Open yavko opened 1 year ago

yavko commented 1 year ago

Hello I'm new to sctk, and it would be helpful for me and others who want to use egui with layer shell if there was an example, thanks!

m-hugo commented 1 year ago

there's two way to go about it, both are a lot of work:

yavko commented 1 year ago

there's two way to go about it, both are a lot of work:

* go through winit, implement this [Feature request: Support for Wayland's wlr-layer-shell protocol rust-windowing/winit#2582](https://github.com/rust-windowing/winit/issues/2582) and modify egui-winit to use the newly exposed api

* modify egui-winit to use sctk directly instead of winit

Doesn't egui support using wgpu, or glow, could they be used with sctk?

m-hugo commented 1 year ago

yes, it shoud be easy to make egui render to a sctk wayland window through wgpu, the 'hard' part is the windowing part

yavko commented 1 year ago

yes, it shoud be easy to make egui render to a sctk wayland window through wgpu, the 'hard' part is the windowing

So would it also be possible through layer shell?

m-hugo commented 1 year ago

yes your main would look like this https://github.com/Smithay/client-toolkit/blob/master/examples/simple_layer.rs / https://github.com/Smithay/client-toolkit/blob/master/examples/wgpu.rs but instead of using wgpu direcly you'd use the egui stuff like https://github.com/rust-mobile/rust-android-examples/blob/main/agdk-egui/src/lib.rs

ids1024 commented 1 year ago

The best solution for this would be layer shell support in winit (https://github.com/rust-windowing/winit/issues/2582). Or perhaps a winit-like library on top of sctk could provide a dedicated way to deal with layer shell surfaces.

yavko commented 1 year ago

The best solution for this would be layer shell support in winit (rust-windowing/winit#2582). Or perhaps a winit-like library on top of sctk could provide a dedicated way to deal with layer shell surfaces.

I would prefer that too, but a example using raw apis would be cool for the moment, and could be useful.