Skip to content

armgit / nota

Public Imported from GitHub
0

Nota — a free DAW for macOS, Windows and Linux. No subscription, no account — just open it and make music.

(fix) Flat window buttons on Windows (#415)

Egor Khindikaynen3c9c982aa593
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d7e6769..7ae3f652 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -140,6 +140,10 @@ Entry categories: `Added`, `Changed`, `Fixed`, `Removed`.
returns, then the master.
### Fixed
+- **Window buttons on Windows** — minimize, maximize and close in the title bar showed as
+ grey rounded tiles with an always-red close button, plus an extra fullscreen button. They
+ are flat again, as in other Windows apps: the hover tone under the pointer, red only while
+ the pointer is on close. Fullscreen stays on F11 and View ▸ Toggle full screen.
- **Right-click menu on knobs and graph handles** — right-clicking a knob, or a handle on an
envelope or filter graph (Aurora, Volt, Bass, Synth and others), showed no menu, though
the same menu opened on the value under it. Right-click now shows Type value… and Reset to
diff --git a/src/managed/Nota.App/Theme/NotaTheme.axaml b/src/managed/Nota.App/Theme/NotaTheme.axaml
index 034bd0f0..c95f6204 100644
--- a/src/managed/Nota.App/Theme/NotaTheme.axaml
+++ b/src/managed/Nota.App/Theme/NotaTheme.axaml
@@ -363,6 +363,65 @@
<!-- .danger no longer paints red: red belongs to recording and errors. A destructive
action is an ordinary raised button; its label says what it does. -->
+ <!-- ===== Window caption buttons (Windows) =====
+ Avalonia draws the minimize / maximize / close buttons itself over the extended title
+ bar, as plain Buttons — so the raised Button face above would turn each into a grey
+ tile and keep the close button red at rest. Give them back a flat face: no ground at
+ rest, the hover tone under the pointer, and red only while the pointer is on close.
+ The glyph colour is CaptionButtonForeground (NotaThemeService publishes it). The
+ fullscreen button goes: Windows windows carry three, and F11 / View cover fullscreen.
+ Avalonia's own title text goes too: every Nota window draws its own title bar. -->
+ <!-- Opacity, not IsVisible: the template binds IsVisible, which outranks a style. -->
+ <Style Selector="WindowDrawnDecorations /template/ Panel#PART_TitleTextPanel">
+ <Setter Property="Opacity" Value="0"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button">
+ <Setter Property="Width" Value="46"/>
+ <Setter Property="Height" Value="NaN"/>
+ <Setter Property="VerticalAlignment" Value="Stretch"/>
+ <Setter Property="Padding" Value="0"/>
+ <Setter Property="Template">
+ <ControlTemplate>
+ <Border x:Name="PART_CaptionFace" Background="{DynamicResource Brush.SurfaceHoverClear}">
+ <Border.Transitions>
+ <Transitions>
+ <BrushTransition Property="Background" Duration="0:0:0.12" Easing="CubicEaseOut"/>
+ </Transitions>
+ </Border.Transitions>
+ <ContentPresenter Content="{TemplateBinding Content}"
+ HorizontalAlignment="Center" VerticalAlignment="Center"/>
+ </Border>
+ </ControlTemplate>
+ </Setter>
+ </Style>
+ <!-- Fluent's caption theme fills the inner presenter on hover / press with the button's
+ own Background (#E81123 on close): a second tile around the glyph. Keep it clear. -->
+ <Style Selector="WindowDrawnDecorations /template/ Button:pointerover /template/ ContentPresenter,
+ WindowDrawnDecorations /template/ Button:pressed /template/ ContentPresenter">
+ <Setter Property="Background" Value="Transparent"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button:pointerover /template/ Border#PART_CaptionFace">
+ <Setter Property="Background" Value="{DynamicResource Brush.SurfaceHover}"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button:pressed /template/ Border#PART_CaptionFace">
+ <Setter Property="Background" Value="{DynamicResource Brush.SurfaceActive}"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button#PART_CloseButton:pointerover /template/ Border#PART_CaptionFace,
+ WindowDrawnDecorations /template/ Button#PART_PopoverCloseButton:pointerover /template/ Border#PART_CaptionFace">
+ <Setter Property="Background" Value="{DynamicResource Brush.Danger}"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button#PART_CloseButton:pressed /template/ Border#PART_CaptionFace,
+ WindowDrawnDecorations /template/ Button#PART_PopoverCloseButton:pressed /template/ Border#PART_CaptionFace">
+ <Setter Property="Background" Value="{DynamicResource Brush.DangerBright}"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button#PART_CloseButton:pointerover Path,
+ WindowDrawnDecorations /template/ Button#PART_PopoverCloseButton:pointerover Path">
+ <Setter Property="Fill" Value="{DynamicResource Brush.RecordInk}"/>
+ </Style>
+ <Style Selector="WindowDrawnDecorations /template/ Button#PART_FullScreenButton">
+ <Setter Property="IsVisible" Value="False"/>
+ </Style>
+
<!-- ===== Toggle buttons ===== -->
<Style Selector="ToggleButton">
<Setter Property="IsTabStop" Value="False"/>
diff --git a/src/managed/Nota.App/Theme/NotaThemeService.cs b/src/managed/Nota.App/Theme/NotaThemeService.cs
index 5b1e309e..79dfa92d 100644
--- a/src/managed/Nota.App/Theme/NotaThemeService.cs
+++ b/src/managed/Nota.App/Theme/NotaThemeService.cs
@@ -86,6 +86,9 @@ internal static class NotaThemeService
{
if (_published) return;
foreach (var (key, brush) in NotaPalette.AllKeys) app.Resources[key] = brush;
+ // The glyphs of the caption buttons Avalonia draws on Windows read this Fluent key;
+ // point it at the secondary-text brush so they follow the theme like our own icons.
+ app.Resources["CaptionButtonForeground"] = app.Resources["Brush.TextSecondary"];
_published = true;
}