mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 20:42:10 +00:00
Added parameter MacOSShowInDock to control whether MacOS platform app is displayed in the Dock
https://github.com/2dust/v2rayN/issues/7465
This commit is contained in:
parent
f947f63e6d
commit
0d74452c6c
3 changed files with 28 additions and 18 deletions
|
@ -105,6 +105,7 @@ public class UIItem
|
||||||
public bool Hide2TrayWhenClose { get; set; }
|
public bool Hide2TrayWhenClose { get; set; }
|
||||||
public List<ColumnItem> MainColumnItem { get; set; }
|
public List<ColumnItem> MainColumnItem { get; set; }
|
||||||
public bool ShowInTaskbar { get; set; }
|
public bool ShowInTaskbar { get; set; }
|
||||||
|
public bool MacOSShowInDock { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
|
|
@ -11,11 +11,6 @@ public partial class App : Application
|
||||||
{
|
{
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
if (!AppHandler.Instance.InitApp())
|
|
||||||
{
|
|
||||||
Environment.Exit(0);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
AvaloniaXamlLoader.Load(this);
|
AvaloniaXamlLoader.Load(this);
|
||||||
|
|
||||||
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
|
||||||
|
|
|
@ -14,13 +14,17 @@ internal class Program
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args)
|
public static void Main(string[] args)
|
||||||
{
|
{
|
||||||
OnStartup(args);
|
if (OnStartup(args) == false)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BuildAvaloniaApp()
|
BuildAvaloniaApp()
|
||||||
.StartWithClassicDesktopLifetime(args);
|
.StartWithClassicDesktopLifetime(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void OnStartup(string[]? Args)
|
private static bool OnStartup(string[]? Args)
|
||||||
{
|
{
|
||||||
if (Utils.IsWindows())
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
|
@ -30,8 +34,7 @@ internal class Program
|
||||||
if (!rebootas && !bCreatedNew)
|
if (!rebootas && !bCreatedNew)
|
||||||
{
|
{
|
||||||
ProgramStarted.Set();
|
ProgramStarted.Set();
|
||||||
Environment.Exit(0);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -39,19 +42,30 @@ internal class Program
|
||||||
_ = new Mutex(true, "v2rayN", out var bOnlyOneInstance);
|
_ = new Mutex(true, "v2rayN", out var bOnlyOneInstance);
|
||||||
if (!bOnlyOneInstance)
|
if (!bOnlyOneInstance)
|
||||||
{
|
{
|
||||||
Environment.Exit(0);
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!AppHandler.Instance.InitApp())
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
=> AppBuilder.Configure<App>()
|
{
|
||||||
.UsePlatformDetect()
|
return AppBuilder.Configure<App>()
|
||||||
//.WithInterFont()
|
.UsePlatformDetect()
|
||||||
.WithFontByDefault()
|
//.WithInterFont()
|
||||||
.LogToTrace()
|
.WithFontByDefault()
|
||||||
.UseReactiveUI()
|
.LogToTrace()
|
||||||
.With(new MacOSPlatformOptions { ShowInDock = false });
|
#if OS_OSX
|
||||||
|
.UseReactiveUI()
|
||||||
|
.With(new MacOSPlatformOptions { ShowInDock = AppHandler.Instance.Config.UiItem.MacOSShowInDock });
|
||||||
|
#else
|
||||||
|
.UseReactiveUI();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue