macos: persist secure input state across restarts

This commit is contained in:
Mitchell Hashimoto
2024-09-19 19:54:42 -07:00
parent a513a02328
commit fa9df4f6f0

View File

@ -106,6 +106,11 @@ class AppDelegate: NSObject,
"ApplePressAndHoldEnabled": false, "ApplePressAndHoldEnabled": false,
]) ])
// Check if secure input was enabled when we last quit.
if (UserDefaults.standard.bool(forKey: "SecureInput") != SecureInput.shared.enabled) {
toggleSecureInput(self)
}
// Hook up updater menu // Hook up updater menu
menuCheckForUpdates?.target = updaterController menuCheckForUpdates?.target = updaterController
menuCheckForUpdates?.action = #selector(SPUStandardUpdaterController.checkForUpdates(_:)) menuCheckForUpdates?.action = #selector(SPUStandardUpdaterController.checkForUpdates(_:))
@ -492,5 +497,6 @@ class AppDelegate: NSObject,
let input = SecureInput.shared let input = SecureInput.shared
input.global.toggle() input.global.toggle()
self.menuSecureInput?.state = if (input.global) { .on } else { .off } self.menuSecureInput?.state = if (input.global) { .on } else { .off }
UserDefaults.standard.set(input.global, forKey: "SecureInput")
} }
} }