feat(notch): coexist with other notch apps (yield notch when idle) - #283
feat(notch): coexist with other notch apps (yield notch when idle)#283Kelei0215 wants to merge 2 commits into
Conversation
erha19
left a comment
There was a problem hiding this comment.
[HIGH] PingIsland/Core/NotchViewModel.swift:587-647
The new coexistence guard only blocks the direct click-open branch at line 589, but a normal click inside detachmentTriggerScreenRect still starts closed-state detachment tracking at lines 587-588 and then reopens the notch on mouseUp at lines 643-647. Because detachmentTriggerScreenRect == closedScreenRect, closed-notch clicks still reopen Ping Island in coexistence mode, which breaks the promised “停止点击展开 / 交给其他刘海工具”. Please gate the closed-state detachment tap path as well, or disable closed detachment tracking while coexistence mode is active and the docked window is yielded.
[MEDIUM] PingIsland/Core/NotchViewModel.swift:377-403, PingIsland/UI/Window/NotchWindowController.swift:59-137
shouldHideWindowPresentation now depends on AppSettings.coexistWithOtherNotchApps, but NotchViewModel never subscribes to $coexistWithOtherNotchApps, and the window controller only refreshes presentation when one of the view-model publishers fires. Toggling the new setting while the notch is closed will therefore not immediately orderOut or restore the docked window until some unrelated state change happens. That means the advertised “开启后空闲时让出刘海” behavior is not reliably applied at toggle time. Please add a settings subscription that triggers a presentation refresh and cover it with a regression test.
|
补充一个与当前 另外建议为这次新行为补回归测试,至少覆盖:共存开启时关闭态 click/long-press 不打开或分离、attention 仍能打开、运行中开关会立即 orderOut/orderFront。现有 |
Add a Settings toggle (default off) that lets Ping Island yield the notch to other notch utilities (e.g. NotchNest) while idle, so two notch apps can coexist instead of fighting over hover/click: - Suppress hover-wake: do not start the auto-expand hover timer while coexistence is on, so hovering the notch no longer greedily opens Ping Island. - Suppress click-to-open on the closed notch while coexistence is on, so notch clicks reach the other app. - Fully hide (orderOut) the docked notch window when closed, so it no longer visually occludes other notch apps sitting below it at level .mainMenu + 3. Real attention events (approvals, follow-ups, notifications) still take over the notch as usual; once handled the window hides again and the notch returns to the other app. Default is off, so existing behavior is unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
- Add en.lproj/zh-Hans.lproj Localizable.strings entries for the coexist toggle title and subtitle. SettingsToggleLine resolves these via appLocalized, so the English settings page no longer falls back to the raw Chinese key text. - Add NotchViewModelTests covering: coexist hides the closed notch but still surfaces attention; default-off keeps existing presentation; and toggling at runtime flips shouldHideWindowPresentation immediately (which drives orderOut/orderFront in the controller). - Guard performDeferredHoverOpenIfNeeded with the coexist flag too, so hover-open is suppressed at the function level rather than only at the hover-timer scheduling site — more robust and encodes the intent. Co-Authored-By: Claude <noreply@anthropic.com>
45414ca to
39d72aa
Compare
|
目前根据建议和要求做了修改和完善,辛苦可以再 review 看看。诚实的说一下,这次 PR 提交,我仅仅作为工具问题发现者(单屏使用中的很小的问题,可能不影响大部分人),代码部分全部由 AI 辅助完成。 |
|
LGTM |
|
@Kelei0215 有一些类型报错,麻烦处理一下,基本逻辑没问题 |
Problem
Ping Island 的 docked 刘海窗口层级是
.mainMenu + 3,且空闲时一悬停就自动展开(
mouseMoved→hoverTimer→.hoveropen)。当同时装了第二个刘海工具(如 NotchNest)时,两者抢同一块刘海:Ping Island 闭合时仍视觉遮挡对方,
光标一进刘海就抢走 hover/click。
Approach
新增一个设置开关 "Coexist with other notch apps"(默认 关,行为不变)。
开启后,Ping Island 空闲时让出刘海,只在真实 attention 时接管:
orderOrder撤掉窗口,不再视觉遮挡下层刘海应用真实 attention(审批 / 追问 / 通知)照常接管刘海,处理完再隐藏。
这与现有 "attention-first" 哲学一脉相承——是输入层对现有"视觉空闲收缩"的对应。
Why not merge features
有意不加音乐/剪贴板等功能——那些属于通用刘海工具;此 PR 目标是与之干净共存,而非替代。
Files
coexistWithOtherNotchApps开关(key + @published + 默认值 + AppSettings 门面)shouldHideWindowPresentationTest plan
Xcode 26.2 / Swift 6.2 编译通过(
CODE_SIGN_IDENTITY=-)。