Follow Steam Big Picture overlays and stop false Steam notifications

Big Picture draws Quick Access, the Steam menu and the power menu as
separate Chromium frames in its one X11 window and never marks them
active, so their focus was discarded and Cthulhu kept reading the
library. Accept a focus gain in a showing Steam frame owned by the X11
foreground process. Steam closes these popups when focus leaves them,
which browse-mode caret movement caused, so Steam popup documents
(<Name>_uid<n>) start in focus mode.

Steam's events calendar sits in a live region and was spoken as dozens
of "Steam:" notifications. Live regions now count as Steam notifications
only inside toast popups; notification and alert roles are unchanged.

Verified live: F2, Notifications, Right reached and completed the
hardware survey. The toast restriction is not yet checked against a
real toast.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Storm DragonandClaude Opus 5.5 committed 2026-12-01 02:18:32 -05:00
1 parent 5c919016bb
commit 87b6aa49da
13 files changed
+236 -3

No files matched your search

+18
View File
@@ -16,6 +16,10 @@ const steamNotificationDelay = 500 * time.Millisecond
var steamRelativeTime = regexp.MustCompile(`(?i)^(?:just now|now|\d+\s+(?:second|minute|hour|day|week|month|year)s?\s+ago)$`)
// Steam names each Big Picture popup browser "<Name>_uid<browser>", for
// example QuickAccess_uid2. The main view is "Steam Big Picture Mode".
var steamPopupDocument = regexp.MustCompile(`^[A-Za-z][A-Za-z0-9]*_uid\d+$`)
var steamShaderProgress = regexp.MustCompile(`^Processing Vulkan shaders \((\d{1,3})%\)$`)
// ShaderProgress recognizes Steam's English shader status, which Chromium
@@ -33,6 +37,20 @@ func ShaderProgress(processName, eventType, role, name string) (float64, bool) {
return float64(percentage), err == nil && percentage <= 100
}
// GamepadPopupDocument reports a Steam Big Picture popup, such as Quick Access
// or the main menu. Steam drives these with its own arrow-key navigation and
// closes them when focus leaves, so browse-mode caret movement dismisses them.
func GamepadPopupDocument(processName, documentName string) bool {
return MatchProcess(processName) == Steam && steamPopupDocument.MatchString(strings.TrimSpace(documentName))
}
// ToastDocument reports Steam's toast popup, named notificationtoasts_uid<n>-<id>
// in Big Picture and notificationtoasts_<id>_desktop otherwise. Live regions
// elsewhere, such as the store's event calendar, are page content, not toasts.
func ToastDocument(documentName string) bool {
return strings.HasPrefix(strings.TrimSpace(documentName), "notificationtoasts_")
}
// NotificationRoot mirrors Python's Steam root selection: notification/alert
// ancestors take precedence over inherited live-region attributes on a leaf.
// Candidates are ordered from the event source towards its application root.
+29
View File
@@ -145,3 +145,32 @@ func TestSteamNotificationDeduplicationAndOwnership(t *testing.T) {
t.Fatalf("reset presented pending content: %q", got)
}
}
func TestGamepadPopupDocument(t *testing.T) {
for _, name := range []string{"QuickAccess_uid2", "MainMenu_uid12", " QuickAccess_uid2 "} {
if !GamepadPopupDocument("steamwebhelper", name) {
t.Errorf("%q was not a Steam popup", name)
}
}
for _, name := range []string{"Steam Big Picture Mode", "Steam", "", "QuickAccess_uid", "Quick Access_uid2"} {
if GamepadPopupDocument("steamwebhelper", name) {
t.Errorf("%q was treated as a Steam popup", name)
}
}
if GamepadPopupDocument("chrome", "QuickAccess_uid2") {
t.Error("another browser's document was treated as a Steam popup")
}
}
func TestToastDocument(t *testing.T) {
for _, name := range []string{"notificationtoasts_uid2-41", "notificationtoasts_41_desktop"} {
if !ToastDocument(name) {
t.Errorf("%q was not a toast document", name)
}
}
for _, name := range []string{"Steam Big Picture Mode", "QuickAccess_uid2", ""} {
if ToastDocument(name) {
t.Errorf("%q was treated as a toast document", name)
}
}
}