diff --git a/window/src/os/wayland/connection.rs b/window/src/os/wayland/connection.rs index f20417ee0e8..17c3738e7e6 100644 --- a/window/src/os/wayland/connection.rs +++ b/window/src/os/wayland/connection.rs @@ -7,7 +7,7 @@ use crate::os::wayland::output::OutputHandler; use crate::os::x11::keyboard::Keyboard; use crate::screen::{ScreenInfo, Screens}; use crate::spawn::*; -use crate::{Connection, ScreenRect, WindowEvent}; +use crate::{Appearance, Connection, ScreenRect, WindowEvent}; use anyhow::{bail, Context}; use mio::unix::SourceFd; use mio::{Events, Interest, Poll, Token}; @@ -425,6 +425,17 @@ impl ConnectionOps for WaylandConnection { *self.should_terminate.borrow_mut() = true; } + fn get_appearance(&self) -> Appearance { + match promise::spawn::block_on(crate::os::xdg_desktop_portal::get_appearance()) { + Ok(appearance) => return appearance, + Err(err) => { + log::debug!("Unable to resolve appearance using xdg-desktop-portal: {err:#}"); + } + } + // fallback + Appearance::Light + } + fn run_message_loop(&self) -> anyhow::Result<()> { let res = self.run_message_loop_impl(); // Ensure that we drop these eagerly, to avoid diff --git a/window/src/os/x11/connection.rs b/window/src/os/x11/connection.rs index b1f7fe0fa27..c9c3bf302a0 100644 --- a/window/src/os/x11/connection.rs +++ b/window/src/os/x11/connection.rs @@ -125,6 +125,12 @@ impl ConnectionOps for XConnection { } fn get_appearance(&self) -> Appearance { + match promise::spawn::block_on(crate::os::xdg_desktop_portal::get_appearance()) { + Ok(appearance) => return appearance, + Err(err) => { + log::debug!("Unable to resolve appearance using xdg-desktop-portal: {err:#}"); + } + } if let Some(XSetting::String(name)) = self.xsettings.borrow().get("Net/ThemeName") { let lower = name.to_ascii_lowercase(); match lower.as_str() { diff --git a/window/src/os/x_and_wayland.rs b/window/src/os/x_and_wayland.rs index c802b36ce1c..935d98b2a65 100644 --- a/window/src/os/x_and_wayland.rs +++ b/window/src/os/x_and_wayland.rs @@ -142,12 +142,6 @@ impl ConnectionOps for Connection { } fn get_appearance(&self) -> Appearance { - match promise::spawn::block_on(crate::os::xdg_desktop_portal::get_appearance()) { - Ok(appearance) => return appearance, - Err(err) => { - log::debug!("Unable to resolve appearance using xdg-desktop-portal: {err:#}"); - } - } match self { Self::X11(x) => x.get_appearance(), #[cfg(feature = "wayland")]