desktop: clicking a Windows notification does not restore or focus the window
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 84/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- electron, typescript
- Lĩnh vực
- desktop
Hướng nghiên cứu
Bắt đầu từ trình xử lý sự kiện nhấp chuông thông báo của renderer, sau đó lần theo WindowShow và WindowSetFocus đến các lệnh gọi BrowserWindow trong tiến trình chính. Tìm helper liên kết sâu hiện có gọi restore(), show() và focus(), rồi tái sử dụng hoặc đồng bộ hành vi của helper đó cho các thao tác nhấp chuông thông báo. Kiểm tra các trường hợp cửa sổ bị thu nhỏ và cửa sổ chạy nền trên Windows, sau đó chạy các bài kiểm thử desktop liên quan hoặc tái hiện thủ công luồng từ toast đến focus.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Summary
On Windows, clicking the desktop notification that fires when an agent response is ready (or an error occurs) does not bring the OpenCode window to the front. If the window is minimized it stays minimized; if it is only behind other windows it usually stays behind. The notification click handler only calls showWindow() + setWindowFocus(), which map to BrowserWindow.show() + BrowserWindow.focus(). Neither of those restores a minimized window, and show() is a no-op for an already-visible window, so nothing brings the window forward.
Environment
- opencode version:
opencode v2.0.32(desktop app,OpenCode.exeFileVersion 2.0.32) - OS: Windows 11 Enterprise LTSC,
Microsoft Windows NT 10.0.26100.0(win32 x64) - Terminal: N/A (desktop app)
- Shell:
C:\Windows\system32\cmd.exe - Install/channel: release build installed under
%LOCALAPPDATA%\Programs\@opencode-aidesktop - Runtime: Electron 44.4.5 (Chrome 152.0.7977.130)
- Active plugins: none
Reproduction
- Start a task in the desktop app and switch to another app (or minimize OpenCode) so the OpenCode window is not focused.
- Wait for the "agent response ready" notification.
- Click the notification in the Windows toast / Action Center.
- Notification disappears and the correct session is selected, but the OpenCode window is not brought forward — it stays minimized or stays behind the other windows.
Expected Behavior
Clicking the notification should restore (if minimized) and focus/raise the OpenCode window, showing the conversation the notification refers to.
Actual Behavior
The notification is dismissed and the session is switched, but the window either stays minimized or stays behind other windows.
Additional Context
The notification click path
Renderer (notification is created and clicked here):
function fde(e){return async(t,n,r)=>{
if(await e.getWindowFocused().catch(()=>document.hasFocus()))return;
let i=new Notification(t,{body:n??``,icon:`https://opencode.ai/favicon-96x96-v3.png`,silent:!0});
i.onclick=()=>{e.showWindow(),e.setWindowFocus(),r?.(),i.close()}
}}
Main process handlers:
WindowSetFocus:(t,n)=>I(()=>L.fromWebContents(Wp(e,n))?.focus()),
WindowShow:(t,n)=>I(()=>L.fromWebContents(Wp(e,n))?.show()),
So clicking a notification ends up as win.show(); win.focus(). There is no restore().
The same file already has the correct pattern for deep links
l=e=>{e&&(e.isMinimized()&&e.restore(),e.show(),e.focus())}
This confirms the authors know show() + focus() is not enough for a minimized window; the notification path just doesn't use it.
Verified on Windows 11 (Win32 P/Invoke against the live OpenCode main window)
Electron's BrowserWindow.focus() is SetForegroundWindow on Windows, and show() early-returns for a visible window, so:
opencode hwnd=79169172 IsIconic(iconic)=True
SetForegroundWindow(hwnd) -> True, IsIconic after = True # foreground set, window NOT restored
ShowWindow(hwnd, SW_RESTORE) -> True, IsIconic after = False # this is what actually restores it
Control test (window not minimized): a background process calling SetForegroundWindow on the OpenCode window correctly raises it, so the system's foreground lock is not the blocker here (ForegroundLockTimeout is 0 on this machine).
Suggested fix
Restore before showing/focusing in the notification path, e.g. reuse the deep-link helper:
l = win => { if (win.isMinimized()) win.restore(); win.show(); win.focus() }
If notification activation is sometimes not delivered to the renderer at all on Windows (this is the suspicion for the "visible but behind" case), consider emitting the notification from the main process with Electron's Notification (main-process click is reliable on Windows) and running the same restore/show/focus sequence there before telling the renderer to select the session.
Related
- #18133 — "Desktop: Clicking Windows notification doesn't open conversation window" (same symptom; auto-closed as not planned by the stale bot)
- #11786 — "Better notifications on Desktop" (Windows deeplink / protocol activation tracking; closed)
- Ngôn ngữ chính
- TypeScript
- Star
- 215k
- Fork
- 28.9k
- Merge trung bình
- 4 giờ 21 phút
- Pull request đã merge (30 ngày)
- 476
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của anomalyco/opencode
-
desktop: maximized state lost when saved bounds exceed the displayCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anomalyco/opencode#58247 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
anomalyco/opencode#58216 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
pending close triaging
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
anomalyco/opencode#58181 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Opencde Github Actions Bot Cannot InstallCó thể đã có người làm @zzz-creator đã nhận 1 ngày trước. Đang mởreproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
anomalyco/opencode#57911 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
anomalyco/opencode#57855 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của anomalyco/opencode
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
braintrustdata/braintrust-sdk-javascript#2659 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
body-parser 2.3.0 in the published ai-dial-chat-bff image is vulnerable (CVE-2026-111181, HIGH)Có thể đã có người làm @illya-havsiyevych đã nhận hôm nay. Đang mởbug
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 87/100
epam/ai-dial-chat#9566 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
はさみアイコンを修正するĐang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
resource.reload() while params is in error switches the resource to 'idle' instead of retryingĐang mởarea: core
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày