Skip to content

A fast file manager for Windows and macOS that never freezes: tabs, dual panes, archives as folders, Quick Look-style previews. A File Explorer and Finder alternative written in Rust.

Hover tooltips follow Windows' light/dark switch (954)

denfrydc1fcc61081b
diff --git a/crates/rf-app/src/look/window.rs b/crates/rf-app/src/look/window.rs
index f3c1ac3a..eb914c76 100644
--- a/crates/rf-app/src/look/window.rs
+++ b/crates/rf-app/src/look/window.rs
@@ -169,6 +169,11 @@ impl LookWindow {
window.remove_window();
}
})];
+ // Windows' light / dark switch: the tooltips and the other toolkit widgets follow it (issue 954)
+ subs.push(cx.observe_window_appearance(window, |_: &mut Self, _, cx| {
+ crate::settings::follow_system_appearance(cx);
+ cx.notify();
+ }));
// Who changed the size? Right after our own resize it is us (the window may settle on a
// size a pixel or a frame off the one asked for); any other change is the user's, and
// that size is then kept for the next files.
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index 07a39eb2..d9de889b 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -2164,6 +2164,15 @@ impl Settings {
/// What this process last knew the settings file to hold (see [`Settings::save`]); `None` before the first `load`.
static BASELINE: crate::settings_merge::BaselineCell = parking_lot::Mutex::new(None);
+/// Windows switched between light and dark. With the system's theme the toolkit's widgets (the tooltips' card, menus, inputs) must
+/// follow as our palette does: their colours were set once, by [`apply_component_theme`] at start, and a hover tooltip kept the
+/// old background under the new text (issue 954).
+pub fn follow_system_appearance(cx: &mut App) {
+ if matches!(cx.global::<Settings>().theme, ThemePref::System) {
+ apply_component_theme(cx);
+ }
+}
+
/// Keeps gpui-component widgets (inputs, menus) in the same light/dark mode as our palette.
pub fn apply_component_theme(cx: &mut App) {
use gpui_kit::component::theme::{Theme, ThemeMode};
diff --git a/crates/rf-app/src/workspace.rs b/crates/rf-app/src/workspace.rs
index 39566e10..58901b90 100644
--- a/crates/rf-app/src/workspace.rs
+++ b/crates/rf-app/src/workspace.rs
@@ -1039,6 +1039,7 @@ impl Workspace {
cx.observe_window_appearance(window, |_: &mut Self, window, cx| {
let dark = matches!(window.appearance(), WindowAppearance::Dark | WindowAppearance::VibrantDark);
crate::settings::system_appearance_changed(dark);
+ crate::settings::follow_system_appearance(cx);
crate::icon_theme::clear_caches();
crate::image_cache::clear_for_pack_change(cx);
crate::settings::prewarm_icon_pack(cx);