Skip to content

Run the macOS pane chords in the desktop app, brought across from the Swift app once - #160

Merged
yansfil merged 6 commits into
mainfrom
electron-shortcut-bindings
Sep 26, 2026
Merged

yansfil merged 6 commits into
mainfrom
electron-shortcut-bindings

Conversation

@yansfil

@yansfil yansfil commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Related: #149 (데스크톱 앱) 후속 · 사용자 결정 2026-09-26 08:31 KST, 데스크톱 앱이 운영자의 Swift 단축키 설정을 따라야 하느냐는 질문에 "ㅇㅇㅇ 그대로 설정하게 해야지~"

Summary

  • 운영자는 Swift 앱에서 pane 단축키를 바꿔 씁니다(예: 확대 ⇧⌘↩). 데스크톱 앱은 이 설정을 무시해서 ⇧⌘↩가 아무 일도 하지 않았습니다.
  • 데스크톱 앱의 pane 단축키가 core의 macOS 세트 ui_state.shortcut_bindings를 따릅니다. Swift 앱과 같은 세트, 같은 형식(command+shift+return), 같은 규칙입니다.
  • 키 리스너, ⌘/ 시트, 힌트, 네이티브 메뉴 가속키가 모두 이 세트를 읽고, 세트가 바뀌면 메뉴를 다시 만듭니다. Settings > Shortcuts는 데스크톱 앱에서 이 세트를 편집합니다.
  • hided가 Swift 앱의 state.json에서 shortcut_bindings만 한 번 가져옵니다. core의 세트가 비어 있을 때만 가져오고, 가져왔다고 기록해 이후 "기본값 복원"이 다시 덮이지 않습니다.
  • 브라우저는 그대로 browser_shortcut_bindings와 Chrome 규칙을 씁니다. ⌃Tab·⌥Tab 순환이 데스크톱 앱에서 손을 뗄 때 한 번만 커밋되는지도 e2e로 확인했습니다.

The desktop app's Settings > Shortcuts after the Swift import (⇧⌘↩ zoom) and one rebind in Settings (⌥⌘R)

Review

  • 판단해 주세요: 가져오기의 주인을 hided/core로 정했습니다. S10에서 Swift 셸이 지워져도 남는 쪽이고, Swift 앱은 이 옵션을 넘기지 않습니다.
  • 판단해 주세요: 가져오기는 한 방향, 한 번입니다. 이후 Swift 앱에서 바꾼 값은 넘어오지 않고, 데스크톱 앱에서 바꾼 값도 Swift 파일에 쓰지 않습니다.
  • 판단해 주세요: 데스크톱 앱의 거절 규칙은 Swift 앱과 같습니다(⌘ 필수, 인쇄 가능한 키 하나나 Return, ⌘Q·⌘H·⌘M·⌘S·⌘W·⌘,·⌘1-9 불가). Chrome이 가져가는 ⌘⇧W 같은 키는 데스크톱 앱에서는 쓸 수 있습니다.
  • 조심해서 볼 파일: herdr-core/src/runtime.rs - runtime mutex: 가져오기는 Runtime::new에서 mutex로 감싸기 전에 한 번 읽고 동기 저장합니다(8 MiB 읽기 상한).
  • 조심해서 볼 파일: herdr-core/src/runtime/events.rs - failure path: ui_state_update가 macOS 세트에도 16개·64자 상한을 적용합니다. Swift 셸도 같은 이벤트로 이 세트를 보냅니다.
  • 조심해서 볼 파일: desktop/src/main/host.ts, desktop/src/preload/index.ts - bridge: 렌더러→메인 채널 reportBindings가 새로 생겼습니다. 이 창의 daemon origin 페이지에서 온 짧은 문자열 맵만 받습니다.
  • 조심해서 볼 파일: web/src/keyboard.ts - high-frequency path: store 알림마다 참조 비교로 끝나고, 세트 내용이 바뀔 때만 직렬화하고 전송합니다.

