├── .github └── workflows │ └── build.yml ├── .gitignore ├── LICENSE ├── ModMove.xcodeproj ├── project.pbxproj └── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ └── IDEWorkspaceChecks.plist ├── ModMove ├── AXValue+Helper.swift ├── AccessibilityElement.swift ├── AccessibilityHelper.swift ├── AppDelegate.swift ├── LoginAlert.swift ├── LoginController.h ├── LoginController.m ├── Mouse.swift ├── Mover.swift ├── Observer.swift └── Resources │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ └── MainMenu.xib │ ├── Info.plist │ └── ModMove-Bridging-Header.h ├── README.md └── modmove.gif /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | 3 | "on": 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | runs-on: macos-latest 12 | steps: 13 | - uses: actions/checkout@v2 14 | - name: Build 15 | run: xcodebuild -configuration Release 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | !default.mode1v3 2 | !default.mode2v3 3 | !default.pbxuser 4 | !default.perspectivev3 5 | *.hmap 6 | *.ipa 7 | *.mode1v3 8 | *.mode2v3 9 | *.moved-aside 10 | *.pbxuser 11 | *.perspectivev3 12 | *.xccheckout 13 | *.xcscmblueprint 14 | *.xcuserstate 15 | ._* 16 | .AppleDouble 17 | .DS_Store 18 | .LSOverride 19 | build/ 20 | DerivedData 21 | Icon 22 | xcuserdata 23 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015 Keith Smiley (http://keith.so) 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the 'Software'), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /ModMove.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 47; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | C27E731B1BD9FFB00058FDD0 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27E731A1BD9FFB00058FDD0 /* AppDelegate.swift */; }; 11 | C27E731D1BD9FFB00058FDD0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C27E731C1BD9FFB00058FDD0 /* Assets.xcassets */; }; 12 | C27E73201BD9FFB00058FDD0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C27E731E1BD9FFB00058FDD0 /* MainMenu.xib */; }; 13 | C27E73291BD9FFE70058FDD0 /* Observer.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27E73281BD9FFE70058FDD0 /* Observer.swift */; }; 14 | C27E732B1BDA055E0058FDD0 /* Mover.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27E732A1BDA055E0058FDD0 /* Mover.swift */; }; 15 | C27E732D1BDA06A90058FDD0 /* AccessibilityElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27E732C1BDA06A90058FDD0 /* AccessibilityElement.swift */; }; 16 | C27E732F1BDA08810058FDD0 /* Mouse.swift in Sources */ = {isa = PBXBuildFile; fileRef = C27E732E1BDA08810058FDD0 /* Mouse.swift */; }; 17 | C298327F1BDA160700852252 /* AXValue+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C298327E1BDA160700852252 /* AXValue+Helper.swift */; }; 18 | C2FA55CF1BDDA6A50040373D /* LoginController.m in Sources */ = {isa = PBXBuildFile; fileRef = C2FA55CE1BDDA6A50040373D /* LoginController.m */; }; 19 | C2FA55D11BDDA7A30040373D /* AccessibilityHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2FA55D01BDDA7A30040373D /* AccessibilityHelper.swift */; }; 20 | C2FA55D31BDDA9B00040373D /* LoginAlert.swift in Sources */ = {isa = PBXBuildFile; fileRef = C2FA55D21BDDA9B00040373D /* LoginAlert.swift */; }; 21 | /* End PBXBuildFile section */ 22 | 23 | /* Begin PBXFileReference section */ 24 | C27E73171BD9FFB00058FDD0 /* ModMove.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ModMove.app; sourceTree = BUILT_PRODUCTS_DIR; }; 25 | C27E731A1BD9FFB00058FDD0 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 26 | C27E731C1BD9FFB00058FDD0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 27 | C27E731F1BD9FFB00058FDD0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; 28 | C27E73211BD9FFB00058FDD0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 29 | C27E73281BD9FFE70058FDD0 /* Observer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Observer.swift; sourceTree = ""; }; 30 | C27E732A1BDA055E0058FDD0 /* Mover.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mover.swift; sourceTree = ""; }; 31 | C27E732C1BDA06A90058FDD0 /* AccessibilityElement.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessibilityElement.swift; sourceTree = ""; }; 32 | C27E732E1BDA08810058FDD0 /* Mouse.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Mouse.swift; sourceTree = ""; }; 33 | C298327E1BDA160700852252 /* AXValue+Helper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AXValue+Helper.swift"; sourceTree = ""; }; 34 | C2FA55C91BDDA0BB0040373D /* ModMove-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ModMove-Bridging-Header.h"; sourceTree = ""; }; 35 | C2FA55CD1BDDA6A50040373D /* LoginController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LoginController.h; sourceTree = ""; }; 36 | C2FA55CE1BDDA6A50040373D /* LoginController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LoginController.m; sourceTree = ""; }; 37 | C2FA55D01BDDA7A30040373D /* AccessibilityHelper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AccessibilityHelper.swift; sourceTree = ""; }; 38 | C2FA55D21BDDA9B00040373D /* LoginAlert.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginAlert.swift; sourceTree = ""; }; 39 | /* End PBXFileReference section */ 40 | 41 | /* Begin PBXFrameworksBuildPhase section */ 42 | C27E73141BD9FFB00058FDD0 /* Frameworks */ = { 43 | isa = PBXFrameworksBuildPhase; 44 | buildActionMask = 2147483647; 45 | files = ( 46 | ); 47 | runOnlyForDeploymentPostprocessing = 0; 48 | }; 49 | /* End PBXFrameworksBuildPhase section */ 50 | 51 | /* Begin PBXGroup section */ 52 | C27E730E1BD9FFB00058FDD0 = { 53 | isa = PBXGroup; 54 | children = ( 55 | C27E73191BD9FFB00058FDD0 /* ModMove */, 56 | C27E73181BD9FFB00058FDD0 /* Products */, 57 | ); 58 | sourceTree = ""; 59 | }; 60 | C27E73181BD9FFB00058FDD0 /* Products */ = { 61 | isa = PBXGroup; 62 | children = ( 63 | C27E73171BD9FFB00058FDD0 /* ModMove.app */, 64 | ); 65 | name = Products; 66 | sourceTree = ""; 67 | }; 68 | C27E73191BD9FFB00058FDD0 /* ModMove */ = { 69 | isa = PBXGroup; 70 | children = ( 71 | C27E732C1BDA06A90058FDD0 /* AccessibilityElement.swift */, 72 | C2FA55D01BDDA7A30040373D /* AccessibilityHelper.swift */, 73 | C27E731A1BD9FFB00058FDD0 /* AppDelegate.swift */, 74 | C298327E1BDA160700852252 /* AXValue+Helper.swift */, 75 | C2FA55D21BDDA9B00040373D /* LoginAlert.swift */, 76 | C2FA55CD1BDDA6A50040373D /* LoginController.h */, 77 | C2FA55CE1BDDA6A50040373D /* LoginController.m */, 78 | C27E732E1BDA08810058FDD0 /* Mouse.swift */, 79 | C27E732A1BDA055E0058FDD0 /* Mover.swift */, 80 | C27E73281BD9FFE70058FDD0 /* Observer.swift */, 81 | C27E73271BD9FFD30058FDD0 /* Resources */, 82 | ); 83 | path = ModMove; 84 | sourceTree = ""; 85 | }; 86 | C27E73271BD9FFD30058FDD0 /* Resources */ = { 87 | isa = PBXGroup; 88 | children = ( 89 | C27E731C1BD9FFB00058FDD0 /* Assets.xcassets */, 90 | C27E73211BD9FFB00058FDD0 /* Info.plist */, 91 | C27E731E1BD9FFB00058FDD0 /* MainMenu.xib */, 92 | C2FA55C91BDDA0BB0040373D /* ModMove-Bridging-Header.h */, 93 | ); 94 | path = Resources; 95 | sourceTree = ""; 96 | }; 97 | /* End PBXGroup section */ 98 | 99 | /* Begin PBXNativeTarget section */ 100 | C27E73161BD9FFB00058FDD0 /* ModMove */ = { 101 | isa = PBXNativeTarget; 102 | buildConfigurationList = C27E73241BD9FFB00058FDD0 /* Build configuration list for PBXNativeTarget "ModMove" */; 103 | buildPhases = ( 104 | C27E73131BD9FFB00058FDD0 /* Sources */, 105 | C27E73141BD9FFB00058FDD0 /* Frameworks */, 106 | C27E73151BD9FFB00058FDD0 /* Resources */, 107 | ); 108 | buildRules = ( 109 | ); 110 | dependencies = ( 111 | ); 112 | name = ModMove; 113 | productName = ModMove; 114 | productReference = C27E73171BD9FFB00058FDD0 /* ModMove.app */; 115 | productType = "com.apple.product-type.application"; 116 | }; 117 | /* End PBXNativeTarget section */ 118 | 119 | /* Begin PBXProject section */ 120 | C27E730F1BD9FFB00058FDD0 /* Project object */ = { 121 | isa = PBXProject; 122 | attributes = { 123 | LastSwiftUpdateCheck = 0710; 124 | LastUpgradeCheck = 0800; 125 | ORGANIZATIONNAME = smileykeith; 126 | TargetAttributes = { 127 | C27E73161BD9FFB00058FDD0 = { 128 | CreatedOnToolsVersion = 7.1; 129 | LastSwiftMigration = 1220; 130 | }; 131 | }; 132 | }; 133 | buildConfigurationList = C27E73121BD9FFB00058FDD0 /* Build configuration list for PBXProject "ModMove" */; 134 | compatibilityVersion = "Xcode 6.3"; 135 | developmentRegion = English; 136 | hasScannedForEncodings = 0; 137 | knownRegions = ( 138 | English, 139 | en, 140 | Base, 141 | ); 142 | mainGroup = C27E730E1BD9FFB00058FDD0; 143 | productRefGroup = C27E73181BD9FFB00058FDD0 /* Products */; 144 | projectDirPath = ""; 145 | projectRoot = ""; 146 | targets = ( 147 | C27E73161BD9FFB00058FDD0 /* ModMove */, 148 | ); 149 | }; 150 | /* End PBXProject section */ 151 | 152 | /* Begin PBXResourcesBuildPhase section */ 153 | C27E73151BD9FFB00058FDD0 /* Resources */ = { 154 | isa = PBXResourcesBuildPhase; 155 | buildActionMask = 2147483647; 156 | files = ( 157 | C27E731D1BD9FFB00058FDD0 /* Assets.xcassets in Resources */, 158 | C27E73201BD9FFB00058FDD0 /* MainMenu.xib in Resources */, 159 | ); 160 | runOnlyForDeploymentPostprocessing = 0; 161 | }; 162 | /* End PBXResourcesBuildPhase section */ 163 | 164 | /* Begin PBXSourcesBuildPhase section */ 165 | C27E73131BD9FFB00058FDD0 /* Sources */ = { 166 | isa = PBXSourcesBuildPhase; 167 | buildActionMask = 2147483647; 168 | files = ( 169 | C2FA55CF1BDDA6A50040373D /* LoginController.m in Sources */, 170 | C298327F1BDA160700852252 /* AXValue+Helper.swift in Sources */, 171 | C2FA55D31BDDA9B00040373D /* LoginAlert.swift in Sources */, 172 | C27E731B1BD9FFB00058FDD0 /* AppDelegate.swift in Sources */, 173 | C27E732F1BDA08810058FDD0 /* Mouse.swift in Sources */, 174 | C2FA55D11BDDA7A30040373D /* AccessibilityHelper.swift in Sources */, 175 | C27E73291BD9FFE70058FDD0 /* Observer.swift in Sources */, 176 | C27E732D1BDA06A90058FDD0 /* AccessibilityElement.swift in Sources */, 177 | C27E732B1BDA055E0058FDD0 /* Mover.swift in Sources */, 178 | ); 179 | runOnlyForDeploymentPostprocessing = 0; 180 | }; 181 | /* End PBXSourcesBuildPhase section */ 182 | 183 | /* Begin PBXVariantGroup section */ 184 | C27E731E1BD9FFB00058FDD0 /* MainMenu.xib */ = { 185 | isa = PBXVariantGroup; 186 | children = ( 187 | C27E731F1BD9FFB00058FDD0 /* Base */, 188 | ); 189 | name = MainMenu.xib; 190 | path = .; 191 | sourceTree = ""; 192 | }; 193 | /* End PBXVariantGroup section */ 194 | 195 | /* Begin XCBuildConfiguration section */ 196 | C27E73221BD9FFB00058FDD0 /* Debug */ = { 197 | isa = XCBuildConfiguration; 198 | buildSettings = { 199 | ALWAYS_SEARCH_USER_PATHS = NO; 200 | CLANG_ENABLE_MODULES = YES; 201 | CLANG_ENABLE_OBJC_ARC = YES; 202 | CLANG_WARN_BOOL_CONVERSION = YES; 203 | CLANG_WARN_CONSTANT_CONVERSION = YES; 204 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 205 | CLANG_WARN_EMPTY_BODY = YES; 206 | CLANG_WARN_ENUM_CONVERSION = YES; 207 | CLANG_WARN_INFINITE_RECURSION = YES; 208 | CLANG_WARN_INT_CONVERSION = YES; 209 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 210 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 211 | CLANG_WARN_UNREACHABLE_CODE = YES; 212 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 213 | CODE_SIGN_IDENTITY = "-"; 214 | COPY_PHASE_STRIP = NO; 215 | DEBUG_INFORMATION_FORMAT = dwarf; 216 | ENABLE_STRICT_OBJC_MSGSEND = YES; 217 | ENABLE_TESTABILITY = YES; 218 | GCC_DYNAMIC_NO_PIC = NO; 219 | GCC_NO_COMMON_BLOCKS = YES; 220 | GCC_OPTIMIZATION_LEVEL = 0; 221 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 222 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 223 | GCC_WARN_UNDECLARED_SELECTOR = YES; 224 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 225 | GCC_WARN_UNUSED_FUNCTION = YES; 226 | GCC_WARN_UNUSED_VARIABLE = YES; 227 | MACOSX_DEPLOYMENT_TARGET = 10.11; 228 | ONLY_ACTIVE_ARCH = YES; 229 | SDKROOT = macosx; 230 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 231 | }; 232 | name = Debug; 233 | }; 234 | C27E73231BD9FFB00058FDD0 /* Release */ = { 235 | isa = XCBuildConfiguration; 236 | buildSettings = { 237 | ALWAYS_SEARCH_USER_PATHS = NO; 238 | CLANG_ENABLE_MODULES = YES; 239 | CLANG_ENABLE_OBJC_ARC = YES; 240 | CLANG_WARN_BOOL_CONVERSION = YES; 241 | CLANG_WARN_CONSTANT_CONVERSION = YES; 242 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 243 | CLANG_WARN_EMPTY_BODY = YES; 244 | CLANG_WARN_ENUM_CONVERSION = YES; 245 | CLANG_WARN_INFINITE_RECURSION = YES; 246 | CLANG_WARN_INT_CONVERSION = YES; 247 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 248 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 249 | CLANG_WARN_UNREACHABLE_CODE = YES; 250 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 251 | CODE_SIGN_IDENTITY = "-"; 252 | COPY_PHASE_STRIP = NO; 253 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 254 | ENABLE_STRICT_OBJC_MSGSEND = YES; 255 | GCC_NO_COMMON_BLOCKS = YES; 256 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 257 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 258 | GCC_WARN_UNDECLARED_SELECTOR = YES; 259 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 260 | GCC_WARN_UNUSED_FUNCTION = YES; 261 | GCC_WARN_UNUSED_VARIABLE = YES; 262 | MACOSX_DEPLOYMENT_TARGET = 10.11; 263 | SDKROOT = macosx; 264 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 265 | }; 266 | name = Release; 267 | }; 268 | C27E73251BD9FFB00058FDD0 /* Debug */ = { 269 | isa = XCBuildConfiguration; 270 | buildSettings = { 271 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 272 | CLANG_ENABLE_MODULES = YES; 273 | INFOPLIST_FILE = ModMove/Resources/Info.plist; 274 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 275 | PRODUCT_BUNDLE_IDENTIFIER = com.smileykeith.ModMove; 276 | PRODUCT_NAME = "$(TARGET_NAME)"; 277 | SWIFT_OBJC_BRIDGING_HEADER = "ModMove/Resources/ModMove-Bridging-Header.h"; 278 | SWIFT_SWIFT3_OBJC_INFERENCE = Off; 279 | SWIFT_VERSION = 5.0; 280 | }; 281 | name = Debug; 282 | }; 283 | C27E73261BD9FFB00058FDD0 /* Release */ = { 284 | isa = XCBuildConfiguration; 285 | buildSettings = { 286 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 287 | CLANG_ENABLE_MODULES = YES; 288 | INFOPLIST_FILE = ModMove/Resources/Info.plist; 289 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; 290 | PRODUCT_BUNDLE_IDENTIFIER = com.smileykeith.ModMove; 291 | PRODUCT_NAME = "$(TARGET_NAME)"; 292 | SWIFT_OBJC_BRIDGING_HEADER = "ModMove/Resources/ModMove-Bridging-Header.h"; 293 | SWIFT_SWIFT3_OBJC_INFERENCE = Off; 294 | SWIFT_VERSION = 5.0; 295 | }; 296 | name = Release; 297 | }; 298 | /* End XCBuildConfiguration section */ 299 | 300 | /* Begin XCConfigurationList section */ 301 | C27E73121BD9FFB00058FDD0 /* Build configuration list for PBXProject "ModMove" */ = { 302 | isa = XCConfigurationList; 303 | buildConfigurations = ( 304 | C27E73221BD9FFB00058FDD0 /* Debug */, 305 | C27E73231BD9FFB00058FDD0 /* Release */, 306 | ); 307 | defaultConfigurationIsVisible = 0; 308 | defaultConfigurationName = Release; 309 | }; 310 | C27E73241BD9FFB00058FDD0 /* Build configuration list for PBXNativeTarget "ModMove" */ = { 311 | isa = XCConfigurationList; 312 | buildConfigurations = ( 313 | C27E73251BD9FFB00058FDD0 /* Debug */, 314 | C27E73261BD9FFB00058FDD0 /* Release */, 315 | ); 316 | defaultConfigurationIsVisible = 0; 317 | defaultConfigurationName = Release; 318 | }; 319 | /* End XCConfigurationList section */ 320 | }; 321 | rootObject = C27E730F1BD9FFB00058FDD0 /* Project object */; 322 | } 323 | -------------------------------------------------------------------------------- /ModMove.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ModMove.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /ModMove/AXValue+Helper.swift: -------------------------------------------------------------------------------- 1 | import Foundation 2 | 3 | extension AXValue { 4 | func toValue() -> T? { 5 | let pointer = UnsafeMutablePointer.allocate(capacity: 1) 6 | let success = AXValueGetValue(self, AXValueGetType(self), pointer) 7 | return success ? pointer.pointee : nil 8 | } 9 | 10 | static func from(value: T, type: AXValueType) -> AXValue? { 11 | let pointer = UnsafeMutablePointer.allocate(capacity: 1) 12 | pointer.pointee = value 13 | return AXValueCreate(type, pointer) 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /ModMove/AccessibilityElement.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | import Foundation 3 | 4 | final class AccessibilityElement { 5 | static let systemWideElement = AccessibilityElement.createSystemWideElement() 6 | 7 | var position: CGPoint? { 8 | get { return self.getPosition() } 9 | set { 10 | if let position = newValue { 11 | self.set(position: position) 12 | } 13 | } 14 | } 15 | 16 | var size: CGSize? { 17 | get { return self.getSize() } 18 | set { 19 | if let size = newValue { 20 | self.set(size: size) 21 | } 22 | } 23 | } 24 | 25 | private let elementRef: AXUIElement 26 | 27 | init(elementRef: AXUIElement) { 28 | self.elementRef = elementRef 29 | } 30 | 31 | func element(at point: CGPoint) -> Self? { 32 | var ref: AXUIElement? 33 | AXUIElementCopyElementAtPosition(self.elementRef, Float(point.x), Float(point.y), &ref) 34 | return ref.map(type(of: self).init) 35 | } 36 | 37 | func window() -> Self? { 38 | var element = self 39 | while element.role() != kAXWindowRole { 40 | if let nextElement = element.parent() { 41 | element = nextElement 42 | } else { 43 | return nil 44 | } 45 | } 46 | 47 | return element 48 | } 49 | 50 | func parent() -> Self? { 51 | return self.value(for: .parent) 52 | } 53 | 54 | func role() -> String? { 55 | return self.value(for: .role) 56 | } 57 | 58 | func pid() -> pid_t? { 59 | let pointer = UnsafeMutablePointer.allocate(capacity: 1) 60 | let error = AXUIElementGetPid(self.elementRef, pointer) 61 | return error == .success ? pointer.pointee : nil 62 | } 63 | 64 | func bringToFront() { 65 | if let isMainWindow = self.rawValue(for: .main) as? Bool, isMainWindow 66 | { 67 | return 68 | } 69 | 70 | AXUIElementSetAttributeValue(self.elementRef, 71 | NSAccessibility.Attribute.main.rawValue as CFString, 72 | true as CFTypeRef) 73 | } 74 | 75 | // MARK: - Private functions 76 | 77 | private static func createSystemWideElement() -> Self { 78 | return self.init(elementRef: AXUIElementCreateSystemWide()) 79 | } 80 | 81 | private func getPosition() -> CGPoint? { 82 | return self.value(for: .position) 83 | } 84 | 85 | private func set(position: CGPoint) { 86 | if let value = AXValue.from(value: position, type: .cgPoint) { 87 | AXUIElementSetAttributeValue(self.elementRef, kAXPositionAttribute as CFString, value) 88 | } 89 | } 90 | 91 | private func getSize() -> CGSize? { 92 | return self.value(for: .size) 93 | } 94 | 95 | private func set(size: CGSize) { 96 | if let value = AXValue.from(value: size, type: .cgSize) { 97 | AXUIElementSetAttributeValue(self.elementRef, kAXSizeAttribute as CFString, value) 98 | } 99 | } 100 | 101 | private func rawValue(for attribute: NSAccessibility.Attribute) -> AnyObject? { 102 | var rawValue: AnyObject? 103 | let error = AXUIElementCopyAttributeValue(self.elementRef, attribute.rawValue as CFString, &rawValue) 104 | return error == .success ? rawValue : nil 105 | } 106 | 107 | private func value(for attribute: NSAccessibility.Attribute) -> Self? { 108 | if let rawValue = self.rawValue(for: attribute), CFGetTypeID(rawValue) == AXUIElementGetTypeID() { 109 | return type(of: self).init(elementRef: rawValue as! AXUIElement) 110 | } 111 | 112 | return nil 113 | } 114 | 115 | private func value(for attribute: NSAccessibility.Attribute) -> String? { 116 | return self.rawValue(for: attribute) as? String 117 | } 118 | 119 | private func value(for attribute: NSAccessibility.Attribute) -> T? { 120 | if let rawValue = self.rawValue(for: attribute), CFGetTypeID(rawValue) == AXValueGetTypeID() { 121 | return (rawValue as! AXValue).toValue() 122 | } 123 | 124 | return nil 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /ModMove/AccessibilityHelper.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | import Foundation 3 | 4 | struct AccessibilityHelper { 5 | static func askForAccessibilityIfNeeded() { 6 | let key: String = kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String 7 | let options = [key: true] 8 | let enabled = AXIsProcessTrustedWithOptions(options as CFDictionary) 9 | 10 | if enabled { 11 | return 12 | } 13 | 14 | let alert = NSAlert() 15 | alert.messageText = "Enable Accessibility First" 16 | alert.informativeText = "Find the popup right behind this one, click \"Open System Preferences\" and enable ModMove. Then launch ModMove again." 17 | alert.alertStyle = .critical 18 | alert.addButton(withTitle: "Quit") 19 | alert.runModal() 20 | NSApp.terminate(nil) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ModMove/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import Cocoa 2 | 3 | @NSApplicationMain 4 | final class AppDelegate: NSObject, NSApplicationDelegate { 5 | func applicationDidFinishLaunching(_ notification: Notification) { 6 | AccessibilityHelper.askForAccessibilityIfNeeded() 7 | 8 | if !LoginController.opensAtLogin() { 9 | LoginAlert.showAlertIfNeeded() 10 | } 11 | 12 | let mover = Mover() 13 | Observer().startObserving { state in 14 | mover.state = state 15 | } 16 | } 17 | 18 | func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool) -> Bool { 19 | sender.orderFrontStandardAboutPanel(nil) 20 | return true 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /ModMove/LoginAlert.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | import Foundation 3 | 4 | private let SuppressionKey = "loginAlertSuppressionKey" 5 | 6 | struct LoginAlert { 7 | static func showAlertIfNeeded() { 8 | if UserDefaults.standard.bool(forKey: SuppressionKey) { 9 | return 10 | } 11 | 12 | let alert = NSAlert() 13 | alert.messageText = "Open ModMove at Login?" 14 | alert.informativeText = "Would you like to open ModMove at login? To disable it afterwards go to System Preferences -> Accounts" 15 | alert.showsSuppressionButton = true 16 | alert.addButton(withTitle: "Open at Login") 17 | alert.addButton(withTitle: "Cancel") 18 | let response = alert.runModal() 19 | if alert.suppressionButton?.state == .on { 20 | UserDefaults.standard.set(true, forKey: SuppressionKey) 21 | } 22 | 23 | if response == .alertFirstButtonReturn { 24 | LoginController.setOpensAtLogin(true) 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ModMove/LoginController.h: -------------------------------------------------------------------------------- 1 | @import Foundation; 2 | 3 | @interface LoginController : NSObject 4 | 5 | + (BOOL)opensAtLogin; 6 | + (void)setOpensAtLogin:(BOOL)opensAtLogin; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /ModMove/LoginController.m: -------------------------------------------------------------------------------- 1 | #import "LoginController.h" 2 | 3 | #pragma clang diagnostic push 4 | #pragma clang diagnostic ignored "-Wdeprecated-declarations" 5 | @implementation LoginController 6 | 7 | + (LSSharedFileListRef)sharedFileList { 8 | static LSSharedFileListRef sharedFileList; 9 | static dispatch_once_t onceToken; 10 | dispatch_once(&onceToken, ^{ 11 | sharedFileList = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL); 12 | }); 13 | return sharedFileList; 14 | } 15 | 16 | + (void)setOpensAtLogin:(BOOL)opensAtLogin { 17 | NSURL *appURL = [[[NSBundle mainBundle] bundleURL] fileReferenceURL]; 18 | 19 | if (opensAtLogin) { 20 | LSSharedFileListItemRef result = LSSharedFileListInsertItemURL([self sharedFileList], 21 | kLSSharedFileListItemLast, 22 | NULL, 23 | NULL, 24 | (__bridge CFURLRef)appURL, 25 | NULL, 26 | NULL); 27 | CFRelease(result); 28 | } 29 | else { 30 | UInt32 seed; 31 | NSArray *sharedFileListArray = (__bridge_transfer NSArray *)LSSharedFileListCopySnapshot([self sharedFileList], &seed); 32 | for (id item in sharedFileListArray) { 33 | LSSharedFileListItemRef sharedFileItem = (__bridge LSSharedFileListItemRef)item; 34 | CFURLRef url = NULL; 35 | 36 | OSStatus result = LSSharedFileListItemResolve(sharedFileItem, 0, &url, NULL); 37 | if (result == noErr && url != nil) { 38 | if ([appURL isEqual:[(__bridge NSURL *)url fileReferenceURL]]) 39 | LSSharedFileListItemRemove([self sharedFileList], sharedFileItem); 40 | 41 | CFRelease(url); 42 | } 43 | } 44 | } 45 | } 46 | 47 | + (BOOL)opensAtLogin { 48 | NSURL *appURL = [[[NSBundle mainBundle] bundleURL] fileReferenceURL]; 49 | 50 | UInt32 seed; 51 | NSArray *sharedFileListArray = (__bridge_transfer NSArray *)LSSharedFileListCopySnapshot([self sharedFileList], &seed); 52 | for (id item in sharedFileListArray) { 53 | LSSharedFileListItemRef sharedFileItem = (__bridge LSSharedFileListItemRef)item; 54 | CFURLRef url = NULL; 55 | 56 | OSStatus result = LSSharedFileListItemResolve(sharedFileItem, 0, &url, NULL); 57 | if (result == noErr && url != NULL) { 58 | BOOL foundIt = [appURL isEqual:[(__bridge NSURL *)url fileReferenceURL]]; 59 | 60 | CFRelease(url); 61 | 62 | if (foundIt) 63 | return YES; 64 | } 65 | } 66 | 67 | return NO; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /ModMove/Mouse.swift: -------------------------------------------------------------------------------- 1 | import CoreGraphics 2 | 3 | struct Mouse { 4 | static func currentPosition() -> CGPoint { 5 | return CGEvent(source: nil)!.location 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /ModMove/Mover.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | import Foundation 3 | 4 | final class Mover { 5 | var state: FlagState = .Ignore { 6 | didSet { 7 | if self.state != oldValue { 8 | self.changed(state: self.state) 9 | } 10 | } 11 | } 12 | 13 | private var monitor: Any? 14 | private var lastMousePosition: CGPoint? 15 | private var window: AccessibilityElement? 16 | 17 | private func mouseMoved(handler: (_ window: AccessibilityElement, _ mouseDelta: CGPoint) -> Void) { 18 | let point = Mouse.currentPosition() 19 | if self.window == nil { 20 | self.window = AccessibilityElement.systemWideElement.element(at: point)?.window() 21 | } 22 | 23 | guard let window = self.window else { 24 | return 25 | } 26 | 27 | let currentPid = NSRunningApplication.current.processIdentifier 28 | if let pid = window.pid(), pid != currentPid { 29 | NSRunningApplication(processIdentifier: pid)?.activate(options: .activateIgnoringOtherApps) 30 | } 31 | 32 | window.bringToFront() 33 | if let lastPosition = self.lastMousePosition { 34 | let mouseDelta = CGPoint(x: lastPosition.x - point.x, y: lastPosition.y - point.y) 35 | handler(window, mouseDelta) 36 | } 37 | 38 | self.lastMousePosition = point 39 | } 40 | 41 | private func resizeWindow(window: AccessibilityElement, mouseDelta: CGPoint) { 42 | if let size = window.size { 43 | let newSize = CGSize(width: size.width - mouseDelta.x, height: size.height - mouseDelta.y) 44 | window.size = newSize 45 | } 46 | } 47 | 48 | private func moveWindow(window: AccessibilityElement, mouseDelta: CGPoint) { 49 | if let position = window.position { 50 | let newPosition = CGPoint(x: position.x - mouseDelta.x, y: position.y - mouseDelta.y) 51 | window.position = newPosition 52 | } 53 | } 54 | 55 | private func changed(state: FlagState) { 56 | self.removeMonitor() 57 | 58 | switch state { 59 | case .Resize: 60 | self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved) { _ in 61 | self.mouseMoved(handler: self.resizeWindow) 62 | } 63 | case .Drag: 64 | self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .mouseMoved) { _ in 65 | self.mouseMoved(handler: self.moveWindow) 66 | } 67 | case .Ignore: 68 | self.lastMousePosition = nil 69 | self.window = nil 70 | } 71 | } 72 | 73 | private func removeMonitor() { 74 | if let monitor = self.monitor { 75 | NSEvent.removeMonitor(monitor) 76 | } 77 | self.monitor = nil 78 | } 79 | 80 | deinit { 81 | self.removeMonitor() 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /ModMove/Observer.swift: -------------------------------------------------------------------------------- 1 | import AppKit 2 | import Foundation 3 | 4 | enum FlagState { 5 | case Resize 6 | case Drag 7 | case Ignore 8 | } 9 | 10 | final class Observer { 11 | private var monitor: Any? 12 | 13 | func startObserving(state: @escaping (FlagState) -> Void) { 14 | self.monitor = NSEvent.addGlobalMonitorForEvents(matching: .flagsChanged) { event in 15 | state(self.state(for: event.modifierFlags)) 16 | } 17 | } 18 | 19 | private func state(for flags: NSEvent.ModifierFlags) -> FlagState { 20 | let hasMain = flags.contains(.control) && flags.contains(.option) 21 | let hasShift = flags.contains(.shift) 22 | 23 | if hasMain && hasShift { 24 | return .Resize 25 | } else if hasMain { 26 | return .Drag 27 | } else { 28 | return .Ignore 29 | } 30 | } 31 | 32 | deinit { 33 | if let monitor = self.monitor { 34 | NSEvent.removeMonitor(monitor) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /ModMove/Resources/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /ModMove/Resources/Base.lproj/MainMenu.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /ModMove/Resources/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.1.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.productivity 27 | LSMinimumSystemVersion 28 | $(MACOSX_DEPLOYMENT_TARGET) 29 | LSUIElement 30 | 31 | NSHumanReadableCopyright 32 | Copyright © 2020 Keith Smiley. All rights reserved. 33 | NSMainNibFile 34 | MainMenu 35 | NSPrincipalClass 36 | NSApplication 37 | 38 | 39 | -------------------------------------------------------------------------------- /ModMove/Resources/ModMove-Bridging-Header.h: -------------------------------------------------------------------------------- 1 | #import "LoginController.h" 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ModMove 2 | 3 | ModMove is a tiny macOS app that takes my favorite single piece of 4 | [HyperDock](https://bahoom.com/hyperdock/) and does just that. 5 | 6 | ## Usage 7 | 8 | There are 2 things ModMove can do: 9 | 10 | 1. To move the window under the cursor, hold Control (⌃) and Option (⌥), 11 | then move the mouse 12 | 2. To resize the window under the cursor, hold Control (⌃) and Option 13 | (⌥) and Shift (⇧), then move the mouse. 14 | 15 | ## Example 16 | 17 | ![](https://raw.githubusercontent.com/keith/ModMove/main/modmove.gif) 18 | 19 | ## Installation 20 | 21 | With [`brew-cask`](https://github.com/caskroom/homebrew-cask): 22 | 23 | ```sh 24 | brew cask install keith/formulae/modmove 25 | ``` 26 | 27 | Or manually by downloading the latest release from 28 | [here](https://github.com/keith/ModMove/releases) 29 | -------------------------------------------------------------------------------- /modmove.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/keith/ModMove/42351740483cf9982504f9de0537f3e41dece62d/modmove.gif --------------------------------------------------------------------------------