From da455cafa12627b5c8bf75dac7898aeb9c755198 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Thu, 2 Sep 2021 09:05:13 -0700 Subject: [PATCH] window: plumb get_appearance on x11/wayland systems Not sure what happened here: presumably a borked merge or something similar, but this commit allows `window:get_appearance` to return the actual appearance value on X11. Even though this plumbs the call through to Wayland, Wayland doesn't provide an equivalent concept so still always return Light, as is mentioned on our docs. closes: #1098 --- docs/changelog.md | 1 + window/src/os/x_and_wayland.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/changelog.md b/docs/changelog.md index 80845a5d3..0813d8099 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -24,6 +24,7 @@ As features stabilize some brief notes about them will accumulate here. * Changed: X11: we now allow matching visuals with >= 8 bits per rgb value. Previously, we only matched exactly 8 bits. This improve compatibility with systems that have the COMPOSITE extension disabled. Thanks to [@shizeeg](https://github.com/shizeeg)! [#1083](https://github.com/wez/wezterm/pull/1083) * Fixed: macOS: `send_composed_key_when_left_alt_is_pressed` and `send_composed_key_when_right_alt_is_pressed` are now respected when `use_ime=true`. Thanks to [@jakelinnzy](https://github.com/jakelinnzy)! [#1096](https://github.com/wez/wezterm/pull/1096) * Fixed: X11: jittery resize with some window managers [#1051](https://github.com/wez/wezterm/issues/1051) +* Fixed: X11: [window:get_appearance](config/lua/window/get_appearance.md) now actually returns Dark when the theme is dark. [#1098](https://github.com/wez/wezterm/issues/1098) ### 20210814-124438-54e29167 diff --git a/window/src/os/x_and_wayland.rs b/window/src/os/x_and_wayland.rs index bbb405a0f..641e751dd 100644 --- a/window/src/os/x_and_wayland.rs +++ b/window/src/os/x_and_wayland.rs @@ -7,7 +7,7 @@ use crate::os::wayland::connection::WaylandConnection; use crate::os::wayland::window::WaylandWindow; use crate::os::x11::connection::XConnection; use crate::os::x11::window::XWindow; -use crate::{Clipboard, MouseCursor, Rect, ScreenPoint, WindowEvent, WindowOps}; +use crate::{Appearance, Clipboard, MouseCursor, Rect, ScreenPoint, WindowEvent, WindowOps}; use async_trait::async_trait; use config::ConfigHandle; use promise::*; @@ -121,6 +121,14 @@ impl ConnectionOps for Connection { Self::Wayland(w) => w.run_message_loop(), } } + + fn get_appearance(&self) -> Appearance { + match self { + Self::X11(x) => x.get_appearance(), + #[cfg(feature = "wayland")] + Self::Wayland(w) => w.get_appearance(), + } + } } impl Window {