Evidence

  • 확인한 것: _electron smoke 7개(기존 5 + 새 2), 격리된 HOME·hided·Herdr: 가짜 Swift state.json(toggle_zoom = ⇧⌘↩)이 넘어와 메뉴 가속키가 Shift+Command+Return이 됩니다.
  • 확인한 것: 같은 smoke에서 ⇧⌘↩가 toggle_zoom을 정확히 1회 보내 pane이 확대되고, 이전 기본값 ⌥⌘↩는 아무것도 보내지 않으며, ⌘/ 시트가 ⇧⌘↩를 보여 줍니다.
  • 확인한 것: Settings에서 Split right를 ⌥⌘R로 바꾸면 shortcut_bindings에 command+option+r로 저장되고, browser_shortcut_bindings는 비어 있는 그대로이며, 메뉴가 Alt+Command+R로 다시 만들어집니다.
  • 확인한 것: ⌃를 누른 채 Tab 두 번 → 놓을 때 두 칸 뒤 탭으로 focus_tab 정확히 1회, ⌃⇧Tab은 뒤로 한 칸. ⌥Tab·⌥⇧Tab도 프로젝트 사이에서 focus_checkout 정확히 1회.
  • 확인한 것: core 가져오기 테스트 5개(한 번만, 복원 유지, 편집한 세트 보존, 파일 없음 후 재시도, 읽을 수 없는 파일 진단)와 persistence 테스트, cargo test/lint 전체, swift 549개.
  • 확인한 것: web 단위 326개(Swift 텍스트 형식, 운영자 세트, Swift 거절 규칙, 호스트별 세트 분리)와 web e2e 60개 전체, desktop 단위 25개(메뉴가 보고된 세트를 보여 줌, 잘못된 보고 거절).
  • 확인하지 못한 것: 실제 키 입력. Playwright 입력은 NSMenu에 닿지 않고 이 Mac에는 손쉬운 사용 권한이 없어, 가속키 이중 실행 여부는 #149와 같이 미확인입니다.
  • 확인하지 못한 것: 순환 smoke가 개발 중 한 번 ⌃⇧Tab 단계에서 실패했습니다(Shift가 빠진 듯 한 칸 앞으로 선택됨). 이후 단독 6회, 파일 전체 2회, 최종 1회 통과했고 원인은 모릅니다.
  • 확인하지 못한 것: 운영자의 실제 state.json으로는 돌리지 않았습니다. 같은 내용을 격리된 HOME에 써서 확인했습니다.
