diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
index 80413559..9f11041e 100644
--- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
@@ -399,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;
         }