Skip to content

Commit

Permalink
feat: support macos "sudden termination"
Browse files Browse the repository at this point in the history
  • Loading branch information
louis.pontoise authored and lwouis committed Mar 10, 2020
1 parent 4046136 commit 671fdab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions alt-tab-macos/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,7 @@
<string>1</string>
<key>ATSApplicationFontsPath</key>
<string></string>
<key>NSSupportsSuddenTermination</key>
<string>true</string>
</dict>
</plist>
2 changes: 2 additions & 0 deletions alt-tab-macos/logic/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ class Preferences {
}

static func saveRawToDisk() throws {
ProcessInfo.processInfo.disableSuddenTermination()
try saveToDisk(rawValues, userFile)
ProcessInfo.processInfo.enableSuddenTermination()
}

private static func preferencesVersion(_ url: URL) throws -> Int {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ class PreferencesWindow: NSWindow {
throw NSError.make(domain: "Preferences", message: "Please enter a valid value for '" + key + "'")
}
try Preferences.updateAndValidateFromString(key, newValue)
(App.shared as! App).initPreferencesDependentComponents()
try Preferences.saveRawToDisk()
(App.shared as! App).initPreferencesDependentComponents()
} catch let error {
debugPrint("PreferencesWindow: save: error", key, newValue, error)
showSaveErrorSheetModal(error as NSError, senderControl, key, previousValue) // allows recursive call by user choice
Expand Down

0 comments on commit 671fdab

Please sign in to comment.