Repository navigation
windows: Show notifications from an app that has not shown one yet - #1009
Conversation
An unpackaged app has no entry in Settings > System > Notifications until its first toast, and ToastNotifier.Setting fails with ERROR_NOT_FOUND (0x80070490) until then. NSH read that as "unavailable": the permission was never granted and Notifications.show refused every toast, so no app ever got its first one. A missing setting means the user turned nothing off, so it reads as enabled. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent: rust-maintainer
An order watch calls its handler only when the permutation changes. Apply pending focus when items are laid out as well, so a single-item context menu focuses its item instead of leaving Space on the trigger. Agent: rust-maintainer
Chromium reports a mouse pointer for Shift+F10 context menus, with button -1. Treat that event as keyboard input so the menu receives initial focus and is anchored below its trigger. Agent: rust-maintainer
|
Applied the shared menu focus fixes and merged main normally, preserving this branch's ancestry. Order watchers skip identity permutations, so pending focus must also be applied when menu items are laid out. Chromium additionally reports Shift+F10 context menus as Shared-fix validation on Linux: CLI build, workspace check, targeted menu/CLI/JS Clippy with This branch passed targeted check and Clippy. Its base suite initially failed three focus-within cases; all three passed isolated reruns. Main also reproduces focus-within failures, including Carousel and HoverCard. Full workspace tests and Clippy also ran. Unmodified main reproduces the shader-frame failure, six TUI failures, math-enabled formula-test failure, and Web test |
huacnlee
left a comment
There was a problem hiding this comment.
✅ No code blocker found in the Windows first-toast fix at 400b614b4; independent live Windows verification remains pending.
The private setting helper normalizes only ERROR_NOT_FOUND from ToastNotifier.Setting. Registration/notifier creation errors and other HRESULTs still propagate; explicit Disabled* values still produce denied and prevent sending. Both the permission and show paths use the same helper. No public API or dependency change. This is consistent with Microsoft’s documented setting states.
Verification: serial cross-Clippy of the actual Windows backend with cargo xwin clippy --target x86_64-pc-windows-msvc -p nsh-platform-windows --no-default-features --all-targets -- -D warnings passed. Changed Rust files pass nightly rustfmt and diff whitespace checks; Web unit tests pass 63/63. Full formatting check reports five files unchanged from merge base f7afd23f5. All current CI checks pass (website deploy intentionally skipped), including native Windows Clippy/tests; the shared menu prerequisite’s broader validation is already documented above.
The PR’s Windows 11 fresh-user before/after observation is author evidence. This Linux reviewer has not independently displayed the first toast or tested notification Settings. Remaining native check: fresh app ID → granted permission and first toast; then per-app/global notification disable → denied and no toast; reenable and restart → normal behavior. Capture the actual toast and permission state for the before/after comparison. The Windows example CI does not exercise this notification demo.
main's Windows changes (longbridge#1009, longbridge#1010, longbridge#1011) added a row for the app's icon after docs/dev/windows.md's Environment row, which this branch extends with the preferred languages, the regional preferences and the time zone. The merge keeps this branch's Environment row and main's new row after it; the rest merged on its own.
Description
On Windows,
Notifications.requestPermission()answeredunavailableandNotifications.show()showed nothing for an app that had never shown a notification, which is every app on its first run.An unpackaged app has no entry in Settings > System > Notifications until its first toast, and
ToastNotifier.Settingfails withERROR_NOT_FOUND(0x80070490) until then. The backend treated that error as "cannot read the setting": the permission wasunavailableandshowrefused, so the first toast that would create the entry was never sent.A missing setting now reads as enabled: the user has turned nothing off. A real
Disabled*setting still answersdenied.Testing
Windows 11 VM (fresh user, no notification settings for the app), gallery → Notifications under
nsh test --target windows, dev host cross-built withcargo xwin:notifications: cannot read the setting: Element not found. (0x80070490), the permission badge saidunavailable, and Show gave "Not shown: allow notifications first".granted, Show brings the toast up in the corner ("Ada — Are you coming tonight?"), and the badge on the taskbar button counts 3 after three Add one.cargo xwin clippy --target x86_64-pc-windows-msvc -p nsh-platform-windows --all-targets.🤖 Generated with Claude Code
Additional Windows verification screenshots
Windows guest inside Omarchy, gallery on main
8004f8681(includes #1009 and #1010), fresh app IDdev.nsh.o8test1339.First notification
Permission is
granted; Show displays a toast with the O8Gallery name and app icon. The taskbar icon is visible at 100% scale.App notification disable / re-enable
Left: app notifications disabled through the registry, permission is
deniedand Show is blocked. Right: re-enabled through the registry, but permission still readsdenied.After relaunch
Permission still reads
deniedafter relaunching the app following the registry changes.The disable/re-enable checks used registry writes rather than the Windows Settings switches. The cause of the persistent
deniedstate is unconfirmed; this does not establish an NSH defect. Verification with the actual Settings switches remains pending.🤖 Noop (lead) · AI agent acting for @huacnlee