Keep only close button in Linux title bar

This commit is contained in:
YsLtr 2026-03-25 15:23:57 +08:00
parent 07903628f1
commit 10fc87ca12
2 changed files with 0 additions and 61 deletions

View file

@ -52,7 +52,6 @@
<Border
Grid.ColumnSpan="2"
Background="Transparent"
DoubleTapped="LinuxTitleBar_DoubleTapped"
PointerPressed="LinuxTitleBar_PointerPressed" />
<StackPanel
Grid.Column="0"
@ -71,21 +70,6 @@
<StackPanel
Grid.Column="2"
Orientation="Horizontal">
<Button
x:Name="btnLinuxMinimize"
Classes="windowTitleBarButton"
Click="BtnLinuxMinimize_Click">
<TextBlock Classes="windowTitleBarGlyph" Text="-" />
</Button>
<Button
x:Name="btnLinuxMaximizeRestore"
Classes="windowTitleBarButton"
Click="BtnLinuxMaximizeRestore_Click">
<TextBlock
x:Name="txtLinuxMaximizeRestore"
Classes="windowTitleBarGlyph"
Text="□" />
</Button>
<Button
x:Name="btnLinuxClose"
Classes="windowTitleBarButton"

View file

@ -10,7 +10,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
{
private static Config _config;
private readonly WindowNotificationManager? _manager;
private IDisposable? _linuxWindowStateSubscription;
private CheckUpdateView? _checkUpdateView;
private BackupAndRestoreView? _backupAndRestoreView;
private bool _blCloseByUser = false;
@ -406,17 +405,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
linuxTitleBar.IsVisible = true;
SystemDecorations = SystemDecorations.BorderOnly;
btnLinuxMaximizeRestore.IsVisible = CanResize;
_linuxWindowStateSubscription = this
.GetObservable(WindowStateProperty)
.Subscribe(_ => UpdateLinuxTitleBarWindowState());
UpdateLinuxTitleBarWindowState();
}
private void UpdateLinuxTitleBarWindowState()
{
txtLinuxMaximizeRestore.Text = WindowState == WindowState.Maximized ? "❐" : "□";
}
private void LinuxTitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
@ -429,38 +417,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
BeginMoveDrag(e);
}
private void LinuxTitleBar_DoubleTapped(object? sender, TappedEventArgs e)
{
if (!Utils.IsLinux() || !CanResize)
{
return;
}
ToggleLinuxWindowState();
}
private void BtnLinuxMinimize_Click(object? sender, RoutedEventArgs e)
{
HideToTray();
}
private void BtnLinuxMaximizeRestore_Click(object? sender, RoutedEventArgs e)
{
ToggleLinuxWindowState();
}
private void BtnLinuxClose_Click(object? sender, RoutedEventArgs e)
{
HideToTray();
}
private void ToggleLinuxWindowState()
{
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
private void HideToTray()
{
foreach (var ownedWindow in OwnedWindows)
@ -534,12 +495,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
RestoreUI();
}
protected override void OnClosed(EventArgs e)
{
_linuxWindowStateSubscription?.Dispose();
base.OnClosed(e);
}
private void RestoreUI()
{
if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0)