Skip to content

Instantly share code, notes, and snippets.

@paulirish
Created February 2, 2023 23:35
Show Gist options
  • Save paulirish/50a07eee0917563409fb1b7fa024fd7c to your computer and use it in GitHub Desktop.
Save paulirish/50a07eee0917563409fb1b7fa024fd7c to your computer and use it in GitHub Desktop.
diff --git a/Rectangle.xcodeproj/project.pbxproj b/Rectangle.xcodeproj/project.pbxproj
index 1842ec4..8cb159d 100644
--- a/Rectangle.xcodeproj/project.pbxproj
+++ b/Rectangle.xcodeproj/project.pbxproj
@@ -1180,7 +1180,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = com.knollsoft.RectangleLauncher;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1206,7 +1206,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = com.knollsoft.RectangleLauncher;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1355,7 +1355,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 0.65;
PRODUCT_BUNDLE_IDENTIFIER = com.knollsoft.Rectangle;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1385,7 +1385,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
MARKETING_VERSION = 0.65;
PRODUCT_BUNDLE_IDENTIFIER = com.knollsoft.Rectangle;
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -1412,7 +1412,7 @@
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = dev.ryanhanson.RectangleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -1438,7 +1438,7 @@
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
- MACOSX_DEPLOYMENT_TARGET = 10.12;
+ MACOSX_DEPLOYMENT_TARGET = 12.4;
PRODUCT_BUNDLE_IDENTIFIER = dev.ryanhanson.RectangleTests;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
diff --git a/Rectangle/AccessibilityElement.swift b/Rectangle/AccessibilityElement.swift
index e087876..f84caf5 100644
--- a/Rectangle/AccessibilityElement.swift
+++ b/Rectangle/AccessibilityElement.swift
@@ -106,24 +106,30 @@ class AccessibilityElement {
func setFrame(_ frame: CGRect) {
let appElement = applicationElement
- var enhancedUI: Bool? = nil
+// var enhancedUI: Bool? = nil
- if let appElement = appElement {
- enhancedUI = appElement.enhancedUserInterface
- if enhancedUI == true {
- Logger.log("AXEnhancedUserInterface was enabled, will disable before resizing")
- appElement.enhancedUserInterface = false
- }
- }
+// Logger.log("enhancedUI is \(enhancedUI)")
+// if let appElement = appElement {
+// enhancedUI = appElement.enhancedUserInterface
+// Logger.log("enhancedUI 2 is \(enhancedUI)")
+// if enhancedUI == true {
+// Logger.log("enhancedUI 3 is \(enhancedUI)")
+// Logger.log("AXEnhancedUserInterface was enabled, will disable before resizing")
+// appElement.enhancedUserInterface = false
+// Logger.log("enhancedUserInterface set to false")
+// }
+// }
size = frame.size
position = frame.origin
size = frame.size
// If "enhanced user interface" was originally enabled for the app, turn it back on
- if Defaults.enhancedUI.value == .disableEnable, let appElement = appElement, enhancedUI == true {
- appElement.enhancedUserInterface = true
- }
+// Logger.log("enhancedUserInterface before")
+// if Defaults.enhancedUI.value == .disableEnable, let appElement = appElement, enhancedUI == true {
+// appElement.enhancedUserInterface = true
+// Logger.log("enhancedUserInterface set to true")
+// }
}
private var childElements: [AccessibilityElement]? {
@@ -200,16 +206,20 @@ class AccessibilityElement {
var isHidden: Bool? {
applicationElement?.wrappedElement.getValue(.hidden) as? Bool
}
-
- var enhancedUserInterface: Bool? {
- get {
- applicationElement?.wrappedElement.getValue(.enhancedUserInterface) as? Bool
- }
- set {
- guard let newValue = newValue else { return }
- applicationElement?.wrappedElement.setValue(.enhancedUserInterface, newValue)
- }
- }
+//
+// var enhancedUserInterface: Bool? {
+// get {
+//
+//// let somevalue = applicationElement?.wrappedElement.getValue(.enhancedUserInterface) as? Bool
+//// Logger.log("getting enahnceduserinterface \(somevalue)")
+// return false
+// }
+// set {
+// Logger.log("setting enahnceduserinterface \(newValue)")
+// guard let newValue = newValue else { return }
+//// applicationElement?.wrappedElement.setValue(.enhancedUserInterface, newValue)
+// }
+// }
// Only for Stage Manager
var windowIds: [CGWindowID]? {
diff --git a/Rectangle/ApplicationToggle.swift b/Rectangle/ApplicationToggle.swift
index c4b7715..9396fc9 100644
--- a/Rectangle/ApplicationToggle.swift
+++ b/Rectangle/ApplicationToggle.swift
@@ -107,7 +107,7 @@ class ApplicationToggle: NSObject {
}
if Defaults.enhancedUI.value == .frontmostDisable {
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(50)) {
- AccessibilityElement.getFrontApplicationElement()?.enhancedUserInterface = false
+// AccessibilityElement.getFrontApplicationElement()?.enhancedUserInterface = false
}
}
}
diff --git a/Rectangle/Utilities/AXExtension.swift b/Rectangle/Utilities/AXExtension.swift
index 19a2b0c..cd3cb38 100644
--- a/Rectangle/Utilities/AXExtension.swift
+++ b/Rectangle/Utilities/AXExtension.swift
@@ -8,7 +8,7 @@
import Foundation
extension NSAccessibility.Attribute {
- static let enhancedUserInterface = NSAccessibility.Attribute(rawValue: "AXEnhancedUserInterface")
+// static let enhancedUserInterfacefoo = NSAccessibility.Attribute(rawValue: "AXEnhancedUsezrInterfacez")
static let windowIds = NSAccessibility.Attribute(rawValue: "AXWindowsIDs")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment