Progressbar fix.

This commit is contained in:
Storm Dragon committed 2026-10-14 18:22:59 -04:00
1 parent 6754c8ef6c
commit 9205e7280a
10 files changed
+266 -3

No files matched your search

+18
View File
@@ -7,6 +7,7 @@ package webscripts
import (
"regexp"
"sort"
"strconv"
"strings"
"time"
)
@@ -15,6 +16,23 @@ 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)$`)
var steamShaderProgress = regexp.MustCompile(`^Processing Vulkan shaders \((\d{1,3})%\)$`)
// ShaderProgress recognizes Steam's English shader status, which Chromium
// exposes as static text rather than an AT-SPI progress bar. Match the leaf
// only: containing sections repeat this text alongside dialog controls.
func ShaderProgress(processName, eventType, role, name string) (float64, bool) {
if MatchProcess(processName) != Steam || eventType != "object:property-change:accessible-name" || role != "static" {
return 0, false
}
match := steamShaderProgress.FindStringSubmatch(strings.TrimSpace(name))
if match == nil {
return 0, false
}
percentage, err := strconv.Atoi(match[1])
return float64(percentage), err == nil && percentage <= 100
}
// 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.