v0.7.0 — Instant-trigger rules: whole-screen, upload, edge-trigger
What's new — instant-trigger rules
Feedback: the rule editor didn't do what one user pictured — they wanted "give it an image, and the instant the app sees it after launch, it types/clicks, with no count or ordering settings to fuss over." Rather than replacing the existing rule editor, three independent, combinable options were added to it:
- Trigger region is now optional. Leave it unset and the rule scans the whole screen instead of a fixed region — the target can appear anywhere. A screen-cropped region can still opt into whole-screen scanning via a new Scan the whole screen checkbox.
- Template images can come from a file, not just a screen crop. A new Browse for Image File option (native OS file picker) lets you point at an existing image instead of drag-selecting a live region. An uploaded image always scans the whole screen — there's no captured region to fall back to.
- New retrigger mode: "Only trigger once until it disappears and reappears." An alternative to the existing cooldown timer — the rule fires once the instant its target appears, then stays silent until the target disappears and comes back, instead of repeatedly firing every scan tick (or every cooldown interval) while it stays visible.
All three are opt-in and off by default — every existing rule and the existing screen-crop workflow behave exactly as before.
Verified: 6 new automated tests (52 total, all passing) covering the full-screen scan fallback, the appear/disappear edge-triggering logic, and the new image-import WebSocket message — plus manual browser verification against the real backend in both English and 繁體中文, checking that saved rules persist the new fields correctly and the new rule-list badges ("whole screen" / "once per appearance") render correctly.
新功能 — 即時觸發規則
使用者回饋:規則編輯器不是他想像中的樣子 —— 他想要的是「給一張圖片,App 啟動後一看到就直接輸入/點擊,不用煩惱次數或順序設定」。這次沒有另外做一套取代現有編輯器的東西,而是在既有規則編輯器裡新增三個彼此獨立、可以自由組合的選項:
- 觸發範圍現在是可選的。 不設定的話,規則會掃描整個螢幕,而不限於固定區域 —— 目標可以出現在任何地方。框選出來的區域也可以另外勾選新的 Scan the whole screen 核取方塊,改成全螢幕掃描。
- 樣板圖片現在可以來自檔案,不只是螢幕框選。 新增的 Browse for Image File 選項(原生系統選擇檔案視窗)可以直接指向一張既有的圖片,不用即時拖曳框選畫面。上傳的圖片一律掃描整個螢幕 —— 因為沒有對應的框選區域可以退回去用。
- 新的重新觸發模式:「只在目標出現時觸發一次,直到它消失後重新出現才會再觸發」。 這是既有冷卻時間之外的另一種選擇 —— 規則在目標一出現的那一刻就觸發一次,之後保持沉默,直到目標先消失、再重新出現才會再觸發一次,而不是它持續可見時每次掃描(或每個冷卻週期)都重複觸發。
三個都是選用、預設關閉 —— 所有既有規則跟既有的螢幕框選流程,行為完全不受影響。
驗證方式:新增 6 個自動化測試(總計 52 個,全數通過),涵蓋全螢幕掃描的退回邏輯、出現/消失邊緣觸發的判斷邏輯,以及新的圖片匯入 WebSocket 訊息 —— 另外針對真實後端做了瀏覽器手動驗證,中英文都測過,確認存檔的規則正確保留新欄位、規則清單的新徽章(「whole screen」/「整個螢幕」、「once per appearance」/「每次出現觸發一次」)都正確顯示。