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.
Rust archive-managerdesktop-appdual-paneexplorer-alternativefile-browserfile-explorerfile-managerfluent-designgpu-acceleratedgpuimacosmicaproductivityquick-lookrustrust-guitabswindowswindows-11windows-explorer
Allow HyperGlass popups and overlays on Windows 10
jokwa1356e9367b7a7cb
diff --git a/crates/rf-app/src/ferry.rs b/crates/rf-app/src/ferry.rsindex 665bde70..94cb05e4 100644--- a/crates/rf-app/src/ferry.rs+++ b/crates/rf-app/src/ferry.rs@@ -651,13 +651,13 @@ fn open_window(cx: &mut App) {is_minimizable: false,// the app's own popup look: on HyperGlass when that is the backdrop (as the quick search), else Windows' acrylic; the popup// menus' material when one is chosen (issue 380)- window_background: match cx.global::<Settings>().menu_material.for_panel(glassy(cx), false, crate::settings::materials_available()) {+ window_background: match cx.global::<Settings>().menu_material.for_panel(glassy(cx), false, crate::settings::materials_available(), crate::settings::glass_available()) {Some((_, bg, _)) => bg,None => crate::theme::popup_material(glassy(cx)),},..Default::default()};- let glass = match cx.global::<Settings>().menu_material.for_panel(glassy(cx), false, crate::settings::materials_available()) {+ let glass = match cx.global::<Settings>().menu_material.for_panel(glassy(cx), false, crate::settings::materials_available(), crate::settings::glass_available()) {Some((liquid, _, _)) => liquid,None => glassy(cx),};@@ -671,9 +671,9 @@ fn open_window(cx: &mut App) {}}-/// HyperGlass is the app's backdrop (and this Windows has the materials it is drawn with).+/// HyperGlass is the app's backdrop (and this Windows supports HyperGlass).fn glassy(cx: &App) -> bool {- crate::settings::materials_available() && cx.try_global::<Settings>().is_some_and(|s| s.backdrop_in_use() == crate::settings::BackdropPref::Glass)+ crate::settings::glass_available() && cx.try_global::<Settings>().is_some_and(|s| s.backdrop_in_use() == crate::settings::BackdropPref::Glass)}struct QuestionView {@@ -711,7 +711,7 @@ impl Render for QuestionView {let (qn, qy, qx) = (q.clone(), q.clone(), q);// over glass a wash, or the plain fill until the glass runs (never a see-through window with nothing behind it)// (a solid popup material: the window is opaque, so the panel paints its own card)- let opaque = cx.global::<Settings>().menu_material.for_panel(false, false, crate::settings::materials_available()).is_some_and(|(_, _, o)| o);+ let opaque = cx.global::<Settings>().menu_material.for_panel(false, false, crate::settings::materials_available(), crate::settings::glass_available()).is_some_and(|(_, _, o)| o);let fill = if opaque { Some(p.card_bg) } else { self.glass.as_ref().map(|g| crate::glass_watch::panel_fill(p.dark, g.fallback())).or_else(|| crate::theme::popup_fill(&p)) };let content = v_flex().w_full()diff --git a/crates/rf-app/src/fluent_menu.rs b/crates/rf-app/src/fluent_menu.rsindex ea2e2448..f4bbb260 100644--- a/crates/rf-app/src/fluent_menu.rs+++ b/crates/rf-app/src/fluent_menu.rs@@ -319,7 +319,7 @@ pub fn show_context_original_icons(menu: Menu, pos: Point<Pixels>, window: &mut/// Desktop menus match the Dock's glass in Automatic mode, even when their own window has no glass.pub fn show_on_glass(menu: Menu, pos: Point<Pixels>, window: &mut Window, cx: &mut App) -> Entity<MenuView> {- show_ex(menu, pos, Some(crate::settings::materials_available()), false, false, None, window, cx)+ show_ex(menu, pos, Some(crate::settings::glass_available()), false, false, None, window, cx)}fn show_ex(@@ -337,7 +337,7 @@ fn show_ex(}let material = cx.global::<crate::settings::Settings>().menu_material;let auto_liquid = auto_liquid.unwrap_or_else(|| crate::glass::liquid(crate::look::window::hwnd_of(window)));- let (liquid, background) = material.resolve(auto_liquid, explorer_context, crate::settings::materials_available());+ let (liquid, background) = material.resolve(auto_liquid, explorer_context, crate::settings::materials_available(), crate::settings::glass_available());let restore = window.focused(cx);let main = window.window_handle();let view = cx.new(|cx| MenuView {diff --git a/crates/rf-app/src/flyout.rs b/crates/rf-app/src/flyout.rsindex 2cc24699..a857ac06 100644--- a/crates/rf-app/src/flyout.rs+++ b/crates/rf-app/src/flyout.rs@@ -74,7 +74,7 @@ pub fn toggle(key: &'static str, pos: Point<Pixels>, width: f32, body: Body, exp// Settings › Appearance › the popup menus' material, when it is not Automatic: this flyout follows it as the menus do (issue// 380); an opaque one is drawn as the Explorer look's cardlet material = cx.global::<crate::settings::Settings>().menu_material;- let chosen = material.for_panel(crate::glass::liquid(crate::look::window::hwnd_of(owner)), explorer_style, crate::settings::materials_available());+ let chosen = material.for_panel(crate::glass::liquid(crate::look::window::hwnd_of(owner)), explorer_style, crate::settings::materials_available(), crate::settings::glass_available());let (liquid, explorer_style, backdrop) = match chosen {Some((liquid, bg, opaque)) => (liquid, opaque, bg),None => (liquid, explorer_style, if explorer_style { WindowBackgroundAppearance::Opaque } else { crate::theme::popup_material(liquid) }),diff --git a/crates/rf-app/src/prompt.rs b/crates/rf-app/src/prompt.rsindex ffdd8b25..10fecb5a 100644--- a/crates/rf-app/src/prompt.rs+++ b/crates/rf-app/src/prompt.rs@@ -208,7 +208,7 @@ fn show_inner(// on HyperGlass the dialog is a window of its own on the same glass: a dialog drawn inside the window can// only be a plain card over itlet owner_hwnd = crate::look::window::hwnd_of(window);- if crate::settings::materials_available() && crate::glass::shown(owner_hwnd) {+ if crate::settings::glass_available() && crate::glass::shown(owner_hwnd) {show_windowed(parts, restore, owner_hwnd, window, cx);return;}diff --git a/crates/rf-app/src/quick_search.rs b/crates/rf-app/src/quick_search.rsindex 18586651..8db08ab0 100644--- a/crates/rf-app/src/quick_search.rs+++ b/crates/rf-app/src/quick_search.rs@@ -1003,8 +1003,7 @@ pub fn toggle(cx: &mut App) {// automated UI tests: shown without taking the foreground from the userlet test = std::env::var_os("RUSTYFILES_QUICK_SEARCH_NOACTIVATE").is_some();// with HyperGlass as the app's backdrop the search is on the same glass; else Windows' acrylic as before- // (not on a Windows without materials: there only the main window takes HyperGlass, issue 78)- let glassy = crate::settings::materials_available()+ let glassy = crate::settings::glass_available()&& cx.try_global::<Settings>().is_some_and(|s| s.backdrop_in_use() == crate::settings::BackdropPref::Glass);let opts = WindowOptions {window_bounds: Some(WindowBounds::Windowed(Bounds::new(origin, size(px(WIDTH), px(64.))))),diff --git a/crates/rf-app/src/select_box.rs b/crates/rf-app/src/select_box.rsindex e13df0e6..84205188 100644--- a/crates/rf-app/src/select_box.rs+++ b/crates/rf-app/src/select_box.rs@@ -154,7 +154,7 @@ fn open(key: SharedString, field: Bounds<Pixels>, choices: Vec<Choice>, window:let search = choices.len() > SEARCH_FROM;let material = cx.global::<crate::settings::Settings>().menu_material;let auto_liquid = crate::glass::liquid(crate::look::window::hwnd_of(window));- let (liquid, background) = material.resolve(auto_liquid, false, crate::settings::materials_available());+ let (liquid, background) = material.resolve(auto_liquid, false, crate::settings::materials_available(), crate::settings::glass_available());let m = liquid::metrics(liquid);// wide enough for the longest label (estimated: the popup is sized before it is drawn); the leading tick column adds its widthlet longest = choices.iter().map(|c| c.label.chars().count()).max().unwrap_or(0) as f32;diff --git a/crates/rf-app/src/settings.rs b/crates/rf-app/src/settings.rsindex 558f736a..89b07786 100644--- a/crates/rf-app/src/settings.rs+++ b/crates/rf-app/src/settings.rs@@ -264,16 +264,16 @@ impl MenuMaterial {/// For the popups that are not menus (the View flyout, the Status Center: issue 380, they did not follow the setting): what a/// popup that would draw `auto_liquid` glass, and an opaque card in the Explorer look (`explorer`), gets with this material./// Automatic keeps each one as it was (`None`); another choice gives (glass, backdrop, opaque card).- pub fn for_panel(self, auto_liquid: bool, explorer: bool, materials: bool) -> Option<(bool, WindowBackgroundAppearance, bool)> {+ pub fn for_panel(self, auto_liquid: bool, explorer: bool, materials: bool, glass: bool) -> Option<(bool, WindowBackgroundAppearance, bool)> {if self == Self::Automatic {return None;}- let (liquid, bg) = self.resolve(auto_liquid, explorer, materials);+ let (liquid, bg) = self.resolve(auto_liquid, explorer, materials, glass);Some((liquid, bg, bg == WindowBackgroundAppearance::Opaque))}/// Whether to draw HyperGlass and what backdrop the popup requests before OS fallback.- pub fn resolve(self, auto_liquid: bool, auto_opaque: bool, materials: bool) -> (bool, WindowBackgroundAppearance) {+ pub fn resolve(self, auto_liquid: bool, auto_opaque: bool, materials: bool, glass: bool) -> (bool, WindowBackgroundAppearance) {use WindowBackgroundAppearance::{Blurred, MicaAltBackdrop, MicaBackdrop, Opaque, Transparent};match self {Self::Automatic if auto_opaque => (false, Opaque),@@ -283,7 +283,7 @@ impl MenuMaterial {Self::Mica if materials => (false, MicaBackdrop),Self::MicaAlt if materials => (false, MicaAltBackdrop),Self::Acrylic if materials => (false, Blurred),- Self::Glass if materials => (true, Transparent),+ Self::Glass if glass => (true, Transparent),_ => (false, Opaque),}}@@ -2441,15 +2441,17 @@ mod lenient_tests {use super::MenuMaterial::{Automatic, Glass, Mica, Solid};use super::WindowBackgroundAppearance::{Blurred, MicaBackdrop, Opaque, Transparent};- assert_eq!(Automatic.resolve(false, false, true), (false, Blurred));- assert_eq!(Automatic.resolve(true, false, true), (true, Transparent));- assert_eq!(Automatic.resolve(true, true, true), (false, Opaque));- assert_eq!(Automatic.resolve(false, true, false), (false, Opaque));- assert_eq!(Automatic.resolve(false, false, false), (false, Blurred));- assert_eq!(Mica.resolve(true, true, true), (false, MicaBackdrop));- assert_eq!(Solid.resolve(true, false, true), (false, Opaque));- assert_eq!(Glass.resolve(false, true, true), (true, Transparent));- assert_eq!(Glass.resolve(true, false, false), (false, Opaque));+ assert_eq!(Automatic.resolve(false, false, true, true), (false, Blurred));+ assert_eq!(Automatic.resolve(true, false, true, true), (true, Transparent));+ assert_eq!(Automatic.resolve(true, true, true, true), (false, Opaque));+ assert_eq!(Automatic.resolve(false, true, false, true), (false, Opaque));+ assert_eq!(Automatic.resolve(false, false, false, true), (false, Blurred));+ assert_eq!(Mica.resolve(true, true, true, true), (false, MicaBackdrop));+ assert_eq!(Mica.resolve(true, true, false, true), (false, Opaque));+ assert_eq!(Solid.resolve(true, false, true, true), (false, Opaque));+ assert_eq!(Glass.resolve(false, true, true, true), (true, Transparent));+ assert_eq!(Glass.resolve(false, true, false, true), (true, Transparent));+ assert_eq!(Glass.resolve(true, false, false, false), (false, Opaque));}#[test]diff --git a/crates/rf-app/src/status_center.rs b/crates/rf-app/src/status_center.rsindex 905a593f..066791cc 100644--- a/crates/rf-app/src/status_center.rs+++ b/crates/rf-app/src/status_center.rs@@ -2281,7 +2281,7 @@ fn open_popup(ops: &Entity<Ops>, owner: AnyWindowHandle, cx: &mut App) -> Option// the popup menus' material when it is not Automatic, as the menus have it (issue 380); an opaque one draws the cardlet material = cx.global::<crate::settings::Settings>().menu_material;// on HyperGlass the panel is on the same glass as the menus (it was Acrylic there)- let (liquid, bg) = material.resolve(crate::glass::liquid(owner_hwnd), explorer_style, crate::settings::materials_available());+ let (liquid, bg) = material.resolve(crate::glass::liquid(owner_hwnd), explorer_style, crate::settings::materials_available(), crate::settings::glass_available());let explorer_style = bg == WindowBackgroundAppearance::Opaque;let backdrop = if bg == WindowBackgroundAppearance::Blurred { crate::theme::window_material(bg) } else { bg };let top = theme::titlebar_h() + px(theme::address_row_h(false) - 4.);