diff --git a/Spaceman.xcodeproj/project.pbxproj b/Spaceman.xcodeproj/project.pbxproj index a328fb3..0e4cf3f 100644 --- a/Spaceman.xcodeproj/project.pbxproj +++ b/Spaceman.xcodeproj/project.pbxproj @@ -465,7 +465,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.6.18; + CURRENT_PROJECT_VERSION = 1.6.19; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Spaceman/Preview Content\""; DEVELOPMENT_TEAM = ""; @@ -480,7 +480,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.6.18; + MARKETING_VERSION = 1.6.19; PRODUCT_BUNDLE_IDENTIFIER = dev.ruittenb.Spaceman; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -499,7 +499,7 @@ "CODE_SIGN_IDENTITY[sdk=macosx*]" = "-"; CODE_SIGN_STYLE = Manual; COMBINE_HIDPI_IMAGES = YES; - CURRENT_PROJECT_VERSION = 1.6.18; + CURRENT_PROJECT_VERSION = 1.6.19; DEAD_CODE_STRIPPING = YES; DEVELOPMENT_ASSET_PATHS = "\"Spaceman/Preview Content\""; DEVELOPMENT_TEAM = ""; @@ -514,7 +514,7 @@ "@executable_path/../Frameworks", ); MACOSX_DEPLOYMENT_TARGET = 11.0; - MARKETING_VERSION = 1.6.18; + MARKETING_VERSION = 1.6.19; PRODUCT_BUNDLE_IDENTIFIER = dev.ruittenb.Spaceman; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Spaceman/Helpers/SpaceSwitcher.swift b/Spaceman/Helpers/SpaceSwitcher.swift index e44112f..15baf14 100644 --- a/Spaceman/Helpers/SpaceSwitcher.swift +++ b/Spaceman/Helpers/SpaceSwitcher.swift @@ -27,11 +27,15 @@ class SpaceSwitcher { if let scriptObject = NSAppleScript(source: appleScript) { scriptObject.executeAndReturnError(&error) if error != nil { + let errorNumber: Int = error?[NSAppleScript.errorNumber] as! Int let errorBriefMessage: String = error?[NSAppleScript.errorBriefMessage] as! String let settingsName = self.systemSettingsName() + // -1002: Error: Spaceman is not allowed to send keystrokes. (needs Accessibility permission) + // -1743: Error: Not authorized to send Apple events to System Events. (needs Automation permission) + let permissionType = errorNumber == 1002 ? "Accessibility" : "Automation" self.alert( - msg: "Error: \(errorBriefMessage)\n\nPlease grant Accessibility permissions to Spaceman in \(settingsName) → Privacy and Security.", - withSettingsButton: true) + msg: "Error: \(errorBriefMessage)\n\nPlease grant \(permissionType) permissions to Spaceman in \(settingsName) → Privacy and Security.", + permissionTypeName: permissionType) } } } @@ -56,13 +60,13 @@ class SpaceSwitcher { } } - private func alert(msg: String, withSettingsButton: Bool) { + private func alert(msg: String, permissionTypeName: String) { DispatchQueue.main.async { let alert = NSAlert.init() alert.messageText = "Spaceman" alert.informativeText = "\(msg)" alert.addButton(withTitle: "Dismiss") - if withSettingsButton { + if permissionTypeName != "" { let settingsName = self.systemSettingsName() alert.addButton(withTitle: "\(settingsName)...") } @@ -70,7 +74,7 @@ class SpaceSwitcher { if (response == .alertSecondButtonReturn) { let task = Process() task.launchPath = "/usr/bin/open" - task.arguments = ["x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"] + task.arguments = ["x-apple.systempreferences:com.apple.preference.security?Privacy_\(permissionTypeName)"] try? task.run() } } diff --git a/Spaceman/Info.plist b/Spaceman/Info.plist index 2a7f8f4..fe4380a 100644 --- a/Spaceman/Info.plist +++ b/Spaceman/Info.plist @@ -2,6 +2,8 @@ + NSAppleEventsUsageDescription + This app uses AppleScript to switch desktops CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleDisplayName diff --git a/publicity/yabai-spaceman-kaders.png b/publicity/yabai-spaceman-kaders.png new file mode 100644 index 0000000..e60817c Binary files /dev/null and b/publicity/yabai-spaceman-kaders.png differ