891128fec3
- P1b: 点击通知切回 Windows Terminal 原标签(源生成 COM UIAutomation,AOT 友好) - Toast 设为工具窗口(WS_EX_TOOLWINDOW),从任务栏与 Alt+Tab 隐藏 - 投递改为落盘队列 spool + FileSystemWatcher,CLI 毫秒级返回不阻塞 Claude Code - 移除命名管道(PipeServer/PipeClient/PipeMessage),新增 NotificationSpool/SpoolWatcher - NativeAOT 发布配置 + scripts/build.bat(vcvars 自动配置 MSVC 工具链) - .gitattributes 保证 .bat 用 CRLF
56 lines
1.6 KiB
C#
56 lines
1.6 KiB
C#
using System;
|
|
using System.Threading;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Notify.Cli;
|
|
using Notify.Ipc;
|
|
|
|
namespace Notify;
|
|
|
|
internal static class Program
|
|
{
|
|
// 保活期间持有,确保 Host 单例
|
|
private static Mutex? _hostMutex;
|
|
|
|
// Avalonia configuration, don't remove; also used by the visual designer.
|
|
public static AppBuilder BuildAvaloniaApp() =>
|
|
AppBuilder.Configure<App>()
|
|
.UsePlatformDetect()
|
|
.WithInterFont()
|
|
.LogToTrace();
|
|
|
|
[STAThread]
|
|
public static int Main(string[] args)
|
|
{
|
|
var mode = args.Length > 0 ? args[0].ToLowerInvariant() : "host";
|
|
|
|
// 钩子子命令:纯互操作 / IPC,不加载 Avalonia
|
|
return mode switch
|
|
{
|
|
"save" => CliRunner.Save(),
|
|
"notify" => CliRunner.Notify(),
|
|
"input" => CliRunner.Input(),
|
|
"cleanup" => CliRunner.Cleanup(),
|
|
"acttest" => CliRunner.ActTest(args),
|
|
"wttest" => CliRunner.WtTest(args),
|
|
_ => RunHost(args),
|
|
};
|
|
}
|
|
|
|
// 常驻 Host:加载 Avalonia,无主窗口保活,监听命名管道
|
|
private static int RunHost(string[] args)
|
|
{
|
|
_hostMutex = new Mutex(true, IpcConstants.HostMutexName, out var created);
|
|
if (!created)
|
|
{
|
|
// 已有 Host 在跑,本进程退出
|
|
return 0;
|
|
}
|
|
|
|
BuildAvaloniaApp()
|
|
// OnExplicitShutdown = 持续保活:没有主窗口也不会退出,只有显式 Shutdown 才结束
|
|
.StartWithClassicDesktopLifetime(args, ShutdownMode.OnExplicitShutdown);
|
|
return 0;
|
|
}
|
|
}
|