Fix: Brightness and Volume Control

This commit is contained in:
Hariharan Mudaliar 2025-09-06 21:54:19 +05:30
commit 98c826aaae
11 changed files with 340 additions and 97 deletions

View file

@ -72,23 +72,30 @@ class SettingsWindowController: NSWindowController {
// If window is already visible, bring it to front properly
if window?.isVisible == true {
NSApp.activate(ignoringOtherApps: true)
window?.orderFrontRegardless()
window?.makeKeyAndOrderFront(nil)
forceWindowToFront()
return
}
// Show the window with proper ordering
window?.center()
forceWindowToFront()
}
private func forceWindowToFront() {
// Multi-step approach to ensure window gets focus
window?.orderFrontRegardless()
window?.makeKeyAndOrderFront(nil)
window?.center()
// Activate the app and ensure window gets focus
// Activate the app with maximum priority
NSApp.activate(ignoringOtherApps: true)
// Force window to front after activation
DispatchQueue.main.async { [weak self] in
self?.window?.makeKeyAndOrderFront(nil)
// Double-check after a brief delay
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { [weak self] in
guard let window = self?.window else { return }
if !window.isKeyWindow {
window.makeKeyAndOrderFront(nil)
NSApp.activate(ignoringOtherApps: true)
}
}
}