Skip to content

Commit

Permalink
remove window theme workaround for Linux
Browse files Browse the repository at this point in the history
since the issue was solved in tao crate
  • Loading branch information
rhysd committed Oct 26, 2023
1 parent 997c087 commit 3158b50
Showing 1 changed file with 2 additions and 24 deletions.
26 changes: 2 additions & 24 deletions v2/src/wry/webview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ pub struct WebViewRenderer {
zoom_level: ZoomLevel,
always_on_top: bool,
menu: Menu,
#[cfg(target_os = "linux")]
theme: ThemeConfig,
}

impl WebViewRenderer {
Expand Down Expand Up @@ -197,8 +195,7 @@ impl WebViewRenderer {
builder = builder.with_always_on_top(true);
}

let theme = config.window().theme;
match theme {
match config.window().theme {
ThemeConfig::System => {}
ThemeConfig::Dark => builder = builder.with_theme(Some(Theme::Dark)),
ThemeConfig::Light => builder = builder.with_theme(Some(Theme::Light)),
Expand Down Expand Up @@ -240,14 +237,7 @@ impl WebViewRenderer {
log::debug!("Opened DevTools for debugging");
}

Ok(WebViewRenderer {
webview,
zoom_level,
always_on_top,
menu,
#[cfg(target_os = "linux")]
theme,
})
Ok(WebViewRenderer { webview, zoom_level, always_on_top, menu })
}
}

Expand Down Expand Up @@ -292,18 +282,6 @@ impl Renderer for WebViewRenderer {
Some(WindowState { width, height, x, y, fullscreen, zoom_level, always_on_top })
}

// On Linux, `Window::theme` does not return the theme set when building window. For the workaround,
// remember the theme config and respect it.
// https://github.com/tauri-apps/tao/issues/799
#[cfg(target_os = "linux")]
fn theme(&self) -> RendererTheme {
match self.theme {
ThemeConfig::Light => RendererTheme::Light,
ThemeConfig::Dark => RendererTheme::Dark,
ThemeConfig::System => window_theme(self.webview.window()),
}
}
#[cfg(not(target_os = "linux"))]
fn theme(&self) -> RendererTheme {
window_theme(self.webview.window())
}
Expand Down

0 comments on commit 3158b50

Please sign in to comment.