fcdb1df71d
leo 真機測出四個問題,每個都查到真兇後才動手: ## ① 托盤 icon 變方塊 真兇:我塞 1024x1024 的**彩色 app icon** 當 template icon。 macOS 選單列規格是 **16-22pt、純黑+alpha**(由系統依深淺色自動上色) ⇒ 彩色大圖被縮成一坨方塊是必然。 修:用 CIS 的 chevron-double.svg 渲成 44x44 純黑 template icon。 ## ②③ 右鍵沒選單/第一次能開之後就不再跳 真兇(energye/systray 原始碼註解白紙黑字寫著): 「該方法主動調用後 如果托盤菜單已創建則添加進去, **之後鼠標事件失效**」 ⇒ 只要用 AddMenuItem 建了選單,SetOnClick/SetOnRClick **全部失效**。 修:SetMenuNil() 移除選單讓滑鼠事件生效,右鍵時自己 ShowMenu()。 另外 ShowWindow 只呼叫 WindowShow 對「已開但被蓋住」無效 ⇒ 補 Unminimise + AlwaysOnTop 閃一下搶焦點。 ## ④ 只能用強制結束 真兇:Wails 的 loop 不理 SIGTERM,且 collector 是我們自己 Start 的子行程 ⇒ 主程式被殺後**子行程變孤兒繼續跑**。 實測(機械驗證,非目視): 修前 kill -TERM → App 沒退、collector 孤兒還在 修後 kill -TERM → App 正常退出 ✅、collector 一起收掉 ✅、殘留 0 修:installSignalHandler 收 TERM/INT → stopSupervisor() → waitCollectorGone(3s) 確認子行程真的不見(逾時補一刀)→ 才 os.Exit。 「關了卻還在同步」比沒關更糟。 實跑驗證:App 活著 pid 88466、自己拉起 collector、crash 0、兩支機械閘全過。
README
About
This is the official Wails Vanilla template.
You can configure the project by editing wails.json. More information about the project settings can be found
here: https://wails.io/docs/reference/project-config
Live Development
To run in live development mode, run wails dev in the project directory. This will run a Vite development
server that will provide very fast hot reload of your frontend changes. If you want to develop in a browser
and have access to your Go methods, there is also a dev server that runs on http://localhost:34115. Connect
to this in your browser, and you can call your Go code from devtools.
Building
To build a redistributable, production mode package, use wails build.