Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/RoyalTerminal.Avalonia.App/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,18 @@ private void InitializeComponent()

private void ConfigurePlatformWindowDecorations()
{
WindowDecorations = OperatingSystem.IsMacOS()
? WindowDecorations.Full
: WindowDecorations.BorderOnly;
if (OperatingSystem.IsLinux())
{
ExtendClientAreaToDecorationsHint = false;
WindowDecorations = WindowDecorations.Full;
Comment on lines +79 to +80

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Supply a title when enabling Linux decorations

On Linux this branch enables server-side decorations, but MainWindow.axaml binds Window.Title to ShellWindowTitle, which returns string.Empty everywhere except macOS (MainWindowViewModel.cs:552); the existing flow test also explicitly expects that empty title on Linux. Consequently the restored native title bar is blank in Linux window managers. Return a product/window title for Linux (and update that assertion) when native decorations are used.

Useful? React with 👍 / 👎.

Comment on lines +77 to +80

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move the Linux decoration policy out of code-behind

This adds platform-specific presentation behavior directly to MainWindow code-behind. The repository's strict MVVM rule requires views to remain passive and limits code-behind to InitializeComponent(); put this policy in a behavior/coordinator or another presentation service so the view does not own runtime UI logic.

AGENTS.md reference: AGENTS.md:L18-L20

Useful? React with 👍 / 👎.

}
else
{
ExtendClientAreaToDecorationsHint = true;
WindowDecorations = OperatingSystem.IsMacOS()
? WindowDecorations.Full
: WindowDecorations.BorderOnly;
}
}

}
16 changes: 12 additions & 4 deletions tests/RoyalTerminal.Tests/MainWindowViewModelFlowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1466,10 +1466,18 @@ public void MainWindow_UsesExtendedClientTitleBarLayout()
Point rightDecorationReserveOrigin = titleBarRightDecorationReserve.TranslatePoint(new Point(0, 0), titleBarLayout)
?? throw new InvalidOperationException("Title bar right decoration reserve is not attached to the title bar layout.");

Assert.True(window.ExtendClientAreaToDecorationsHint);
Assert.Equal(
OperatingSystem.IsMacOS() ? WindowDecorations.Full : WindowDecorations.BorderOnly,
window.WindowDecorations);
if (OperatingSystem.IsLinux())
{
Assert.False(window.ExtendClientAreaToDecorationsHint);
Assert.Equal(WindowDecorations.Full, window.WindowDecorations);
}
else
{
Assert.True(window.ExtendClientAreaToDecorationsHint);
Assert.Equal(
OperatingSystem.IsMacOS() ? WindowDecorations.Full : WindowDecorations.BorderOnly,
window.WindowDecorations);
}
Assert.Equal(-1d, window.ExtendClientAreaTitleBarHeightHint);
Assert.Contains("titleBarArea", titleBar.Classes);
Assert.Equal(WindowDecorationsElementRole.TitleBar, WindowDecorationProperties.GetElementRole(titleBar));
Expand Down