From fce4a7b74cb415441f0a613f22207969982561dd Mon Sep 17 00:00:00 2001
From: 2dust <31833384+2dust@users.noreply.github.com>
Date: Tue, 7 Oct 2025 11:16:20 +0800
Subject: [PATCH] Optimization and improvement, tray, etc.
https://github.com/2dust/v2rayN/pull/8083
---
v2rayN/ServiceLib/Resx/ResUI.Designer.cs | 9 +++++++++
v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx | 3 +++
v2rayN/ServiceLib/Resx/ResUI.hu.resx | 3 +++
v2rayN/ServiceLib/Resx/ResUI.resx | 3 +++
v2rayN/ServiceLib/Resx/ResUI.ru.resx | 3 +++
v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx | 3 +++
v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx | 3 +++
.../ServiceLib/ViewModels/MainWindowViewModel.cs | 12 ------------
v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs | 8 +++++---
.../Views/OptionSettingWindow.axaml | 16 ++++++++++++----
.../Views/OptionSettingWindow.axaml.cs | 6 ++++++
11 files changed, 50 insertions(+), 19 deletions(-)
diff --git a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
index e38d9306..25fb9b85 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
+++ b/v2rayN/ServiceLib/Resx/ResUI.Designer.cs
@@ -3651,6 +3651,15 @@ namespace ServiceLib.Resx {
}
}
+ ///
+ /// 查找类似 If the system does not have a tray function, please do not enable it 的本地化字符串。
+ ///
+ public static string TbSettingsHide2TrayWhenCloseTip {
+ get {
+ return ResourceManager.GetString("TbSettingsHide2TrayWhenCloseTip", resourceCulture);
+ }
+ }
+
///
/// 查找类似 Hysteria Max bandwidth (Up/Down) 的本地化字符串。
///
diff --git a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
index b22e5ef0..449cb297 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.fa-Ir.resx
@@ -1593,4 +1593,7 @@
Not support protocol '{0}'.
+
+ If the system does not have a tray function, please do not enable it
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.hu.resx b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
index 93a9cd2b..9b7ca556 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.hu.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.hu.resx
@@ -1593,4 +1593,7 @@
Not support protocol '{0}'.
+
+ If the system does not have a tray function, please do not enable it
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.resx b/v2rayN/ServiceLib/Resx/ResUI.resx
index cbac5835..d6688de8 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.resx
@@ -1593,4 +1593,7 @@
Not support protocol '{0}'.
+
+ If the system does not have a tray function, please do not enable it
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.ru.resx b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
index e33889d0..5cf44f3a 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.ru.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.ru.resx
@@ -1593,4 +1593,7 @@
Not support protocol '{0}'.
+
+ If the system does not have a tray function, please do not enable it
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
index 39833705..dd5b8bda 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hans.resx
@@ -1590,4 +1590,7 @@
不支持协议 '{0}'。
+
+ 如果系统没有托盘功能,请不要开启
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
index 6a8efa14..1510ff67 100644
--- a/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
+++ b/v2rayN/ServiceLib/Resx/ResUI.zh-Hant.resx
@@ -1590,4 +1590,7 @@
Not support protocol '{0}'.
+
+ 如果系統沒有托盤功能,請不要開啟
+
\ No newline at end of file
diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
index f938bf45..a0803309 100644
--- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
+++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs
@@ -274,7 +274,6 @@ public class MainWindowViewModel : MyReactiveObject
BlReloadEnabled = true;
await Reload();
- // await AutoHideStartup();
}
#endregion Init
@@ -576,17 +575,6 @@ public class MainWindowViewModel : MyReactiveObject
await CoreManager.Instance.LoadCore(node);
}
- /*
- private async Task AutoHideStartup()
- {
- if (_config.UiItem.AutoHideStartup)
- {
- AppEvents.ShowHideWindowRequested.Publish(false);
- }
- await Task.CompletedTask;
- }
- */
-
#endregion core job
#region Presets
diff --git a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
index 169bd8da..35366e57 100644
--- a/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
+++ b/v2rayN/v2rayN.Desktop/Views/MainWindow.axaml.cs
@@ -412,7 +412,10 @@ public partial class MainWindow : WindowBase
public void ShowHideWindow(bool? blShow)
{
- var bl = blShow ?? (!_config.UiItem.ShowInTaskbar ^ (WindowState == WindowState.Minimized));
+ var bl = blShow ??
+ Utils.IsLinux()
+ ? (!_config.UiItem.ShowInTaskbar ^ (WindowState == WindowState.Minimized))
+ : !_config.UiItem.ShowInTaskbar;
if (bl)
{
this.Show();
@@ -446,8 +449,7 @@ public partial class MainWindow : WindowBase
base.OnLoaded(sender, e);
if (_config.UiItem.AutoHideStartup)
{
- this.ShowHideWindow(false);
- _config.UiItem.ShowInTaskbar = true;
+ ShowHideWindow(false);
}
RestoreUI();
}
diff --git a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
index 727f96a0..e3d225d6 100644
--- a/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
+++ b/v2rayN/v2rayN.Desktop/Views/OptionSettingWindow.axaml
@@ -355,14 +355,15 @@
Grid.Column="1"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" />
-
+ TextWrapping="Wrap" />
+
+
labHide2TrayWhenClose.IsVisible = false;
togHide2TrayWhenClose.IsVisible = false;
+ labHide2TrayWhenCloseTip.IsVisible = false;
}
else if (Utils.IsLinux())
{
txbSettingsExceptionTip.IsVisible = false;
panSystemProxyAdvanced.IsVisible = false;
+
+ tbAutoRunTip.IsVisible = false;
}
else if (Utils.IsOSX())
{
txbSettingsExceptionTip.IsVisible = false;
panSystemProxyAdvanced.IsVisible = false;
+ tbAutoRunTip.IsVisible = false;
+
labHide2TrayWhenClose.IsVisible = false;
togHide2TrayWhenClose.IsVisible = false;
+ labHide2TrayWhenCloseTip.IsVisible = false;
}
}