feat: 关闭窗口后留在托盘,右键可显示或退出

This commit is contained in:
2026-11-19 17:32:08 +08:00
parent fe8d02f0f7
commit d0bd4166c7
6 changed files with 200 additions and 25 deletions
+21
View File
@@ -495,3 +495,24 @@ export component MainWindow inherits Window {
}
}
}
// 托盘图标。右键菜单在图标上,不另开窗口。
export component AppTray inherits SystemTrayIcon {
in property <bool> window-open;
callback toggle();
callback quit();
tooltip: "打卡";
icon: @image-url("tray.png");
Menu {
MenuItem {
title: root.window-open ? "隐藏界面" : "显示界面";
activated => { root.toggle(); }
}
MenuItem {
title: "退出";
activated => { root.quit(); }
}
}
}