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 <Border
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
Background="Transparent" Background="Transparent"
DoubleTapped="LinuxTitleBar_DoubleTapped"
PointerPressed="LinuxTitleBar_PointerPressed" /> PointerPressed="LinuxTitleBar_PointerPressed" />
<StackPanel <StackPanel
Grid.Column="0" Grid.Column="0"
@ -71,21 +70,6 @@
<StackPanel <StackPanel
Grid.Column="2" Grid.Column="2"
Orientation="Horizontal"> 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 <Button
x:Name="btnLinuxClose" x:Name="btnLinuxClose"
Classes="windowTitleBarButton" Classes="windowTitleBarButton"

View file

@ -10,7 +10,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
{ {
private static Config _config; private static Config _config;
private readonly WindowNotificationManager? _manager; private readonly WindowNotificationManager? _manager;
private IDisposable? _linuxWindowStateSubscription;
private CheckUpdateView? _checkUpdateView; private CheckUpdateView? _checkUpdateView;
private BackupAndRestoreView? _backupAndRestoreView; private BackupAndRestoreView? _backupAndRestoreView;
private bool _blCloseByUser = false; private bool _blCloseByUser = false;
@ -406,17 +405,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
linuxTitleBar.IsVisible = true; linuxTitleBar.IsVisible = true;
SystemDecorations = SystemDecorations.BorderOnly; 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) private void LinuxTitleBar_PointerPressed(object? sender, PointerPressedEventArgs e)
@ -429,38 +417,11 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
BeginMoveDrag(e); 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) private void BtnLinuxClose_Click(object? sender, RoutedEventArgs e)
{ {
HideToTray(); HideToTray();
} }
private void ToggleLinuxWindowState()
{
WindowState = WindowState == WindowState.Maximized
? WindowState.Normal
: WindowState.Maximized;
}
private void HideToTray() private void HideToTray()
{ {
foreach (var ownedWindow in OwnedWindows) foreach (var ownedWindow in OwnedWindows)
@ -534,12 +495,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
RestoreUI(); RestoreUI();
} }
protected override void OnClosed(EventArgs e)
{
_linuxWindowStateSubscription?.Dispose();
base.OnClosed(e);
}
private void RestoreUI() private void RestoreUI()
{ {
if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0) if (_config.UiItem.MainGirdHeight1 > 0 && _config.UiItem.MainGirdHeight2 > 0)