Verification record
  • Base 9c7c726 (main, Add the desktop app: the web shell in its own window, attached through hide connect #149) → head 958af62, 브랜치 electron-shortcut-bindings. 958af62는 테스트 fixture의 /Users/... 경로를 /tmp/project로 바꾼 것뿐입니다(repository invariants의 workstation identity 검사). 이 변경을 덮는 sasu 실행은 없습니다(PRD 없음, 사용자 결정이 근거).
  • Suites on the final tree: scripts/verify-cargo.sh test 0, scripts/verify-cargo.sh lint 0, scripts/verify-swift.sh test 0 (549), web typecheck/lint/unit 0 (326), web e2e 0 (60), desktop typecheck/lint/unit 0 (25), desktop e2e 0 (7).
  • Reviews (native subagents, 03255c6):
    • Fidelity: Fix now 없음. Follow-up: Swift의 ⌥1-9 예약은 옮기지 않았으나 ⌘ 필수 규칙이 이미 거절함; 읽을 수 없는 Swift 파일은 매 실행 다시 읽고 진단함(의도); 상한 상수 중복.
    • Code: Fix now 없음. mutex 밖 I/O, 호스트 간 덮어쓰기, bridge 발신자 검증, 알림당 비용 확인. Follow-up: 상한 상수 중복(e07a7f8에서 서로를 가리키는 주석 추가), 기존 브라우저 세트가 데스크톱 편집에서 살아남는지 채운 세트로 보는 e2e, ui_state_update에서 shortcut_bindings를 빼면 세트가 지워지는 기존 계약(다른 필드와 같은 패턴).
  • beb408b에서 Shortcuts 탭 부제의 "this browser host" 문구를 호스트 중립으로 바꿨습니다(스크린샷 확인 중 발견).
  • Follow-up improvements: 실제 키 입력 자동화(손쉬운 사용 권한이 있는 QA 호스트), ⌃⇧Tab 단발 실패 원인, 위 리뷰 Follow-up.

hided passes the Swift app's state file as shortcut_import_path, and the
core adopts only its shortcut_bindings while its own set is empty,
recording shortcut_bindings_imported so a later reset to defaults stays a
reset. A missing file imports nothing and a later launch may still import;
an unreadable or oversized one is a diagnostic. The core owns the import
because it outlives the Swift shell. The macOS set now takes the same size
cap as the browser set on ui_state_update.
In Electron the window listener, the shortcut sheet, hints and Settings
resolve pane chords through ui_state.shortcut_bindings, the set the desktop
app shares with the Swift app, in its text form and command names and
under its rules; Settings > Shortcuts edits that set. The shell reports the
set over the bridge and the main process, which accepts it only from its
window's page on the daemon origin, rebuilds the app menu when its chords
change. The browser keeps browser_shortcut_bindings.
…p app

An _electron smoke imports a Swift set with toggle_zoom on shift+command+return,
zooms once with it, finds it in the sheet and the menu, and rebinds a chord
in Settings. A second one walks two back with control-tab and option-tab,
forward and with shift backward, and asserts one focus on the release.
The tab edits the running host's own set, so the subtitle the desktop app
showed, which named the browser host, was wrong there.
The core and the desktop host check a stored set against the same 16-entry,
64-character caps across the Rust and TypeScript boundary.
The repository refuses a /Users path in tracked files.
@yansfil
yansfil merged commit 8c03d40 into main Sep 26, 2026
7 checks passed
@yansfil
yansfil deleted the electron-shortcut-bindings branch September 26, 2026 02:44
yansfil added a commit that referenced this pull request Sep 26, 2026
Brings in the ⌘K palette (#161), weekly usage (#162) and the desktop
app's macOS pane chords (#160).

The desktop bridge keeps both sides: `reportBindings` from #160 beside
`browser`, the channels of both, and the e2e's bridge keys list all
four. The bindings listener now uses the host's one shell-frame check,
`fromShell`, which the browser channels already use. main's new
shortcut import test no longer names the removed `chromux_enabled`.
The contract carries both sides and web/src/generated/hided-ws.ts is
the generator's output; the design library holds both parents' boards,
the browser toolbars sheet from this branch and the weekly usage sheet
from main.
yansfil added a commit that referenced this pull request Sep 26, 2026
Closes #155

## Summary

웹 페이지를 Herdr browser pane(chromux screencast) 대신 View area의 display로
엽니다.
core는 `DisplayKind::Browser`로 어떤 페이지가 어디 있는지를, desktop 앱 main process는
display마다 하나인 `WebContentsView`로 페이지 자체를 소유합니다.
여는 길은 `hide browser open <url|path>`, Explorer의 Open in Browser(HTML
파일), 페이지의 새 창, toolbar 주소창입니다.
⌘K, 메뉴, dialog, 탭 드래그가 페이지를 덮으면 페이지를 캡처한 still로 바꿔 overlay가 위에 그려지고, 일반
브라우저 탭에서는 조용한 안내와 Open in browser만 보입니다.
chromux 경로(`plugins/browser`, core `chromux.rs`/`pane_content.rs`, Swift
`Browser*.swift`, `BrowserPaneOpener`)는 지웠습니다.

![두 View area에 나란히 뜬 native 페이지, 페이지 안 입력란에 한글이 들어간
상태](https://github.com/yansfil/pr-assets/blob/main/modakbul-gongbang-hide/quick-155-browser-display/browser-two-areas.png?raw=true)
![⌘K palette가 still로 얼린 페이지 위에 그려진
상태](https://github.com/yansfil/pr-assets/blob/main/modakbul-gongbang-hide/quick-155-browser-display/browser-palette-frozen.png?raw=true)
![로드 실패: 주소와 Chromium 사유,
Reload](https://github.com/yansfil/pr-assets/blob/main/modakbul-gongbang-hide/quick-155-browser-display/browser-load-failed.png?raw=true)
![일반 브라우저 탭의 안내와 Open in
browser](https://github.com/yansfil/pr-assets/blob/main/modakbul-gongbang-hide/quick-155-browser-display/browser-plain-tab.png?raw=true)

## Review

- **판단해 주세요**: toolbar와 상태 보드(`p0Do2`, Browser file diff toolbars)는 사람
승인 없이 그렸습니다. 모양과 문구를 봐 주세요.
- **판단해 주세요**: 다운로드는 Chromium 기본 동작(Downloads에 저장, 로그
`browser.download`만)입니다. 확인 창이나 위치 제한이 필요한지.
- **판단해 주세요**: checkout 안 `file:` 페이지가 제 링크로 checkout 밖 파일로 이동하면 그
view에는 보이고, core 기록만 boundary에서 거절됩니다(재실행 시 마지막 허용 주소). 페이지 이동도 막을지.
- **판단해 주세요**: 페이지에 포커스가 있을 때 창 단축키는 앱 메뉴가 가진 것만 동작합니다. 페이지 컨텍스트 메뉴는
없습니다.
- **조심해서 볼 파일**: `desktop/src/main/browser.ts`, `browserSync.ts` -
failure path와 수명: 페이지 생성/숨김/파괴, 12개 live cap, IPC 신뢰 검사.
- **조심해서 볼 파일**: `hided/src/server.rs` `browser_url`,
`hided/src/file_url.rs` - 경계: `file:` URL을 decode해 checkout root 검사 후
검사한 경로로 다시 씀.
- **조심해서 볼 파일**: `herdr-core/src/runtime/view_areas.rs` - runtime mutex
안의 일: open/navigate/state 기록, receipt 8개 cap, I/O 없음.
- **조심해서 볼 파일**: `herdr-core/src/model.rs` - snapshot wire: display의
`url`/`title`/`load`, `status.browser_opens`, `status.chromux` 삭제.
- **질문**: `hide browser open`은 실패 시 JSON을 찍고 exit 2입니다(기존 `hide` CLI
관례). agent가 쓰기에 이게 맞는지.

## Evidence

- **확인한 것**: `desktop/e2e/browser.spec.ts`가 직접 띄운 desktop 앱과 private
hided, 격리된 Herdr(`HERDR_SOCKET_PATH`)에서 한 흐름을 끝까지 돕니다.
- **확인한 것**: CLI `--pane`으로 열기, native view bounds = slot bounds, 한글
`insertText`, split과 창 resize에서 renderer pid와 페이지 마커 유지.
- **확인한 것**: ⌘K 동안 보이는 view < 2와 still 표시, Escape로 복귀, 주소 입력과 Back,
`window.open`이 새 display(창 1개 유지).
- **확인한 것**: `127.0.0.1:1` 실패 안내와 Reload, Explorer의 `리포트 1.html` 열기,
checkout 밖 파일 `outside_checkout` 거절.
- **확인한 것**: display 닫으면 renderer 종료, 재실행 후 Page A 복원, 일반 브라우저 탭 안내. 캡처는
창 id로 찍었고 운영자 앱은 건드리지 않았습니다.
- **확인한 것**: cargo fmt/clippy와 1277개 테스트, Swift 533개, web 329개, desktop
29개, design contract, workstation identity 등 정적 gate.
- **확인한 것**: Code, Fidelity, Security 리뷰 모두 Fix now 없음. follow-up 중 web
상태 map 정리와 stale report 진단은 이 PR에서 반영했습니다.
- **확인한 것**: head `3f6b1ee6`에서 PR check 7개(`verify` run 36211315961의 job
6개와 Design contract)가 모두 통과했고, runner에서 desktop e2e 6개가 통과했습니다.
- **확인한 것**: 직전 run 36209912790은 runner 화면이 1024pt라 View area가 좁아 Split
right가 비활성으로 떨어졌습니다. spec이 창을 1024x640으로 고정해 확인합니다.
- **확인한 것**: split과 resize 단계는 Views only에서 Explorer를 숨긴 채 돕니다. 로컬
1024x640에서 실패를 먼저 재현한 뒤 browser spec 3/3, desktop e2e 6/6을 통과시켰습니다.
- **확인한 것**: 같은 조사에서 제품 버그를 하나 고쳤습니다. 주소창에 포커스한 뒤 한 프레임 안에 입력하면 새 주소가 기존
주소 뒤에 붙었는데, 이제 전체 주소를 같은 commit에서 선택합니다.
- **확인한 것**: #160, #161, #162가 들어온 main을 merge commit `e4cffeb3`로 합쳤습니다.
충돌은 desktop bridge(`reportBindings`와 `browser`를 함께 유지), channel,
preload, e2e bridge 키, ARCHITECTURE 한 줄이었습니다.
- **확인한 것**: main의 새 테스트가 지워진 `chromux_enabled`를 쓰고 있어 고쳤습니다.
`hided-ws.ts`는 generator 출력과 같고, 디자인 라이브러리는 두 부모의 보드(`p0Do2`, weekly
usage)를 모두 가집니다.
- **확인한 것**: merge 뒤 로컬에서 cargo lint와 테스트 1283개, web unit 346개, web e2e
62/62, desktop unit 31개, desktop e2e 8/8(#160의 keys spec 포함)이 통과했습니다.
- **확인한 것**: merge head `e4cffeb3`에서 PR check 7개(`verify` run
36213739656의 job 6개와 Design contract)가 모두 통과했고, runner에서 web e2e 63개와
desktop e2e 8개가 통과했습니다.
- **확인한 것**: #163이 들어온 main(`83321656`)을 merge commit `8a2ce77d`로 다시
합쳤습니다(충돌 없음, desktop/core 변경 없음). 로컬 web typecheck, lint, unit 352개, e2e
63/63이 통과했습니다.
- **확인한 것**: head `8a2ce77d`에서 PR check 7개(`verify` run 36215350833의 job
6개와 Design contract)가 모두 통과했고, runner에서 web e2e 63개와 desktop e2e 8개가
통과했습니다.
- **확인하지 못한 것**: 실제 macOS 한글 IME 조합(후보창, 조합 중 백스페이스)은 `insertText`로만
확인했습니다.
- **확인하지 못한 것**: 설치된 앱에서의 동작과 원격 device checkout의 Open in Browser 비활성
상태는 코드와 단위 테스트로만 확인했습니다.
- **확인하지 못한 것**: desktop e2e의 `lifetime` 테스트가 재실행 중 한 번 firstWindow
timeout으로 실패했고 재시도 3번은 통과했습니다(이 변경 전부터 있는 흐름).
- **생성물**: `design/hide-ui.lib.pen`의 `p0Do2` 시트 하나만 바뀌었습니다(Pen 헤드리스로
생성).

## Breaking change

- 이 빌드가 `workspace-views.json`에 browser display를 저장한 뒤 이전 빌드로 되돌리면, 이전
빌드는 그 파일을 읽지 못해 옆으로 치우고 Main에서 시작합니다.

**AI tooling**: 대부분 AI 도구. e2e 스크린샷, 리뷰 결과, 문서와 코드의 대응을 손으로 대조했습니다.
yansfil added a commit that referenced this pull request Oct 29, 2026
…back runs (#1835)

Closes with-hide/hide-private#127

## Summary

- Settings에서 언어를 고른 직후 글자 크기 slider에 End를 누르는 desktop 테스트 3개가 가끔
실패했습니다(#127: 17 대신 13).
- 원인: 닫히는 언어 Select가 키보드를 자기 버튼에 돌려주는 일을 타이머로 미룹니다. 부하가 걸리면 그 타이머가 테스트의
`slider.focus()` 뒤에 돌아 End가 버튼으로 갑니다.
- 제품 수정: Select가 닫힌 뒤 다른 컨트롤이 이미 키보드를 가져갔다면, 늦게 도는 반환이 그 focus를 빼앗지
않습니다. 아무것도 가져가지 않았으면 예전처럼 Select 버튼으로 돌아갑니다. 메뉴와 대화상자가 쓰는 같은
보호(`useReturnFocus`)를 Select도 거칩니다(`docs/UI_BEHAVIOR.md`: a delayed
focus return from any layer leaves a newer control or layer's focus in
place).
- 테스트: 세 테스트는 그 반환이 끝난 상태(언어 버튼에 focus)를 기다린 뒤 키보드를 옮깁니다. 대기 시간, retry,
lane은 그대로입니다.

스크린샷 없음: 키보드 focus가 어디로 가는지만 바뀌고 그려지는 화면은 같습니다.

이 묶음(mission-13 flaky2-mac-viewarea)의 10개 이슈 처리, 10-23~10-29 macOS
desktop CI 기록 304회 기준:

| 이슈 | 테스트 | 처리 |
| --- | --- | --- |
| #127 | pane-move 글자 크기 | 이 PR (304회 중 3회 재발) |
| #157 | new-tab ⌘T/⌘W | #1650이 고침, 닫음 (마지막 실패 커밋은 #1650 이전) |
| #177 | group-tabs 새 터미널 | #1493이 고침, 닫음 |
| #178 | new-terminal | macOS 서명은 #1493이 고침; 10-28 Windows 서명이 남아 열어 둠 |
| #249 #182 #175 #231 | lane drag, owl, area cycle, page note | 0회 재발,
고친 커밋 미확인: 원인 후보만 코멘트, 범위 밖 |
| #129 | close-policy ⌘W | 1회: 후보 앱 main process가 멈춤(teardown도 실패), 범위 밖
|
| #160 | agent-logo-peek | herdr fixture의 CLI 30 s 타임아웃(다른 spec에도 같은
서명), fixture 작업으로 넘김 |

의심했던 "data-pane-view 두 개"(#178)는 제품 결함이었습니다: 빈 그룹에서 연 새 터미널이 잠깐
Ungrouped에 놓여 두 pane이 같이 그려졌고, #1493이 core에서 고쳤습니다.

## Review

- **조심해서 볼 파일**: `web/src/components/ui/select.tsx` - 모든 Select가 닫힐 때의
focus 반환 경로입니다. Select root가 열림 상태와 trigger를 context로 내려 주고, content는
`useReturnFocus(open, { target: trigger })`로 반환합니다. 호출자가
`onCloseAutoFocus`에서 `preventDefault`하면(`AddProjectDialog`의 host 변경) 그쪽이
이깁니다.
- **조심해서 볼 파일**: `web/src/components/ui/layer.ts` - 모든 layer의 늦은 반환 보호.
반환 대상(trigger)을 감싼 surface가 focus를 가진 것은 "새 컨트롤"로 보지 않습니다. 고른 항목이 사라질 때
Settings 대화상자의 focus trap이 키보드를 대화상자 자체로 옮기는데, 첫 수정은 이것을 새 focus로 읽어 정상
닫힘에서도 trigger로 돌려주지 않았습니다(b72ba42 CI의 세 e2e 실패).
- **조심해서 볼 파일**: `desktop/e2e/pane-move.spec.ts`, `restoration.spec.ts`,
`project-settings.spec.ts` - 같은 원인을 가진 세 곳에 같은 대기를 넣었습니다.

## Evidence

- **확인한 것**: macOS desktop CI 기록 609개 report(294개 커밋)에서 이슈별 재발을 셈. #127의
3회 모두 End 뒤 13 그대로.
- **확인한 것**: 회귀 테스트 `web/src/components/ui/select.test.tsx`는 Settings처럼
대화상자 안의 실제 Select로 두 순서를 고정합니다. "고름 -> 새 컨트롤 focus -> 늦은 반환"은 수정 전
Select에서 실패(focus가 Select 버튼으로 감)하고 수정 후 통과합니다. "고름 -> 늦은 반환 -> trigger
focus"(정상 닫힘)는 `layer.ts` 수정 없이 실패(focus가 대화상자에 남음, CI e2e와 같은 증상)하고 수정
후 통과합니다. 테스트는 고정 대기 없이 fake timer로 Radix의 늦은 반환 타이머를 명시 실행하고, 그 전후에
`onCloseAutoFocus` 호출과 focus를 단언합니다. root는 `afterEach`가 정리합니다.
- **확인한 것**: `verify-web.sh` 전체 통과(web test 2251, desktop test 294,
lint, typecheck, build).
- **확인한 것**: `verify-web.sh desktop lint`, `desktop typecheck` 통과.
- **확인하지 못한 것**: desktop e2e 로컬 실행. 디스크가 5 GiB라 debug 빌드를 하지 않고, 이 PR의
macOS desktop job과 같은 커밋 반복으로 확인합니다.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant