Skip to content

Commit

Permalink
fix: window icon under wayland
Browse files Browse the repository at this point in the history
  • Loading branch information
Integral-Tech committed Nov 18, 2024
1 parent e4726b4 commit 09cbf27
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tunet-gui/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ use tunet_settings::SettingsReader;
slint::include_modules!();

fn main() -> Result<()> {
#[cfg(target_os = "linux")]
if std::env::var("WAYLAND_DISPLAY").is_ok() {
wayland_set_app_id()?;
}

let app = App::new()?;

let context = UpdateContext::new(&app);
Expand Down Expand Up @@ -139,3 +144,15 @@ fn accent_color() -> color_theme::Color {
b: 212,
})
}

#[cfg(target_os = "linux")]
fn wayland_set_app_id() -> Result<(), slint::platform::SetPlatformError> {
use i_slint_backend_winit::winit::platform::wayland::WindowAttributesExtWayland;

let backend = i_slint_backend_winit::Backend::builder()
.with_window_attributes_hook(|attr| attr.with_name("io.github.berrysoft.tunet", ""))
.build()
.unwrap();

slint::platform::set_platform(Box::new(backend))
}

0 comments on commit 09cbf27

Please sign in to comment.