diff --git a/v2rayN/v2rayN.Desktop/Program.cs b/v2rayN/v2rayN.Desktop/Program.cs index 5d1c6493..3039895c 100644 --- a/v2rayN/v2rayN.Desktop/Program.cs +++ b/v2rayN/v2rayN.Desktop/Program.cs @@ -52,5 +52,6 @@ internal class Program //.WithInterFont() .WithFontByDefault() .LogToTrace() - .UseReactiveUI(); + .UseReactiveUI() + .With(new MacOSPlatformOptions { ShowInDock = false}); } \ No newline at end of file diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs index 9071145c..9f11041e 100644 --- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs @@ -389,7 +389,8 @@ namespace v2rayN.Desktop.Views _blCloseByUser = true; StorageUI(); - await ViewModel?.MyAppExitAsync(false); + await ViewModel?.MyAppExitAsync(false); + Close(); } #endregion Event @@ -398,28 +399,28 @@ namespace v2rayN.Desktop.Views public void ShowHideWindow(bool? blShow) { - var bl = blShow ?? !_config.UiItem.ShowInTaskbar; - if (bl) - { - this.Show(); - if (this.WindowState == WindowState.Minimized) - { - this.WindowState = WindowState.Normal; - } - this.Activate(); - this.Focus(); - } - else - { - if (_config.UiItem.Hide2TrayWhenClose) - { - this.Hide(); - } - else - { - this.WindowState = WindowState.Minimized; - } - } + var bl = blShow ?? (!_config.UiItem.ShowInTaskbar ^ (WindowState==WindowState.Minimized)); + if (bl) + { + this.Show(); + if (this.WindowState == WindowState.Minimized) + { + this.WindowState = WindowState.Normal; + } + this.Activate(); + this.Focus(); + } + else + { + if (Utils.IsOSX() || _config.UiItem.Hide2TrayWhenClose) + { + this.Hide(); + } + else + { + this.WindowState = WindowState.Minimized; + } + } _config.UiItem.ShowInTaskbar = bl; }