mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
OSDUHelper disabler
This commit is contained in:
parent
c139af700e
commit
9fa16b8c35
3 changed files with 68 additions and 15 deletions
|
|
@ -361,6 +361,7 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 9Y64TRM77N;
|
DEVELOPMENT_TEAM = 9Y64TRM77N;
|
||||||
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
|
@ -403,6 +404,7 @@
|
||||||
CURRENT_PROJECT_VERSION = 1;
|
CURRENT_PROJECT_VERSION = 1;
|
||||||
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
DEVELOPMENT_ASSET_PATHS = "\"DynamicIsland/Preview Content\"";
|
||||||
DEVELOPMENT_TEAM = 9Y64TRM77N;
|
DEVELOPMENT_TEAM = 9Y64TRM77N;
|
||||||
|
ENABLE_APP_SANDBOX = NO;
|
||||||
ENABLE_HARDENED_RUNTIME = YES;
|
ENABLE_HARDENED_RUNTIME = YES;
|
||||||
ENABLE_PREVIEWS = YES;
|
ENABLE_PREVIEWS = YES;
|
||||||
FRAMEWORK_SEARCH_PATHS = (
|
FRAMEWORK_SEARCH_PATHS = (
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,8 @@
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.automation.apple-events</key>
|
<key>com.apple.security.automation.apple-events</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.device.camera</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.device.audio-input</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.files.user-selected.read-write</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.network.client</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.network.server</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.personal-information.calendars</key>
|
|
||||||
<true/>
|
|
||||||
<key>com.apple.security.temporary-exception.apple-events</key>
|
<key>com.apple.security.temporary-exception.apple-events</key>
|
||||||
<array>
|
<array>
|
||||||
<string>com.spotify.client</string>
|
<string>com.spotify.client</string>
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ class SystemHUDManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func setupSettingsObserver() {
|
private func setupSettingsObserver() {
|
||||||
// Use Defaults publisher instead of @Default property wrapper
|
// Observe master toggle
|
||||||
Defaults.publisher(.enableSystemHUD, options: []).sink { [weak self] change in
|
Defaults.publisher(.enableSystemHUD, options: []).sink { [weak self] change in
|
||||||
guard let self = self, self.isSetupComplete else {
|
guard let self = self, self.isSetupComplete else {
|
||||||
return
|
return
|
||||||
|
|
@ -36,9 +36,31 @@ class SystemHUDManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.store(in: &cancellables)
|
}.store(in: &cancellables)
|
||||||
|
|
||||||
|
// Observe individual HUD toggles
|
||||||
|
Defaults.publisher(.enableVolumeHUD, options: []).sink { [weak self] change in
|
||||||
|
guard let self = self, self.isSetupComplete, Defaults[.enableSystemHUD] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// When volume HUD is enabled, ensure OSD is disabled
|
||||||
|
if change.newValue {
|
||||||
|
self.disableSystemHUD()
|
||||||
|
}
|
||||||
|
}.store(in: &cancellables)
|
||||||
|
|
||||||
|
Defaults.publisher(.enableBrightnessHUD, options: []).sink { [weak self] change in
|
||||||
|
guard let self = self, self.isSetupComplete, Defaults[.enableSystemHUD] else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// When brightness HUD is enabled, ensure OSD is disabled
|
||||||
|
if change.newValue {
|
||||||
|
self.disableSystemHUD()
|
||||||
|
}
|
||||||
|
}.store(in: &cancellables)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var cancellables = Set<AnyCancellable>()
|
private var cancellables = Set<AnyCancellable>()
|
||||||
|
private var osdMonitorTimer: Timer?
|
||||||
|
|
||||||
/// Public property to check if system operations are in progress
|
/// Public property to check if system operations are in progress
|
||||||
var isOperationInProgress: Bool {
|
var isOperationInProgress: Bool {
|
||||||
|
|
@ -71,6 +93,9 @@ class SystemHUDManager {
|
||||||
// Disable system HUD if possible
|
// Disable system HUD if possible
|
||||||
disableSystemHUD()
|
disableSystemHUD()
|
||||||
|
|
||||||
|
// Start periodic monitoring to ensure OSD stays disabled
|
||||||
|
startOSDMonitoring()
|
||||||
|
|
||||||
print("System HUD replacement started")
|
print("System HUD replacement started")
|
||||||
isSystemOperationInProgress = false
|
isSystemOperationInProgress = false
|
||||||
}
|
}
|
||||||
|
|
@ -83,6 +108,9 @@ class SystemHUDManager {
|
||||||
changesObserver?.stopObserving()
|
changesObserver?.stopObserving()
|
||||||
changesObserver = nil
|
changesObserver = nil
|
||||||
|
|
||||||
|
// Stop OSD monitoring
|
||||||
|
stopOSDMonitoring()
|
||||||
|
|
||||||
// Re-enable system HUD
|
// Re-enable system HUD
|
||||||
enableOriginalSystemHUD()
|
enableOriginalSystemHUD()
|
||||||
|
|
||||||
|
|
@ -121,6 +149,43 @@ class SystemHUDManager {
|
||||||
changesObserver?.handleBrightnessKeyEvent()
|
changesObserver?.handleBrightnessKeyEvent()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// MARK: - OSD Monitoring
|
||||||
|
|
||||||
|
/// Start periodic monitoring to ensure OSD stays disabled
|
||||||
|
@MainActor
|
||||||
|
private func startOSDMonitoring() {
|
||||||
|
stopOSDMonitoring() // Stop any existing timer
|
||||||
|
|
||||||
|
osdMonitorTimer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { [weak self] _ in
|
||||||
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
// Check if any HUD is enabled
|
||||||
|
let anyHUDEnabled = Defaults[.enableVolumeHUD] || Defaults[.enableBrightnessHUD]
|
||||||
|
guard anyHUDEnabled else { return }
|
||||||
|
|
||||||
|
// Check if OSD is running when it shouldn't be
|
||||||
|
Task.detached(priority: .background) {
|
||||||
|
let isRunning = await SystemOSDManager.isOSDUIHelperRunningAsync()
|
||||||
|
if isRunning {
|
||||||
|
await MainActor.run {
|
||||||
|
print("⚠️ OSDUIHelper detected running while HUDs are enabled - re-disabling")
|
||||||
|
self.disableSystemHUD()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print("✅ OSD monitoring started (checks every 5 seconds)")
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Stop OSD monitoring
|
||||||
|
@MainActor
|
||||||
|
private func stopOSDMonitoring() {
|
||||||
|
osdMonitorTimer?.invalidate()
|
||||||
|
osdMonitorTimer = nil
|
||||||
|
print("🛑 OSD monitoring stopped")
|
||||||
|
}
|
||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
cancellables.removeAll()
|
cancellables.removeAll()
|
||||||
Task { @MainActor in
|
Task { @MainActor in
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue