macOS 一些优化 (#6596)
Some checks are pending
release Linux / build (Release) (push) Waiting to run
release macOS / build (Release) (push) Waiting to run
release Windows desktop (Avalonia UI) / build (Release) (push) Waiting to run
release Windows / build (Release) (push) Waiting to run

* [macOS] hide icon in Dock

* [macOS] fix: close button not work

* [macOS] fix: cant directly show window when click `Show or hide the main window` on minimized
This commit is contained in:
ShiinaRinne 2025-01-29 19:26:40 +08:00 committed by GitHub
parent e674a025d8
commit f71125d8f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 26 additions and 24 deletions

View file

@ -52,5 +52,6 @@ internal class Program
//.WithInterFont() //.WithInterFont()
.WithFontByDefault() .WithFontByDefault()
.LogToTrace() .LogToTrace()
.UseReactiveUI(); .UseReactiveUI()
.With(new MacOSPlatformOptions { ShowInDock = false});
} }

View file

@ -389,7 +389,8 @@ namespace v2rayN.Desktop.Views
_blCloseByUser = true; _blCloseByUser = true;
StorageUI(); StorageUI();
await ViewModel?.MyAppExitAsync(false); await ViewModel?.MyAppExitAsync(false);
Close();
} }
#endregion Event #endregion Event
@ -398,28 +399,28 @@ namespace v2rayN.Desktop.Views
public void ShowHideWindow(bool? blShow) public void ShowHideWindow(bool? blShow)
{ {
var bl = blShow ?? !_config.UiItem.ShowInTaskbar; var bl = blShow ?? (!_config.UiItem.ShowInTaskbar ^ (WindowState==WindowState.Minimized));
if (bl) if (bl)
{ {
this.Show(); this.Show();
if (this.WindowState == WindowState.Minimized) if (this.WindowState == WindowState.Minimized)
{ {
this.WindowState = WindowState.Normal; this.WindowState = WindowState.Normal;
} }
this.Activate(); this.Activate();
this.Focus(); this.Focus();
} }
else else
{ {
if (_config.UiItem.Hide2TrayWhenClose) if (Utils.IsOSX() || _config.UiItem.Hide2TrayWhenClose)
{ {
this.Hide(); this.Hide();
} }
else else
{ {
this.WindowState = WindowState.Minimized; this.WindowState = WindowState.Minimized;
} }
} }
_config.UiItem.ShowInTaskbar = bl; _config.UiItem.ShowInTaskbar = bl;
} }