Skip to content

Running egui app outside main thread #1489

Answered by ghost
kubo-von asked this question in Q&A
Discussion options

You must be logged in to vote

Actually there is a way under Linux to do this:
Add this to your Cargo.toml

[dependencies.winit]
default-features = false
features = ["wayland"]
version = "0.28.7"

[dependencies.eframe]
default-features = false
features = ["default_fonts", "glow", "wayland"]
version = "0.23.0"

Then do this in rust:

use std::thread;

use eframe::egui;
use eframe::EventLoopBuilderHook;
use winit::platform::wayland::EventLoopBuilderExtWayland;

fn main() {
	let _handle = thread::spawn(|| {
		let event_loop_builder: Option<EventLoopBuilderHook> = Some(Box::new(|event_loop_builder| {
			event_loop_builder.with_any_thread(true);
		}));
		let native_options = eframe::NativeOptions {
			event_loop_builder,
			..D…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@buxx
Comment options

@tomas-vancura-nlk
Comment options

Answer selected by lucasmerlin
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants