In this context, Overlay simply means a gui application where
- It has a transparent window surface
- It can toggle the borders/decorations like title bar.
- can let the input like mouse clicks to passthrough its window surface.
Here, we will let input passthrough when egui doesn't need input.
The egui_overlay
crate just combines the functionality from egui_window_glfw_passthrough
for windowing functionality.
For rendering, we use egui_render_three_d
, as three-d
will allow you to draw a bunch of things easily.
But, as apple doesn't support opengl, we use egui_render_wgpu
on macos.
For advanced usecases, i recommend directly using egui_window_glfw_passthrough
crate directly with either wgpu or three-d or glow backend crates.
As you can see in lib.rs
, its barely 150 lines of code to set up. It will allow you more control over event loop, as well as drawing.
Look at the basic
example for a rough idea of how to use this crate for normal usecase.
Look at the triangle
example (only for linux/windows users, as i use three-d), to see how you can draw custom stuff too.
use
cargo run -p basic
to run the example.
example.mp4
- Windows
- Linux
- X11 supported natively. And wayland can work via Xwayland. But support might vary between window managers.
- You need a compositor that supports transparency. eg:
kwin
supports compositing, buti3wm
needs an external compositor likepicom
. - Some tiling window managers like i3wm need users to configure your overlay window as "floating" to keep it above other tiled windows.
- Mac
- On Mac, when passthrough is enabled, the window titlebar can only be clicked in the bottom half. The top half becomes passthrough too for some reason.