detached a013725

fix(workspace): whitelist focus-worthy script messages

commit
a01372510c2c5dc90e6bd68cbea7adae89a8afcc
author
bamen · · 2025-10-12 08:34 UTC
parent
8a3525b
signature
unsigned
1 file · +7 -6
M internal/app/browser/webview.go +7 -6
@@ -210,9 +210,10 @@ func (app *BrowserApp) attachPaneHandlers(pane *BrowserPane) {
210210 }
211211 }
212212
213-// shouldFocusForScriptMessage filters out bootstrap messages that fire without user
214-// interaction (palette sync, shortcut preload, etc.). Only actionable payloads should
215-// bump the pane back to the front.
213+// shouldFocusForScriptMessage filters script messages and only allows focus handoff
214+// for explicit user-driven actions (navigation, history commands, popup lifecycle).
215+// Background bootstrap messages (palette sync, workspace bridge chatter, etc.) are
216+// ignored so they don't steal focus from the user's active pane.
216217 func shouldFocusForScriptMessage(payload string) bool {
217218 var msg messaging.Message
218219 if err := json.Unmarshal([]byte(payload), &msg); err != nil {
@@ -220,10 +221,10 @@ func shouldFocusForScriptMessage(payload string) bool {
220221 }
221222
222223 switch msg.Type {
223- case "get_color_palettes", "get_search_shortcuts", "request-webview-id", "console-message", "workspace":
224- return false
225- default:
224+ case "navigate", "query", "wails", "history_recent", "history_stats", "history_search", "history_delete", "close-popup":
226225 return true
226+ default:
227+ return false
227228 }
228229 }
229230
@@ -210,9 +210,10 @@ func (app *BrowserApp) attachPaneHandlers(pane *BrowserPane) {
210 }210 }
211 }211 }
212 212
213-// shouldFocusForScriptMessage filters out bootstrap messages that fire without user213+// shouldFocusForScriptMessage filters script messages and only allows focus handoff
214-// interaction (palette sync, shortcut preload, etc.). Only actionable payloads should214+// for explicit user-driven actions (navigation, history commands, popup lifecycle).
215-// bump the pane back to the front.215+// Background bootstrap messages (palette sync, workspace bridge chatter, etc.) are
216+// ignored so they don't steal focus from the user's active pane.
216 func shouldFocusForScriptMessage(payload string) bool {217 func shouldFocusForScriptMessage(payload string) bool {
217 var msg messaging.Message218 var msg messaging.Message
218 if err := json.Unmarshal([]byte(payload), &msg); err != nil {219 if err := json.Unmarshal([]byte(payload), &msg); err != nil {
@@ -220,10 +221,10 @@ func shouldFocusForScriptMessage(payload string) bool {
220 }221 }
221 222
222 switch msg.Type {223 switch msg.Type {
223- case "get_color_palettes", "get_search_shortcuts", "request-webview-id", "console-message", "workspace":224+ case "navigate", "query", "wails", "history_recent", "history_stats", "history_search", "history_delete", "close-popup":
224- return false
225- default:
226 return true225 return true
226+ default:
227+ return false
227 }228 }
228 }229 }
229 230

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close