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.

Allow Dock and popup HyperGlass on Windows 10

jokwa135a98126c124dc
diff --git a/crates/rf-app/src/dock/backdrop.rs b/crates/rf-app/src/dock/backdrop.rs
index 89b04c03..d86a1087 100644
--- a/crates/rf-app/src/dock/backdrop.rs
+++ b/crates/rf-app/src/dock/backdrop.rs
@@ -210,10 +210,11 @@ impl IslandGlass {
}
fn attach(&mut self, now_ms: u64) {
- // No glass on a Windows without materials (before Windows 11 22H2, `settings::materials_available`): the island paints its own
- // fill, opaque there (`look::fallback_fill`). On Windows 10 the glass has to read the screen by Desktop Duplication, and the
- // first report from there (issue 26) was islands that went black now and then; the windows and menus are plain there already.
- if self.hwnd == 0 || !crate::settings::materials_available() {
+ // HyperGlass draws itself via DirectComposition + Desktop Duplication on Windows 10 rather than Windows 11's
+ // `DWMWA_SYSTEMBACKDROP_TYPE` (`settings::materials_available`), so gate it on `glass_available` instead.
+ // Users who prefer a solid dock still have Settings > Dock > "Solid background" (`look::plain`), and any
+ // capture failure falls back to `look::fallback_fill` via `Machine`.
+ if self.hwnd == 0 || !crate::settings::glass_available() {
self.machine.attach_failed(now_ms);
return;
}
diff --git a/crates/rf-app/src/dock/look.rs b/crates/rf-app/src/dock/look.rs
index bf42718c..4f4569a5 100644
--- a/crates/rf-app/src/dock/look.rs
+++ b/crates/rf-app/src/dock/look.rs
@@ -149,9 +149,9 @@ pub fn set_plain(on: bool) {
/// The island's own fill, painted only while the glass is not running (starting, failed): dark 0x1C1C1E at 72 %, light 0xF5F5F7 at
/// 78 %, so the dock is never invisible.
pub fn fallback_fill(dark: bool) -> Tint {
- // (on a Windows without materials this fill is the island's look for good, and it is opaque there: `dock/backdrop.rs`; so it is
- // with the "solid background" switch)
- let plain = !crate::settings::materials_available() || plain();
+ // (when glass is turned off via `RUSTYFILES_NO_BACKDROP` or the "solid background" switch this fill is the island's look for good,
+ // so make it opaque)
+ let plain = !crate::settings::glass_available() || plain();
if dark { Tint::new(0x1C1C1E, if plain { 1.0 } else { 0.72 }) } else { Tint::new(0xF5F5F7, if plain { 1.0 } else { 0.78 }) }
}
diff --git a/crates/rf-app/src/glass_watch.rs b/crates/rf-app/src/glass_watch.rs
index 03e6a2e1..b3597e4e 100644
--- a/crates/rf-app/src/glass_watch.rs
+++ b/crates/rf-app/src/glass_watch.rs
@@ -108,8 +108,8 @@ pub fn panel_fill(dark: bool, fallback: bool) -> gpui_kit::Hsla {
(false, false) => (0xFFFFFF, 0.45),
};
let mut c: gpui_kit::Hsla = gpui_kit::rgb(rgb).into();
- // where Windows has no materials the plain panel is all there ever is, with nothing blurred behind it: opaque, so that it reads
- c.a = if fallback && !crate::settings::materials_available() { 1.0 } else { a };
+ // when glass is disabled via `RUSTYFILES_NO_BACKDROP` the plain panel is all there ever is: opaque, so that it reads
+ c.a = if fallback && !crate::settings::glass_available() { 1.0 } else { a };
c
}
@@ -206,8 +206,8 @@ impl PopupGlass {
fn start_with_options(hwnd: isize, dark: bool, round: bool, shaped: Option<rf_win::glass::GlassOptions>) -> PopupGlass {
let mut g = PopupGlass { hwnd, machine: Machine::default(), started: Instant::now(), attached: false, gave_up: false };
- // (no glass at all on a Windows without materials: the popup is its plain fill, see `dock/backdrop.rs`)
- if hwnd == 0 || !crate::settings::materials_available() {
+ // (respect `RUSTYFILES_NO_BACKDROP` without tying HyperGlass to Windows 11's `DWMWA_SYSTEMBACKDROP_TYPE`, see `dock/backdrop.rs`)
+ if hwnd == 0 || !crate::settings::glass_available() {
g.machine.attach_failed(0);
g.gave_up = true;
return g;
diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rs
index 63b36756..558f736a 100644
--- a/crates/rf-app/src/settings.rs
+++ b/crates/rf-app/src/settings.rs
@@ -1759,6 +1759,20 @@ pub fn materials_available() -> bool {
*V.get_or_init(|| std::env::var_os("RUSTYFILES_NO_BACKDROP").is_none() && rf_win::osver::system_backdrops())
}
+/// Whether rustyfiles's own HyperGlass (D3D11 + DirectComposition) may attach to the dock and glass popups.
+/// Unlike Windows's Mica and Acrylic (`materials_available`, Windows 11 22H2+), HyperGlass does not use
+/// `DWMWA_SYSTEMBACKDROP_TYPE` and runs on Windows 10 via Desktop Duplication (as the main window already
+/// does, issue 78). `RUSTYFILES_NO_BACKDROP=1` still turns it off for testing the plain fallback.
+pub fn glass_available() -> bool {
+ static V: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
+ *V.get_or_init(|| glass_available_for(std::env::var_os("RUSTYFILES_NO_BACKDROP").is_some()))
+}
+
+/// Pure check behind [`glass_available`].
+fn glass_available_for(no_backdrop_env: bool) -> bool {
+ !no_backdrop_env
+}
+
/// How strongly the app's own washes lie over the glass, 0..=100 (Settings > HyperGlass > Surface wash).
pub fn hg_surface() -> u8 {
HG_SURFACE.load(Ordering::Relaxed)
@@ -2815,4 +2829,10 @@ dock_own_notifications = 3
assert!(!parsed.ctrl_number_tabs);
assert!(!parsed.ctrl_9_last_tab);
}
+
+ #[test]
+ fn glass_availability_only_depends_on_the_no_backdrop_override() {
+ assert!(super::glass_available_for(false));
+ assert!(!super::glass_available_for(true));
+ }
}