wip(daemon/tray): 保底 07-21 fyne 托盤進度(單資料夾版;情境1改造前的基線)

This commit is contained in:
2026-07-24 11:52:05 +08:00
parent 9e356e3d99
commit 44a9aeddc4
3 changed files with 695 additions and 6 deletions
+7 -6
View File
@@ -16,6 +16,7 @@
package main
import (
neturl "net/url"
"encoding/json"
"fmt"
"os"
@@ -28,7 +29,6 @@ import (
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/dialog"
"fyne.io/fyne/v2/driver/desktop"
"fyne.io/fyne/v2/storage"
"fyne.io/fyne/v2/theme"
"fyne.io/fyne/v2/widget"
)
@@ -136,7 +136,8 @@ func main() {
})
openFolderItem := fyne.NewMenuItem("打開資料夾", func() {
if u, err := storage.ParseURI("file://" + cfg.WatchFolder); err == nil {
// fyne 的 App.OpenURL 吃 *url.URL(非 fyne.URI)——2026-07-21 真機 build 實測修正
if u, err := neturl.Parse("file://" + cfg.WatchFolder); err == nil {
_ = a.OpenURL(u)
}
})
@@ -175,10 +176,10 @@ func main() {
// 狀態變更 → 刷新 tray 文案(回呼在 supervisor goroutine,切回 UI thread
sup.SetOnChange(func(s supervisor.Status) {
fyne.Do(func() {
statusItem.Label = "狀態:" + humanStatus(s)
refreshTray()
})
// 此版 fyne 無 fyne.Dotray menu label 更新直接做即可
// 2026-07-21 真機 build 實測修正)
statusItem.Label = "狀態:" + humanStatus(s)
refreshTray()
})
// 設定視窗內容:說明現況 + 選資料夾按鈕(給會開窗的人;不會開的人靠 tray 選單)