diff --git a/Views/MainWindow.xaml.fs b/Views/MainWindow.xaml.fs index 942e638..24f2c1d 100644 --- a/Views/MainWindow.xaml.fs +++ b/Views/MainWindow.xaml.fs @@ -37,9 +37,10 @@ type MainWindow() as this = m_bgopacity <- States.background_opacity let comp = match m_bgcomp with - | States.Acrylic -> ui.AdvancedBlur(m_bgopacity, m_bgcolor) - | States.Blur -> ui.GaussianBlur(m_bgopacity, m_bgcolor) - | _ -> ui.SolidBackground m_bgcolor + | States.Acrylic -> ui.AdvancedBlur(m_bgopacity, m_bgcolor) + | States.Blur -> ui.GaussianBlur(m_bgopacity, m_bgcolor) + | States.Transparent -> ui.TransparentBackground(m_bgopacity, m_bgcolor) + | _ -> ui.SolidBackground m_bgcolor trace "mainwindow" "configBackground: %A" comp ui.SetWindowBackgroundComposition this comp diff --git a/states.fs b/states.fs index 80839bd..0b5e29b 100644 --- a/states.fs +++ b/states.fs @@ -92,6 +92,7 @@ let mutable ui_hlstate = false type BackgroundComposition = | NoComposition + | Transparent | Blur | Acrylic @@ -190,6 +191,7 @@ let parseBackgroundComposition (v: obj) = | "none" -> Some NoComposition | "blur" -> Some Blur | "acrylic" -> Some Acrylic + | "transparent" -> Some Transparent | _ -> None | _ -> None @@ -198,6 +200,7 @@ let backgroundCompositionToString = | NoComposition -> "none" | Blur -> "blur" | Acrylic -> "acrylic" + | Transparent -> "transparent" let Shutdown code = _appLifetime.Shutdown code diff --git a/ui.fs b/ui.fs index 8033167..584a063 100644 --- a/ui.fs +++ b/ui.fs @@ -437,6 +437,7 @@ open linux type WindowBackgroundComposition = | SolidBackground of color: Color + | TransparentBackground of opacity: float * color: Color | GaussianBlur of opacity: float * color: Color | AdvancedBlur of opacity: float * color: Color @@ -448,6 +449,10 @@ let SetWindowBackgroundComposition (win: Avalonia.Controls.Window) (composition: | SolidBackground c -> win.Background <- SolidColorBrush(c) AccentState.ACCENT_DISABLED, 0u, 0u + | TransparentBackground (op, c) -> + let c = Color(byte(op * 255.0), c.R, c.G, c.B) + win.Background <- SolidColorBrush(c) + AccentState.ACCENT_ENABLE_TRANSPARENTGRADIENT, 0u, 0u | GaussianBlur(op, c) -> let c = Color(byte(op * 255.0), c.R, c.G, c.B) win.Background <- SolidColorBrush(c) @@ -477,6 +482,7 @@ let SetWindowBackgroundComposition (win: Avalonia.Controls.Window) (composition: match composition with | SolidBackground c -> win.Background <- SolidColorBrush(c) + | TransparentBackground(op, c) // TODO verify | GaussianBlur(op, c) | AdvancedBlur(op, c) -> let c = Color(byte(op * 255.0), c.R, c.G, c.B) @@ -537,8 +543,8 @@ let SetWindowBackgroundComposition (win: Avalonia.Controls.Window) (composition: match composition with | SolidBackground c -> win.Background <- SolidColorBrush(c) + | TransparentBackground(op, c) // TODO verify | GaussianBlur(op, c) | AdvancedBlur(op, c) -> let c = Color(byte(op * 255.0), c.R, c.G, c.B) win.Background <- SolidColorBrush(c) - (*ignore <| vh_add_view(win.PlatformImpl.Handle.Handle)*)