9 releases (breaking)

0.9.0 Nov 3, 2024
0.8.0 Feb 22, 2024
0.7.0 Jan 23, 2024
0.6.0 Dec 17, 2023
0.3.0 Sep 13, 2022

#1233 in GUI

Download history 17/week @ 2024-08-26 20/week @ 2024-09-02 24/week @ 2024-09-09 13/week @ 2024-09-16 38/week @ 2024-09-23 10/week @ 2024-09-30 1/week @ 2024-10-07 12/week @ 2024-10-14 5/week @ 2024-10-21 30/week @ 2024-10-28 189/week @ 2024-11-04 13/week @ 2024-11-11 10/week @ 2024-11-18 17/week @ 2024-11-25 2/week @ 2024-12-02 43/week @ 2024-12-09

73 downloads per month
Used in egui_overlay

MIT license

46KB
882 lines

Egui Overlay

In this context, Overlay simply means a gui application where

  1. It has a transparent window surface
  2. It can toggle the borders/decorations like title bar.
  3. 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.

https://github.com/coderedart/egui_overlay/assets/24411704/9f7bab7b-26ec-47d1-b51e-74006dfa7b0d

Platforms

  1. Windows
  2. Linux
    1. X11 supported natively. And wayland can work via Xwayland. But support might vary between window managers.
    2. You need a compositor that supports transparency. eg: kwin supports compositing, but i3wm needs an external compositor like picom.
    3. Some tiling window managers like i3wm need users to configure your overlay window as "floating" to keep it above other tiled windows.
  3. Mac

Bugs

  1. 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.

Dependencies

~9–16MB
~227K SLoC