feat: 关闭窗口后留在托盘,右键可显示或退出
This commit is contained in:
@@ -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(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user