mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Atoll: Fix Sleep Mode Icon Detections on Atoll
Signed-off-by: Jis G Jacob <studiokeys@blissroms.org>
This commit is contained in:
parent
93e0c86033
commit
f8225a9ad3
1 changed files with 11 additions and 3 deletions
|
|
@ -740,7 +740,14 @@ extension FocusModeType {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. macOS 26.3 custom Focus modes use `com.apple.donotdisturb.mode.<symbol>`.
|
// 2. Sleep focus is reported as `com.apple.sleep.sleep-mode` by duetexpertd,
|
||||||
|
// not as the rawValue `com.apple.focus.sleep`, so handle it explicitly here.
|
||||||
|
if normalizedLowercased == "com.apple.sleep.sleep-mode" {
|
||||||
|
self = .sleep
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. macOS custom Focus modes use `com.apple.donotdisturb.mode.<symbol>`.
|
||||||
// Must be checked BEFORE the generic prefix match, otherwise the prefix
|
// Must be checked BEFORE the generic prefix match, otherwise the prefix
|
||||||
// `com.apple.donotdisturb.mode` would incorrectly resolve to .doNotDisturb.
|
// `com.apple.donotdisturb.mode` would incorrectly resolve to .doNotDisturb.
|
||||||
if normalizedLowercased.hasPrefix("com.apple.donotdisturb.mode.") {
|
if normalizedLowercased.hasPrefix("com.apple.donotdisturb.mode.") {
|
||||||
|
|
@ -751,7 +758,7 @@ extension FocusModeType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Prefix match for known built-in modes (e.g., com.apple.focus.personal-time -> .personal).
|
// 4. Prefix match for known built-in modes (e.g., com.apple.focus.personal-time -> .personal).
|
||||||
if let resolved = FocusModeType.allCases.first(where: {
|
if let resolved = FocusModeType.allCases.first(where: {
|
||||||
guard !$0.rawValue.isEmpty else { return false }
|
guard !$0.rawValue.isEmpty else { return false }
|
||||||
return normalized.hasPrefix($0.rawValue) || normalizedLowercased.hasPrefix($0.rawValue)
|
return normalized.hasPrefix($0.rawValue) || normalizedLowercased.hasPrefix($0.rawValue)
|
||||||
|
|
@ -760,7 +767,7 @@ extension FocusModeType {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. Anything else under com.apple.focus is custom.
|
// 5. Anything else under com.apple.focus is custom.
|
||||||
if normalizedLowercased.hasPrefix("com.apple.focus") {
|
if normalizedLowercased.hasPrefix("com.apple.focus") {
|
||||||
self = .custom
|
self = .custom
|
||||||
return
|
return
|
||||||
|
|
@ -1276,6 +1283,7 @@ private enum FocusNotificationParsing {
|
||||||
"(?i)(?:focusModeName|focusMode|displayName|name)\\s*=\\s*\"([^\"]+)\"",
|
"(?i)(?:focusModeName|focusMode|displayName|name)\\s*=\\s*\"([^\"]+)\"",
|
||||||
"(?i)(?:focusModeName|focusMode|displayName|name)\\s*=\\s*([^;\\n]+)",
|
"(?i)(?:focusModeName|focusMode|displayName|name)\\s*=\\s*([^;\\n]+)",
|
||||||
"activityDisplayName:\\s*([^;>\\n]+)",
|
"activityDisplayName:\\s*([^;>\\n]+)",
|
||||||
|
"semanticType:\\s*([A-Za-z][A-Za-z0-9 _-]+)",
|
||||||
"modeIdentifier:\\s*'com\\.apple\\.focus\\.([A-Za-z0-9._-]+)'"
|
"modeIdentifier:\\s*'com\\.apple\\.focus\\.([A-Za-z0-9._-]+)'"
|
||||||
]
|
]
|
||||||
return patterns.compactMap { try? NSRegularExpression(pattern: $0, options: []) }
|
return patterns.compactMap { try? NSRegularExpression(pattern: $0, options: []) }
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue