Skip to content

Local, full Windows search replacement, clipboard manager, and launcher: files, apps, settings and semantic media search with Google's EmbeddingGemma 2.

Refresh seamless glass windows and dictation chime (#14)

ampersandruaf56ddac426f
diff --git a/Build-Rust.ps1 b/Build-Rust.ps1
index 4b556a5..7daaade 100644
--- a/Build-Rust.ps1
+++ b/Build-Rust.ps1
@@ -82,8 +82,8 @@ if (Test-Path $taskPortable) { throw 'Portable staging directory already exists.
New-Item -ItemType Directory -Force $taskPortable | Out-Null
Get-ChildItem -LiteralPath $taskBundle | Copy-Item -Destination $taskPortable -Recurse -Force
Set-Content -LiteralPath (Join-Path $taskPortable 'portable.flag') -Value '' -Encoding ascii
-Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.20-x64.zip' -Force
-$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.20-x64.exe'
-$taskZip='dist/installer/VectorDash-Rust-0.3.20-x64.zip'
+Compress-Archive -Path (Join-Path $taskPortable '*') -DestinationPath 'dist/installer/VectorDash-Rust-0.3.22-x64.zip' -Force
+$taskInstaller='dist/installer/VectorDash-Rust-Setup-0.3.22-x64.exe'
+$taskZip='dist/installer/VectorDash-Rust-0.3.22-x64.zip'
@($taskInstaller,$taskZip) | ForEach-Object {((Get-FileHash -LiteralPath $_ -Algorithm SHA256).Hash.ToLowerInvariant()+' '+(Split-Path $_ -Leaf))} | Set-Content 'dist/installer/RUST-SHA256SUMS.txt' -Encoding ascii
Write-Output "Native installer and portable ZIP ready."
diff --git a/native/Cargo.lock b/native/Cargo.lock
index 78003ba..75ff813 100644
--- a/native/Cargo.lock
+++ b/native/Cargo.lock
@@ -5716,7 +5716,7 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"
[[package]]
name = "vectordash"
-version = "0.3.20"
+version = "0.3.22"
dependencies = [
"anyhow",
"arboard",
@@ -5756,6 +5756,7 @@ dependencies = [
"ureq",
"walkdir",
"windows 0.61.3",
+ "windows-numerics 0.2.0",
"xcap",
"zip",
]
diff --git a/native/Cargo.toml b/native/Cargo.toml
index 419e874..141c85e 100644
--- a/native/Cargo.toml
+++ b/native/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "vectordash"
-version = "0.3.20"
+version = "0.3.22"
edition = "2024"
license = "MIT"
[dependencies]
@@ -45,7 +45,8 @@ zip = { version = "4", default-features = false, features = ["deflate"] }
[build-dependencies]
embed-resource = "3"
[target.'cfg(windows)'.dependencies]
-windows = { version = "0.61", features = ["Win32_Foundation", "Win32_Media_Audio", "Win32_Security", "Win32_Security_Cryptography", "Win32_System_Memory", "Win32_System_LibraryLoader", "Win32_System_Threading", "Win32_System_Diagnostics_ToolHelp", "Win32_System_JobObjects", "Win32_System_Com", "Win32_System_Ole", "Win32_System_Variant", "Win32_System_Registry", "Win32_UI_WindowsAndMessaging", "Win32_UI_Controls", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_Shell_Common", "Win32_UI_Accessibility", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_Ioctl", "Win32_System_Performance", "Win32_System_Power", "Win32_System_ProcessStatus", "Win32_System_DataExchange", "Win32_System_SystemInformation", "Win32_Graphics_Gdi", "Win32_Graphics_Dwm", "Win32_Security_Authorization", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }
+windows-numerics = "0.2"
+windows = { version = "0.61", features = ["UI_Composition", "UI_Composition_Desktop", "System", "Win32_System_WinRT", "Win32_System_WinRT_Composition", "Win32_Foundation", "Win32_Media_Audio", "Win32_Security", "Win32_Security_Cryptography", "Win32_System_Memory", "Win32_System_LibraryLoader", "Win32_System_Threading", "Win32_System_Diagnostics_ToolHelp", "Win32_System_JobObjects", "Win32_System_Com", "Win32_System_Ole", "Win32_System_Variant", "Win32_System_Registry", "Win32_UI_WindowsAndMessaging", "Win32_UI_Controls", "Win32_UI_Input_KeyboardAndMouse", "Win32_UI_Shell", "Win32_UI_Shell_Common", "Win32_UI_Accessibility", "Win32_Storage_FileSystem", "Win32_System_IO", "Win32_System_Ioctl", "Win32_System_Performance", "Win32_System_Power", "Win32_System_ProcessStatus", "Win32_System_DataExchange", "Win32_System_SystemInformation", "Win32_Graphics_Gdi", "Win32_Graphics_Dwm", "Win32_Security_Authorization", "Win32_NetworkManagement_IpHelper", "Win32_NetworkManagement_Ndis", "Win32_Networking_WinSock"] }
[dev-dependencies]
[profile.release]
lto = "thin"
diff --git a/native/src/app.rs b/native/src/app.rs
index 2a46767..3f80bca 100644
--- a/native/src/app.rs
+++ b/native/src/app.rs
@@ -1791,7 +1791,7 @@ impl App {
fn titlebar(&mut self, ctx: &egui::Context) {
use crate::icons::{self, Icon};
egui::TopBottomPanel::top("title")
- .frame(egui::Frame::NONE.inner_margin(egui::Margin::symmetric(20, 12)))
+ .frame(egui::Frame::NONE.inner_margin(egui::Margin::symmetric(20, 7)))
.show(ctx, |ui| {
ui.horizontal(|ui| {
ui.add(egui::Image::new(&self.logo).fit_to_exact_size(egui::vec2(28.0, 28.0)));
@@ -1941,10 +1941,8 @@ impl App {
query.clear();
}
ui.horizontal(|ui| {
- let drag = ui.add(
- crate::icons::image(crate::icons::Icon::Search, self.accent(), 26.0)
- .sense(egui::Sense::drag()),
- );
+ let (search_icon_rect, drag) =
+ ui.allocate_exact_size(egui::vec2(26.0, 42.0), egui::Sense::drag());
if self.quick {
crate::platform::add_drag_region(
[
@@ -1981,6 +1979,8 @@ impl App {
42.0,
],
egui::TextEdit::singleline(&mut query)
+ .frame(false)
+ .background_color(Color32::TRANSPARENT)
.margin(egui::Margin {
right: if self.tool == "Search" { 92 } else { 8 },
..egui::Margin::symmetric(8, 8)
@@ -2005,6 +2005,13 @@ impl App {
.font(egui::TextStyle::Heading)
.id(egui::Id::new("query")),
);
+ crate::icons::image(crate::icons::Icon::Search, self.accent(), 26.0).paint_at(
+ ui,
+ egui::Rect::from_center_size(
+ egui::pos2(search_icon_rect.center().x, response.rect.center().y),
+ egui::vec2(26.0, 26.0),
+ ),
+ );
if recording {
self.paint_waveform(ui, response.rect);
}
@@ -2123,6 +2130,26 @@ impl App {
self.toggle_dictation();
}
});
+ // Span the entire search pane, including its padding, like the reference.
+ let edge = if self.quick {
+ ctx.content_rect().left()
+ } else {
+ ui.max_rect().left() - 20.0
+ };
+ let y = ui.cursor().min.y - 4.0;
+ ui.painter().with_clip_rect(ctx.content_rect()).hline(
+ edge..=ctx.content_rect().right(),
+ y,
+ egui::Stroke::new(
+ 1.0,
+ if ui.visuals().dark_mode {
+ Color32::from_white_alpha(38)
+ } else {
+ Color32::from_black_alpha(35)
+ },
+ ),
+ );
+ ui.add_space(4.0);
let old = (
self.mode.clone(),
self.category.clone(),
@@ -2376,7 +2403,7 @@ impl App {
}
self.model_search_panel(ui);
if self.quick
- && self.query.is_empty()
+ && self.hits.is_empty()
&& ctx.animate_bool_with_time(egui::Id::new("popup-expansion"), false, 0.18) <= 0.0
{
return;
@@ -2482,11 +2509,21 @@ impl App {
} else {
Color32::TRANSPARENT
};
- ui.painter().rect_filled(rect, 9.0, fill);
+ ui.painter().rect_filled(
+ rect,
+ 14.0,
+ if selected || response.hovered() {
+ fill
+ } else if dark {
+ Color32::from_white_alpha(8)
+ } else {
+ Color32::from_white_alpha(75)
+ },
+ );
if selected {
ui.painter().rect_stroke(
rect,
- 9.0,
+ 14.0,
egui::Stroke::new(1.0, accent.gamma_multiply(0.7)),
egui::StrokeKind::Inside,
);
@@ -2692,14 +2729,16 @@ impl App {
}
if let Some((path, texture)) = &self.texture {
if path == &hit.path {
- let image = egui::Image::new(texture).max_size(egui::vec2(
- ui.available_width(),
- if self.large_preview {
- (ui.available_height() - 105.0).max(80.0)
- } else {
- ui.available_height() * 0.65
- },
- ));
+ let image = egui::Image::new(texture)
+ .corner_radius(14)
+ .max_size(egui::vec2(
+ ui.available_width(),
+ if self.large_preview {
+ (ui.available_height() - 105.0).max(80.0)
+ } else {
+ ui.available_height() * 0.65
+ },
+ ));
ui.add(if hit.kind == "application" {
image.fit_to_exact_size(egui::vec2(
if self.large_preview { 192.0 } else { 72.0 },
@@ -3792,15 +3831,14 @@ impl App {
egui::Grid::new("keyboard-shortcuts").num_columns(2).spacing([18.0,10.0]).show(ui,|ui|{
ui.label("Global Search");
if ui.button(if self.hotkey_capture{"Press shortcut…"}else{&self.s.hotkey}).clicked(){self.hotkey_capture=true;}ui.end_row();
+ ui.label("Cycle Search / Clipboard / AI");
+ if ui.button(if self.llm_hotkey_capture{"Press shortcut…"}else{&self.s.llm_hotkey}).clicked(){self.llm_hotkey_capture=true;}ui.end_row();
ui.label("Cycle file types");
if ui.button(if self.type_hotkey_capture{"Press shortcut…"}else{&self.s.type_hotkey}).clicked(){self.type_hotkey_capture=true;}ui.end_row();
ui.label("Dictate");
if ui.button(if self.global_voice_capture{"Press shortcut…"}else{&self.s.voice_search_hotkey}).clicked(){self.global_voice_capture=true;}ui.end_row();
});
ui.weak("Click a shortcut, then press the keys to assign it. Dictate opens quick search or records in the current search.");
- ui.collapsing("Additional shortcuts",|ui|{
- ui.horizontal(|ui|{ui.label("Cycle Search / Clipboard / AI");if ui.button(if self.llm_hotkey_capture{"Press shortcut…"}else{&self.s.llm_hotkey}).clicked(){self.llm_hotkey_capture=true;}});
- });
});
if !self.microphones_loaded && !self.microphones_busy {
@@ -3908,21 +3946,21 @@ impl App {
ui.color_edit_button_srgb(&mut self.s.accent);
});
ui.horizontal(|ui| {
- ui.label("Popup color tone");
+ ui.label("Window color tone");
ui.color_edit_button_srgb(&mut self.s.popup_tone);
});
let mut transparency = (1.0 - self.s.popup_opacity) * 100.0;
if ui
- .add(egui::Slider::new(&mut transparency, 0.0..=90.0).text("Popup transparency (%)"))
+ .add(egui::Slider::new(&mut transparency, 0.0..=90.0).text("Window transparency (%)"))
.changed()
{
self.s.popup_opacity = 1.0 - transparency / 100.0;
}
ui.add(
egui::Slider::new(&mut self.s.popup_gradient, 0.0..=1.0)
- .text("Popup gradient strength"),
+ .text("Window gradient strength"),
);
- ui.label("Higher transparency reveals more of the blurred desktop. Appearance changes preview immediately; click Save to keep them.");
+ ui.label("Applies to both windows. Higher transparency reveals more of the blurred desktop. Appearance changes preview immediately; click Save to keep them.");
if ui.button("Reset appearance").clicked() {
self.s.accent = [133, 115, 255];
self.s.popup_tone = [138, 115, 168];
@@ -4609,6 +4647,7 @@ impl App {
if let Some(texture) = &self.clipboard_texture {
ui.add(
egui::Image::new(texture)
+ .corner_radius(14)
.max_size(egui::vec2(ui.available_width(), height - 35.0)),
);
} else {
@@ -5406,7 +5445,7 @@ impl eframe::App for App {
if let raw_window_handle::RawWindowHandle::Win32(win) = handle.as_raw() {
crate::platform::clip_window(
win.hwnd.get(),
- 16.0 * ctx.pixels_per_point(),
+ crate::appearance::WINDOW_RADIUS * ctx.pixels_per_point(),
material_changed,
);
}
@@ -5931,7 +5970,15 @@ impl eframe::App for App {
.store(false, Ordering::Release);
ctx.send_viewport_cmd(egui::ViewportCommand::Visible(false));
}
- let empty = self.query.is_empty() && self.tool == "Search";
+ let empty = match self.tool.as_str() {
+ "Search" => self.hits.is_empty(),
+ "AI" => {
+ self.ai_messages.is_empty()
+ && self.ai_answer.is_empty()
+ && self.ai_error.is_none()
+ }
+ _ => false,
+ };
let expansion =
ctx.animate_bool_with_time(egui::Id::new("popup-expansion"), !empty, 0.18);
let panel = self.tool == "Search"
@@ -5949,11 +5996,11 @@ impl eframe::App for App {
self.popup_model_panel = panel;
self.popup_size_state = Some(empty);
ctx.send_viewport_cmd(egui::ViewportCommand::MinInnerSize(egui::vec2(
- 780.0, 200.0,
+ 780.0, 160.0,
)));
ctx.send_viewport_cmd(egui::ViewportCommand::InnerSize(egui::vec2(
940.0,
- 270.0 + 370.0 * expansion + if panel { 75.0 } else { 0.0 },
+ 180.0 + 460.0 * expansion + if panel { 75.0 } else { 0.0 },
)));
}
} else {
@@ -5996,7 +6043,11 @@ impl eframe::App for App {
});
}
egui::CentralPanel::default()
- .frame(egui::Frame::NONE.inner_margin(20.0))
+ .frame(egui::Frame::NONE.inner_margin(if self.quick {
+ egui::Margin::symmetric(20, 9)
+ } else {
+ egui::Margin::same(20)
+ }))
.show(ctx, |ui| {
if self.page == 0 {
self.search_ui(ui, ctx);
diff --git a/native/src/appearance.rs b/native/src/appearance.rs
index c5099b1..4718219 100644
--- a/native/src/appearance.rs
+++ b/native/src/appearance.rs
@@ -1,5 +1,7 @@
use crate::config::Settings;
use eframe::egui::{self, Color32, FontId, TextStyle};
+/// Matches the reference glass-card radius in logical pixels.
+pub const WINDOW_RADIUS: f32 = 28.0;
pub fn dark(ctx: &egui::Context, s: &Settings) -> bool {
match s.theme.as_str() {
"Light" => false,
@@ -26,25 +28,26 @@ pub fn apply(ctx: &egui::Context, s: &Settings) {
} else {
Color32::from_rgb(32, 29, 51)
});
+ // Glass uses the compositor/aurora underneath; opaque controls would flatten it.
style.visuals.panel_fill = if is_dark {
- Color32::from_rgb(19, 20, 29)
+ Color32::from_rgb(15, 18, 32)
} else {
- Color32::from_rgb(247, 246, 252)
+ Color32::from_rgb(241, 243, 251)
};
style.visuals.window_fill = if is_dark {
- Color32::from_rgb(26, 26, 38)
+ Color32::from_rgb(25, 29, 46)
} else {
- Color32::from_rgb(250, 249, 255)
+ Color32::from_rgb(248, 250, 255)
};
style.visuals.extreme_bg_color = if is_dark {
- Color32::from_rgb(24, 23, 36)
+ Color32::from_rgba_unmultiplied(5, 9, 21, 170)
} else {
- Color32::from_rgb(255, 254, 255)
+ Color32::from_rgba_unmultiplied(255, 255, 255, 195)
};
style.visuals.faint_bg_color = if is_dark {
- Color32::from_rgb(32, 31, 45)
+ Color32::from_white_alpha(13)
} else {
- Color32::from_rgb(236, 233, 250)
+ Color32::from_white_alpha(145)
};
style.visuals.selection.bg_fill = if is_dark {
Color32::from_rgb(s.accent[0] / 2, s.accent[1] / 2, s.accent[2] / 2)
@@ -58,7 +61,11 @@ pub fn apply(ctx: &egui::Context, s: &Settings) {
style.visuals.selection.stroke = egui::Stroke::new(1.0, accent);
style.visuals.widgets.inactive.bg_stroke = egui::Stroke::new(
1.0,
- accent.gamma_multiply(if is_dark { 0.55 } else { 0.65 }),
+ if is_dark {
+ Color32::from_white_alpha(42)
+ } else {
+ Color32::from_rgba_unmultiplied(62, 69, 102, 50)
+ },
);
style.visuals.widgets.active.bg_stroke = egui::Stroke::new(1.0, accent);
style.visuals.widgets.open.bg_stroke = egui::Stroke::new(1.0, accent);
@@ -84,15 +91,29 @@ pub fn apply(ctx: &egui::Context, s: &Settings) {
&mut style.visuals.widgets.active,
&mut style.visuals.widgets.open,
] {
- widget.corner_radius = egui::CornerRadius::same(9);
+ widget.corner_radius = egui::CornerRadius::same(14);
}
style.visuals.widgets.open.bg_fill = style.visuals.widgets.hovered.bg_fill;
style.visuals.widgets.open.weak_bg_fill = style.visuals.widgets.hovered.bg_fill;
- style.visuals.window_corner_radius = egui::CornerRadius::same(16);
- style.visuals.menu_corner_radius = egui::CornerRadius::same(9);
+ style.visuals.window_corner_radius = egui::CornerRadius::same(24);
+ style.visuals.window_shadow = egui::epaint::Shadow {
+ offset: [0, 12],
+ blur: 32,
+ spread: 0,
+ color: Color32::from_black_alpha(if is_dark { 90 } else { 30 }),
+ };
+ style.visuals.window_stroke = egui::Stroke::new(
+ 1.0,
+ if is_dark {
+ Color32::from_white_alpha(42)
+ } else {
+ Color32::from_white_alpha(220)
+ },
+ );
+ style.visuals.menu_corner_radius = egui::CornerRadius::same(14);
if is_dark {
- style.visuals.widgets.inactive.bg_fill = Color32::from_rgb(55, 48, 78);
- style.visuals.widgets.active.bg_fill = Color32::from_rgb(68, 57, 95);
+ style.visuals.widgets.inactive.bg_fill = Color32::from_white_alpha(16);
+ style.visuals.widgets.active.bg_fill = accent.gamma_multiply(0.32);
style.visuals.widgets.inactive.fg_stroke = egui::Stroke::new(2.0, accent);
style.visuals.slider_trailing_fill = true;
}
@@ -152,20 +173,36 @@ pub fn colors(s: &Settings, dark: bool) -> (Color32, Color32) {
Color32::from_rgba_unmultiplied(bottom[0], bottom[1], bottom[2], alpha),
)
}
+fn surface(s: &Settings, dark: bool, _quick: bool, p: egui::Pos2, rect: egui::Rect) -> Color32 {
+ let (top, bottom) = colors(s, dark);
+ let t = ((p.y - rect.top()) / rect.height().max(1.0)).clamp(0.0, 1.0);
+ let a = top.to_srgba_unmultiplied();
+ let b = bottom.to_srgba_unmultiplied();
+ let x = (p.x - rect.left()) / rect.width().max(1.0);
+ let glow = |cx: f32, cy: f32| (-((x - cx).powi(2) * 4.0 + (t - cy).powi(2) * 3.0)).exp();
+ let intensity = s.popup_gradient.clamp(0.0, 1.0);
+ let accent = [s.accent[0], s.accent[1], s.accent[2]];
+ let illumination =
+ glow(0.12, 0.08) * (0.08 + intensity * 0.22) + glow(0.95, 0.85) * (0.04 + intensity * 0.14);
+ let mut rgb = [0u8; 3];
+ for i in 0..3 {
+ let base = a[i] as f32 * (1.0 - t) + b[i] as f32 * t;
+ rgb[i] =
+ (base * (1.0 - illumination) + accent[i] as f32 * illumination).clamp(0.0, 255.0) as u8;
+ }
+ Color32::from_rgba_unmultiplied(rgb[0], rgb[1], rgb[2], a[3])
+}
pub fn background(ctx: &egui::Context, s: &Settings, quick: bool) {
let rect = ctx.content_rect();
let painter = ctx.layer_painter(egui::LayerId::background());
- let (top, bottom) = if quick {
- colors(s, dark(ctx, s))
+ // Paint and the native window region use the same radius, including DPI scaling.
+ let radius = if ctx.input(|i| i.viewport().maximized.unwrap_or(false)) {
+ 0.0
} else {
- let c = ctx.style().visuals.panel_fill;
- (c, c)
+ WINDOW_RADIUS.min(rect.height() * 0.5)
};
- // A rounded triangle fan supplies one alpha surface, rather than stacking opaque panels.
let center = rect.center();
let mut perimeter = vec![];
- // Popup content follows the native Windows acrylic corner radius.
- let radius = if quick { 8.0f32 } else { 16.0f32 }.min(rect.height() * 0.5);
for (corner, start) in [
(
rect.right_top() + egui::vec2(-radius, radius),
@@ -181,29 +218,59 @@ pub fn background(ctx: &egui::Context, s: &Settings, quick: bool) {
std::f32::consts::PI,
),
] {
- for n in 0..=10 {
- let a = start + n as f32 / 10.0 * std::f32::consts::FRAC_PI_2;
+ for n in 0..=32 {
+ let a = start + n as f32 / 32.0 * std::f32::consts::FRAC_PI_2;
perimeter.push(corner + egui::vec2(a.cos(), a.sin()) * radius);
}
}
- let mix = |y: f32| {
- let t = ((y - rect.top()) / rect.height()).clamp(0.0, 1.0);
- let a = top.to_array();
- let b = bottom.to_array();
- Color32::from_rgba_premultiplied(
- (a[0] as f32 * (1.0 - t) + b[0] as f32 * t) as u8,
- (a[1] as f32 * (1.0 - t) + b[1] as f32 * t) as u8,
- (a[2] as f32 * (1.0 - t) + b[2] as f32 * t) as u8,
- (a[3] as f32 * (1.0 - t) + b[3] as f32 * t) as u8,
- )
- };
+ // Concentric rings give soft spatial lighting on one alpha surface. Nothing is
+ // painted in the outer corners, avoiding a rectangular tint over acrylic.
+ let feather = 1.0 / ctx.pixels_per_point();
+ let inner_perimeter: Vec<_> = perimeter
+ .iter()
+ .map(|p| {
+ if radius == 0.0 {
+ return *p;
+ }
+ let nearest = egui::pos2(
+ p.x.clamp(rect.left() + radius, rect.right() - radius),
+ p.y.clamp(rect.top() + radius, rect.bottom() - radius),
+ );
+ *p - (*p - nearest).normalized() * feather
+ })
+ .collect();
let mut mesh = egui::Mesh::default();
- mesh.colored_vertex(center, mix(center.y));
- for p in &perimeter {
- mesh.colored_vertex(*p, mix(p.y));
+ mesh.colored_vertex(center, surface(s, dark(ctx, s), quick, center, rect));
+ for ring in 1..=8 {
+ for p in &inner_perimeter {
+ let point = center + (*p - center) * (ring as f32 / 8.0);
+ mesh.colored_vertex(point, surface(s, dark(ctx, s), quick, point, rect));
+ }
+ }
+ let count = perimeter.len() as u32;
+ for i in 0..count {
+ mesh.add_triangle(0, 1 + i, 1 + (i + 1) % count);
+ }
+ for ring in 0..7 {
+ let inner = 1 + ring * count;
+ let outer = inner + count;
+ for i in 0..count {
+ let next = (i + 1) % count;
+ mesh.add_triangle(inner + i, outer + i, outer + next);
+ mesh.add_triangle(inner + i, outer + next, inner + next);
+ }
}
- for i in 0..perimeter.len() {
- mesh.add_triangle(0, i as u32 + 1, ((i + 1) % perimeter.len()) as u32 + 1);
+ // A physical-pixel alpha fringe lets the compositor blend the curve rather
+ // than exposing the binary staircase of an HRGN window mask.
+ let outer = mesh.vertices.len() as u32;
+ for point in &perimeter {
+ mesh.colored_vertex(*point, Color32::TRANSPARENT);
+ }
+ let inner = 1 + 7 * count;
+ for i in 0..count {
+ let next = (i + 1) % count;
+ mesh.add_triangle(inner + i, outer + i, outer + next);
+ mesh.add_triangle(inner + i, outer + next, inner + next);
}
painter.add(egui::Shape::mesh(mesh));
painter.rect_stroke(
@@ -211,12 +278,11 @@ pub fn background(ctx: &egui::Context, s: &Settings, quick: bool) {
radius,
egui::Stroke::new(
1.0,
- Color32::from_rgba_unmultiplied(
- s.popup_tone[0],
- s.popup_tone[1],
- s.popup_tone[2],
- if quick { 42 } else { 30 },
- ),
+ if dark(ctx, s) {
+ Color32::from_white_alpha(46)
+ } else {
+ Color32::from_white_alpha(220)
+ },
),
egui::StrokeKind::Inside,
);
@@ -296,3 +362,43 @@ mod status_tests {
}
}
}
+
+#[cfg(test)]
+mod glass_tests {
+ use super::*;
+ #[test]
+ fn frosted_surfaces_preserve_theme_opacity_and_rounded_cards() {
+ let ctx = egui::Context::default();
+ for dark in [true, false] {
+ let s = Settings {
+ theme: if dark { "Dark".into() } else { "Light".into() },
+ ..Default::default()
+ };
+ apply(&ctx, &s);
+ let rect = egui::Rect::from_min_size(egui::Pos2::ZERO, egui::vec2(1000.0, 600.0));
+ let main = surface(&s, dark, false, rect.center(), rect);
+ assert_eq!(main, surface(&s, dark, true, rect.center(), rect));
+ assert_eq!(main.a(), (255.0 * s.popup_opacity) as u8);
+ let mut transparent = s.clone();
+ transparent.popup_opacity = 0.2;
+ assert!(
+ surface(&transparent, dark, true, rect.center(), rect).a()
+ < surface(&s, dark, true, rect.center(), rect).a()
+ );
+ assert!(surface(&transparent, dark, false, rect.center(), rect).a() < main.a());
+ let mut gradient = s.clone();
+ gradient.popup_gradient = 1.0;
+ assert_ne!(
+ surface(&gradient, dark, false, rect.left_top(), rect),
+ surface(&s, dark, false, rect.left_top(), rect)
+ );
+ assert_eq!(WINDOW_RADIUS, 28.0);
+ assert!(ctx.style().visuals.extreme_bg_color.a() < 255);
+ assert_eq!(
+ ctx.style().visuals.window_corner_radius,
+ egui::CornerRadius::same(24)
+ );
+ assert!(ctx.style().visuals.window_shadow.blur > 0);
+ }
+ }
+}
diff --git a/native/src/backdrop.rs b/native/src/backdrop.rs
new file mode 100644
index 0000000..4637c31
--- /dev/null
+++ b/native/src/backdrop.rs
@@ -0,0 +1,303 @@
+//! A compositor-owned, geometrically clipped host-backdrop. The host is input
+//! transparent and has no fill/frame: visually there is only the application's
+//! one glass sheet. No desktop images, polling thread or CPU blur is used.
+#[cfg(windows)]
+mod windows_impl {
+ use std::cell::{Cell, RefCell};
+ use windows::{
+ System::{DispatcherQueue, DispatcherQueueController},
+ UI::Composition::{
+ CompositionRoundedRectangleGeometry, Compositor, Desktop::DesktopWindowTarget,
+ SpriteVisual,
+ },
+ Win32::{
+ Foundation::*,
+ Graphics::{Dwm::*, Gdi::*},
+ System::{
+ LibraryLoader::GetModuleHandleW,
+ WinRT::{
+ Composition::ICompositorDesktopInterop, CreateDispatcherQueueController,
+ DQTAT_COM_STA, DQTYPE_THREAD_CURRENT, DispatcherQueueOptions,
+ },
+ },
+ UI::WindowsAndMessaging::*,
+ },
+ core::{Interface, w},
+ };
+ struct Glass {
+ hwnd: HWND,
+ owner: HWND,
+ _queue: Option<DispatcherQueueController>,
+ _compositor: Compositor,
+ _target: DesktopWindowTarget,
+ visual: SpriteVisual,
+ geometry: CompositionRoundedRectangleGeometry,
+ last: (i32, i32, i32, i32, u32),
+ }
+ impl Drop for Glass {
+ fn drop(&mut self) {
+ unsafe {
+ let _ = DestroyWindow(self.hwnd);
+ }
+ }
+ }
+ thread_local! {static FAILED:Cell<bool>=const{Cell::new(false)};}
+ thread_local! {static GLASS:RefCell<Option<Glass>>=const{RefCell::new(None)};}
+ unsafe extern "system" fn host_proc(hwnd: HWND, msg: u32, w: WPARAM, l: LPARAM) -> LRESULT {
+ if msg == WM_NCHITTEST {
+ return LRESULT(HTTRANSPARENT as isize);
+ }
+ if msg == WM_ERASEBKGND {
+ return LRESULT(1);
+ }
+ unsafe { DefWindowProcW(hwnd, msg, w, l) }
+ }
+ impl Glass {
+ fn new(owner: HWND) -> windows::core::Result<Self> {
+ unsafe {
+ let queue = if DispatcherQueue::GetForCurrentThread().is_err() {
+ Some(CreateDispatcherQueueController(DispatcherQueueOptions {
+ dwSize: std::mem::size_of::<DispatcherQueueOptions>() as u32,
+ threadType: DQTYPE_THREAD_CURRENT,
+ apartmentType: DQTAT_COM_STA,
+ })?)
+ } else {
+ None
+ };
+ let instance = HINSTANCE(GetModuleHandleW(None)?.0);
+ let class = w!("VectorDash.ClippedGlass");
+ let wc = WNDCLASSW {
+ lpfnWndProc: Some(host_proc),
+ hInstance: instance,
+ lpszClassName: class,
+ ..Default::default()
+ };
+ RegisterClassW(&wc);
+ let hwnd = CreateWindowExW(
+ WS_EX_TOOLWINDOW
+ | WS_EX_NOACTIVATE
+ | WS_EX_TRANSPARENT
+ | WS_EX_NOREDIRECTIONBITMAP,
+ class,
+ w!(""),
+ WS_POPUP,
+ 0,
+ 0,
+ 1,
+ 1,
+ None,
+ None,
+ Some(instance),
+ None,
+ )?;
+ let result = (|| {
+ // The blur host must not receive its own DWM border, shadow,
+ // system material or small-radius native corner surface.
+ let policy = DWMNCRP_DISABLED;
+ DwmSetWindowAttribute(
+ hwnd,
+ DWMWA_NCRENDERING_POLICY,
+ &policy as *const _ as _,
+ 4,
+ )?;
+ let corners = DWMWCP_DONOTROUND;
+ DwmSetWindowAttribute(
+ hwnd,
+ DWMWA_WINDOW_CORNER_PREFERENCE,
+ &corners as *const _ as _,
+ 4,
+ )?;
+ let border = 0xfffffffeu32;
+ DwmSetWindowAttribute(hwnd, DWMWA_BORDER_COLOR, &border as *const _ as _, 4)?;
+ let backdrop = DWMSBT_NONE;
+ DwmSetWindowAttribute(
+ hwnd,
+ DWMWA_SYSTEMBACKDROP_TYPE,
+ &backdrop as *const _ as _,
+ 4,
+ )?;
+ let yes = 1i32;
+ DwmSetWindowAttribute(
+ hwnd,
+ DWMWA_USE_HOSTBACKDROPBRUSH,
+ &yes as *const _ as _,
+ 4,
+ )?;
+ let compositor = Compositor::new()?;
+ let interop: ICompositorDesktopInterop = compositor.cast()?;
+ let target = interop.CreateDesktopWindowTarget(hwnd, false)?;
+ let visual = compositor.CreateSpriteVisual()?;
+ let brush = compositor.CreateHostBackdropBrush()?;
+ visual.SetBrush(&brush)?;
+ let geometry = compositor.CreateRoundedRectangleGeometry()?;
+ let clip = compositor.CreateGeometricClipWithGeometry(&geometry)?;
+ visual.SetClip(&clip)?;
+ target.SetRoot(&visual)?;
+ Ok(Self {
+ hwnd,
+ owner,
+ _queue: queue,
+ _compositor: compositor,
+ _target: target,
+ visual,
+ geometry,
+ last: (0, 0, 0, 0, 0),
+ })
+ })();
+ if result.is_err() {
+ let _ = DestroyWindow(hwnd);
+ }
+ result
+ }
+ }
+ fn sync(&mut self, radius: f32) -> windows::core::Result<()> {
+ unsafe {
+ if !IsWindowVisible(self.owner).as_bool() || IsIconic(self.owner).as_bool() {
+ let _ = ShowWindow(self.hwnd, SW_HIDE);
+ return Ok(());
+ }
+ let mut rect = RECT::default();
+ GetClientRect(self.owner, &mut rect)?;
+ let width = rect.right;
+ let height = rect.bottom;
+ let mut origin = POINT::default();
+ if !ClientToScreen(self.owner, &mut origin).as_bool() {
+ return Err(windows::core::Error::from_win32());
+ }
+ rect.left = origin.x;
+ rect.top = origin.y;
+ let rounded = if IsZoomed(self.owner).as_bool() {
+ 0.0
+ } else {
+ radius
+ };
+ let key = (rect.left, rect.top, width, height, rounded.to_bits());
+ let unchanged = self.last == key;
+ if !unchanged {
+ let size = windows_numerics::Vector2 {
+ X: width as f32,
+ Y: height as f32,
+ };
+ self.visual.SetSize(size)?;
+ self.geometry.SetSize(size)?;
+ self.geometry.SetCornerRadius(windows_numerics::Vector2 {
+ X: rounded,
+ Y: rounded,
+ })?;
+ // Clip the HWND as well as its composition visual. Otherwise Windows
+ // can composite a rectangular host surface outside the glass curve.
+ // Leave the GPU geometric clip's antialiased pixels inside
+ // the hard HWND mask; the clip still owns the visible radius.
+ let diameter = ((rounded - 2.0).max(0.0) * 2.0).round() as i32;
+ let region = if diameter > 0 {
+ CreateRoundRectRgn(0, 0, width, height, diameter, diameter)
+ } else {
+ CreateRectRgn(0, 0, width, height)
+ };
+ if SetWindowRgn(self.hwnd, Some(region), true) == 0 {
+ let _ = DeleteObject(region.into());
+ return Err(windows::core::Error::from_win32());
+ }
+ self.last = key;
+ }
+ if unchanged
+ && IsWindowVisible(self.hwnd).as_bool()
+ && GetWindow(self.hwnd, GW_HWNDPREV).is_ok_and(|window| window == self.owner)
+ && (GetWindowLongPtrW(self.owner, GWL_EXSTYLE) & WS_EX_TOPMOST.0 as isize)
+ == (GetWindowLongPtrW(self.hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST.0 as isize)
+ {
+ return Ok(());
+ }
+ // Follow quick search into/out of the topmost band without activation.
+ let owner_top =
+ GetWindowLongPtrW(self.owner, GWL_EXSTYLE) & WS_EX_TOPMOST.0 as isize != 0;
+ let host_top =
+ GetWindowLongPtrW(self.hwnd, GWL_EXSTYLE) & WS_EX_TOPMOST.0 as isize != 0;
+ if owner_top != host_top {
+ SetWindowPos(
+ self.hwnd,
+ Some(if owner_top {
+ HWND_TOPMOST
+ } else {
+ HWND_NOTOPMOST
+ }),
+ 0,
+ 0,
+ 0,
+ 0,
+ SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE,
+ )?;
+ }
+ // Immediately below the UI, never above it or activated by pointer input.
+ SetWindowPos(
+ self.hwnd,
+ Some(self.owner),
+ rect.left,
+ rect.top,
+ width,
+ height,
+ SWP_NOACTIVATE | SWP_SHOWWINDOW,
+ )?;
+ Ok(())
+ }
+ }
+ }
+ pub fn sync(hwnd: isize, radius: f32) -> bool {
+ if FAILED.with(Cell::get) {
+ return false;
+ }
+ GLASS.with(|slot| {
+ let Ok(mut slot) = slot.try_borrow_mut() else {
+ return false;
+ };
+ if slot.as_ref().is_some_and(|g| g.owner.0 as isize != hwnd) {
+ slot.take();
+ }
+ if slot.is_none() {
+ match Glass::new(HWND(hwnd as *mut _)) {
+ Ok(g) => *slot = Some(g),
+ Err(error) => {
+ FAILED.with(|failed| failed.set(true));
+ eprintln!("Clipped glass initialization: {error}");
+ return false;
+ }
+ }
+ }
+ slot.as_mut().unwrap().sync(radius).is_ok()
+ })
+ }
+ pub fn follow(hwnd: isize) {
+ GLASS.with(|slot| {
+ if let Ok(mut slot) = slot.try_borrow_mut() {
+ if let Some(glass) = slot.as_mut() {
+ if glass.owner.0 as isize == hwnd {
+ let radius = f32::from_bits(glass.last.4);
+ let _ = glass.sync(radius);
+ }
+ }
+ }
+ });
+ }
+ pub fn hide() {
+ GLASS.with(|slot| {
+ if let Ok(slot) = slot.try_borrow() {
+ if let Some(glass) = slot.as_ref() {
+ unsafe {
+ let _ = ShowWindow(glass.hwnd, SW_HIDE);
+ }
+ }
+ }
+ });
+ }
+}
+#[cfg(windows)]
+pub use windows_impl::{follow, hide, sync};
+#[cfg(not(windows))]
+pub fn sync(_: isize, _: f32) -> bool {
+ false
+}
+#[cfg(not(windows))]
+pub fn hide() {}
+
+#[cfg(not(windows))]
+pub fn follow(_: isize) {}
diff --git a/native/src/dictation.rs b/native/src/dictation.rs
index 154126f..5973f82 100644
--- a/native/src/dictation.rs
+++ b/native/src/dictation.rs
@@ -719,13 +719,22 @@ fn activation_wave() -> Vec<u8> {
sample_format: hound::SampleFormat::Int,
};
let mut writer = hound::WavWriter::new(&mut data, spec).unwrap();
- for n in 0..5280 {
+ // Reference glass-chime notes: pure C4 followed by G4, with its gentle
+ // exponential decay. A short attack/release prevents discontinuity clicks.
+ for n in 0..48000 {
let t = n as f32 / 24000.0;
- let envelope = (t / 0.012).min(1.0) * (1.0 - t / 0.22).max(0.0).powf(2.0);
- let tone = (std::f32::consts::TAU * 523.25 * t).sin() * 0.09
- + (std::f32::consts::TAU * 659.25 * t).sin() * 0.045;
+ let mut sample = 0.0f32;
+ for (start, hz) in [(0.0, 261.63), (0.15, 392.0)] {
+ let age = t - start;
+ if (0.0..1.85).contains(&age) {
+ let attack = (age / 0.004).min(1.0);
+ let release = ((1.85 - age) / 0.05).clamp(0.0, 1.0);
+ let envelope = 0.18 * (0.0001f32 / 0.18).powf(age / 1.8);
+ sample += (std::f32::consts::TAU * hz * age).sin() * envelope * attack * release;
+ }
+ }
writer
- .write_sample((tone * envelope * 32767.0) as i16)
+ .write_sample((sample.clamp(-1.0, 1.0) * 32767.0) as i16)
.unwrap();
}
writer.finalize().unwrap();
@@ -737,7 +746,7 @@ fn activation_sound() {
use windows::{Win32::Media::Audio::*, core::PCWSTR};
static SOUND: std::sync::OnceLock<Vec<u8>> = std::sync::OnceLock::new();
let sound = SOUND.get_or_init(activation_wave);
- // Finish the brief cue before capture so it does not trigger speech endpointing.
+ // Finish the two-note cue before capture so it cannot trigger speech endpointing.
let _ = PlaySoundW(
PCWSTR(sound.as_ptr().cast()),
None,
@@ -915,12 +924,29 @@ mod endpoint_tests {
#[cfg(test)]
mod activation_tests {
#[test]
- fn cue_is_short_and_quiet() {
+ fn glass_cue_is_c4_then_g4_with_a_quiet_decay() {
let bytes = super::activation_wave();
+ if let Ok(path) = std::env::var("VECTORDASH_CUE_TEST_OUTPUT") {
+ std::fs::write(path, &bytes).unwrap();
+ }
let mut wav = hound::WavReader::new(std::io::Cursor::new(bytes)).unwrap();
- assert!(wav.duration() <= 6000);
+ assert_eq!(wav.duration(), 48000);
assert_eq!(wav.spec().sample_rate, 24000);
- assert!(wav.samples::<i16>().all(|n| n.unwrap().abs() < 5000));
+ let samples = wav.samples::<i16>().map(Result::unwrap).collect::<Vec<_>>();
+ assert!(samples.iter().all(|n| n.abs() < 12000));
+ let energy = |hz: f32, start: usize, end: usize| {
+ let (mut re, mut im) = (0.0f32, 0.0f32);
+ for (i, sample) in samples[start..end].iter().enumerate() {
+ let phase = std::f32::consts::TAU * hz * (start + i) as f32 / 24000.0;
+ re += *sample as f32 * phase.cos();
+ im += *sample as f32 * phase.sin();
+ }
+ re * re + im * im
+ };
+ assert!(energy(261.63, 480, 2880) > energy(392.0, 480, 2880) * 20.0);
+ assert!(energy(392.0, 4320, 7200) > energy(261.63, 4320, 7200));
+ assert!(samples[45600..].iter().all(|n| n.abs() < 30));
+ assert_eq!(samples[0], 0);
}
}
diff --git a/native/src/main.rs b/native/src/main.rs
index 5c8502b..25028ed 100644
--- a/native/src/main.rs
+++ b/native/src/main.rs
@@ -2,6 +2,7 @@
mod ai;
mod app;
mod appearance;
+mod backdrop;
mod capture;
mod changes;
mod cli;
@@ -165,6 +166,7 @@ fn run() -> anyhow::Result<()> {
})
.with_decorations(false)
.with_transparent(true)
+ .with_has_shadow(false)
.with_visible(!hidden),
..Default::default()
};
diff --git a/native/src/platform.rs b/native/src/platform.rs
index aab2dbb..d7156e8 100644
--- a/native/src/platform.rs
+++ b/native/src/platform.rs
@@ -936,7 +936,7 @@ pub fn lower_integrity() -> Result<()> {
pub fn lower_integrity() -> Result<()> {
Ok(())
}
-static POPUP_NATIVE_MATERIAL: std::sync::atomic::AtomicBool =
+static NATIVE_GLASS_MATERIAL: std::sync::atomic::AtomicBool =
std::sync::atomic::AtomicBool::new(false);
#[cfg(windows)]
@@ -949,20 +949,17 @@ pub fn clip_window(value: isize, radius: f32, refresh_material: bool) {
unsafe {
let hwnd = HWND(value as *mut _);
if !IsWindowVisible(hwnd).as_bool() || IsIconic(hwnd).as_bool() {
+ crate::backdrop::hide();
return;
}
static GEOMETRY: std::sync::OnceLock<
std::sync::Mutex<std::collections::HashMap<isize, (i32, i32, i32, i32, i32)>>,
> = std::sync::OnceLock::new();
let mut geometry = GEOMETRY.get_or_init(Default::default).lock().unwrap();
- if POPUP_NATIVE_MATERIAL.load(std::sync::atomic::Ordering::Relaxed) {
+ if NATIVE_GLASS_MATERIAL.load(std::sync::atomic::Ordering::Relaxed) {
// Winit may restore caption flags while applying a native resize. Keep only
// the invisible sizing frame needed by DWM, preserving visibility/maximize bits.
- let mask = (WS_CAPTION.0
- | WS_THICKFRAME.0
- | WS_SYSMENU.0
- | WS_MINIMIZEBOX.0
- | WS_MAXIMIZEBOX.0) as isize;
+ let mask = (WS_CAPTION.0 | WS_THICKFRAME.0) as isize;
let current = GetWindowLongPtrW(hwnd, GWL_STYLE);
let style = (current & !mask) | WS_THICKFRAME.0 as isize;
if current != style {
@@ -977,20 +974,11 @@ pub fn clip_window(value: isize, radius: f32, refresh_material: bool) {
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_FRAMECHANGED,
);
}
- // Native acrylic and native rounding must share the same compositor surface.
- let native = (-1, -1, -1, -1, -1);
- if refresh_material || geometry.get(&value) != Some(&native) {
- let current = CreateRectRgn(0, 0, 0, 0);
- let has_region = GetWindowRgn(hwnd, current).0 != 0;
- let _ = DeleteObject(current.into());
- if has_region {
- SetWindowRgn(hwnd, None, true);
- }
- geometry.insert(value, native);
- }
- return;
+ // DWM only offers a fixed small radius. Apply the same custom 28px
+ // region as the renderer to the entire HWND, including its backdrop.
}
if IsZoomed(hwnd).as_bool() {
+ let _ = crate::backdrop::sync(value, 0.0);
if geometry.get(&value) != Some(&(0, 0, 0, 0, 0)) {
SetWindowRgn(hwnd, None, true);
geometry.insert(value, (0, 0, 0, 0, 0));
@@ -1006,16 +994,19 @@ pub fn clip_window(value: isize, radius: f32, refresh_material: bool) {
return;
}
let (x, y) = (origin.x - window.left, origin.y - window.top);
- let diameter = (radius * 2.0).round() as i32;
+ let _ = crate::backdrop::sync(value, radius);
+ // Keep the hard safety mask outside the antialiased 28px paint edge.
+ // A smaller radius includes the fringe without adding any painted frame.
+ let diameter = ((radius - 2.0).max(0.0) * 2.0).round() as i32;
let key = (x, y, client.right, client.bottom, diameter);
if !refresh_material && geometry.get(&value) == Some(&key) {
return;
}
let region = CreateRoundRectRgn(
- x + 1,
- y + 1,
- x + client.right - 1,
- y + client.bottom - 1,
+ x,
+ y,
+ x + client.right,
+ y + client.bottom,
diameter,
diameter,
);
@@ -1039,6 +1030,11 @@ pub fn clip_window(value: isize, radius: f32, refresh_material: bool) {
if unchanged && !refresh_material {
return;
}
+ if NATIVE_GLASS_MATERIAL.load(std::sync::atomic::Ordering::Relaxed) {
+ // System acrylic is clipped by the HWND region. Do not enable a second
+ // legacy blur surface, which can leave a rectangular fill in the corners.
+ return;
+ }
// The compositor's blur surface has its own region; alpha-only rounded painting
// or a hit-test region does not restrict a full-window backdrop surface.
let blur = CreateRoundRectRgn(
@@ -1070,19 +1066,17 @@ pub fn material(value: isize, popup: bool, dark: bool, _: [u8; 3], _: f32) {
};
unsafe {
let hwnd = HWND(value as *mut _);
- POPUP_NATIVE_MATERIAL.store(popup, std::sync::atomic::Ordering::Relaxed);
- static BASE_STYLE: std::sync::OnceLock<isize> = std::sync::OnceLock::new();
- let original = *BASE_STYLE.get_or_init(|| GetWindowLongPtrW(hwnd, GWL_STYLE));
+ NATIVE_GLASS_MATERIAL.store(true, std::sync::atomic::Ordering::Relaxed);
let mask =
(WS_CAPTION.0 | WS_THICKFRAME.0 | WS_SYSMENU.0 | WS_MINIMIZEBOX.0 | WS_MAXIMIZEBOX.0)
as isize;
let current = GetWindowLongPtrW(hwnd, GWL_STYLE);
- let style = (current & !mask)
- | if popup {
- WS_THICKFRAME.0 as isize
- } else {
- original & mask
- };
+ let controls = if popup {
+ 0
+ } else {
+ (WS_SYSMENU.0 | WS_MINIMIZEBOX.0 | WS_MAXIMIZEBOX.0) as isize
+ };
+ let style = (current & !mask) | WS_THICKFRAME.0 as isize | controls;
if GetWindowLongPtrW(hwnd, GWL_STYLE) != style {
SetWindowLongPtrW(hwnd, GWL_STYLE, style);
let _ = SetWindowPos(
@@ -1105,36 +1099,36 @@ pub fn material(value: isize, popup: bool, dark: bool, _: [u8; 3], _: f32) {
4,
);
// Legacy accent blur creates a rectangular compositor layer outside the window region.
- // Use the supported transient-window acrylic material, which follows the HWND clip.
- let policy = if popup {
- DWMNCRP_ENABLED
- } else {
- DWMNCRP_USEWINDOWSTYLE
- };
+ // The system backdrop ignores custom radii; a clipped composition brush supplies
+ // the blur instead. This HWND only carries the transparent UI.
+ // The renderer and native region own the complete 28px silhouette. A DWM
+ // frame/shadow uses a different outline and leaks behind those corners.
+ let policy = DWMNCRP_DISABLED;
let _ = DwmSetWindowAttribute(hwnd, DWMWA_NCRENDERING_POLICY, &policy as *const _ as _, 4);
- let corners = if popup {
- DWMWCP_ROUND
- } else {
- DWMWCP_DONOTROUND
- };
+ let corners = DWMWCP_DONOTROUND;
let _ = DwmSetWindowAttribute(
hwnd,
DWMWA_WINDOW_CORNER_PREFERENCE,
&corners as *const _ as _,
4,
);
- let backdrop = if popup {
- DWMSBT_TRANSIENTWINDOW
- } else {
- DWMSBT_NONE
- };
+ let backdrop = DWMSBT_NONE;
let _ = DwmSetWindowAttribute(
hwnd,
DWMWA_SYSTEMBACKDROP_TYPE,
&backdrop as *const _ as _,
4,
);
- let margin = if popup { -1 } else { 0 };
+ let empty = windows::Win32::Graphics::Gdi::CreateRectRgn(0, 0, 0, 0);
+ let alpha = DWM_BLURBEHIND {
+ dwFlags: DWM_BB_ENABLE | DWM_BB_BLURREGION,
+ fEnable: true.into(),
+ hRgnBlur: empty,
+ fTransitionOnMaximized: false.into(),
+ };
+ let _ = DwmEnableBlurBehindWindow(hwnd, &alpha);
+ let _ = windows::Win32::Graphics::Gdi::DeleteObject(empty.into());
+ let margin = 0;
let _ = DwmExtendFrameIntoClientArea(
hwnd,
&MARGINS {
@@ -1683,8 +1677,23 @@ unsafe extern "system" fn window_hit_test(
WindowsAndMessaging::{HTCAPTION, WM_NCHITTEST},
},
};
+ if message == windows::Win32::UI::WindowsAndMessaging::WM_SIZE
+ && wparam.0 == windows::Win32::UI::WindowsAndMessaging::SIZE_MINIMIZED as usize
+ {
+ crate::backdrop::hide();
+ }
+ if message == windows::Win32::UI::WindowsAndMessaging::WM_WINDOWPOSCHANGED
+ || message == windows::Win32::UI::WindowsAndMessaging::WM_ACTIVATE
+ {
+ crate::backdrop::follow(hwnd.0 as isize);
+ }
+ if message == windows::Win32::UI::WindowsAndMessaging::WM_SHOWWINDOW && wparam.0 == 0
+ || message == windows::Win32::UI::WindowsAndMessaging::WM_NCDESTROY
+ {
+ crate::backdrop::hide();
+ }
if message == windows::Win32::UI::WindowsAndMessaging::WM_NCCALCSIZE
- && POPUP_NATIVE_MATERIAL.load(std::sync::atomic::Ordering::Relaxed)
+ && NATIVE_GLASS_MATERIAL.load(std::sync::atomic::Ordering::Relaxed)
{
return LRESULT(0);
}
diff --git a/packaging/VectorDash-Rust.iss b/packaging/VectorDash-Rust.iss
index e969017..65ea040 100644
--- a/packaging/VectorDash-Rust.iss
+++ b/packaging/VectorDash-Rust.iss
@@ -3,7 +3,7 @@ AppId={{C6AC1B4D-A119-4D73-B2C8-6C507DEFE923}
AppName=VectorDash
AppVerName=VectorDash
UninstallDisplayName=VectorDash
-AppVersion=0.3.20
+AppVersion=0.3.22
AppPublisher=VectorDash contributors
AppPublisherURL=https://github.com/ampersandru/VectorDash
DefaultDirName={localappdata}\Programs\VectorDash
@@ -13,7 +13,7 @@ ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
MinVersion=10.0.22000
OutputDir=..\dist\installer
-OutputBaseFilename=VectorDash-Rust-Setup-0.3.20-x64
+OutputBaseFilename=VectorDash-Rust-Setup-0.3.22-x64
SetupIconFile=VectorDash.ico
UninstallDisplayIcon={app}\VectorDash.exe
LicenseFile=..\LICENSE