From d52289ef5a1b991b8dc4e429d9860cc8ef6160bc Mon Sep 17 00:00:00 2001 From: Nikita Bobko Date: Thu, 14 Sep 2023 01:01:44 +0200 Subject: [PATCH] Cleanup --- AeroSpace.xcodeproj/project.pbxproj | 4 ---- src/axWrappers/MacWindow.swift | 3 +-- src/util/OptionalEx.swift | 5 ----- 3 files changed, 1 insertion(+), 11 deletions(-) delete mode 100644 src/util/OptionalEx.swift diff --git a/AeroSpace.xcodeproj/project.pbxproj b/AeroSpace.xcodeproj/project.pbxproj index f1831a85..9a24db81 100644 --- a/AeroSpace.xcodeproj/project.pbxproj +++ b/AeroSpace.xcodeproj/project.pbxproj @@ -34,7 +34,6 @@ B0D0C37BAE7E7F0D0FF1E9FC /* GlobalObserver.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3C2E5977331398421A4FC168 /* GlobalObserver.swift */; }; B1E2002BB8F70F2555AAA82D /* TreeNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = D295CA45172ADBDB1E4DF708 /* TreeNode.swift */; }; B3702BB393A9B03CCAE4C60E /* refresh.swift in Sources */ = {isa = PBXBuildFile; fileRef = 526B113159987FA43EA41120 /* refresh.swift */; }; - C0A88261ECF505FC5648FC0A /* OptionalEx.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9EDFD4A9F45182CA6E0BD7B /* OptionalEx.swift */; }; D4F68F33C6E354856C80E729 /* ConfigModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6C3C4DD77B74C92C8C01E39 /* ConfigModel.swift */; }; E2F0C6DCC51CC7685FEF712E /* Command.swift in Sources */ = {isa = PBXBuildFile; fileRef = F73A72D792FC2A0B6B5CAD04 /* Command.swift */; }; E2FD8E2B2D2BE6B88BF8E8AD /* accessibility.swift in Sources */ = {isa = PBXBuildFile; fileRef = EE605CF46DE6377C69B9D49D /* accessibility.swift */; }; @@ -57,7 +56,6 @@ 6935AF0A2DB3D186D1C6218F /* NSWorkspaceEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSWorkspaceEx.swift; sourceTree = ""; }; 7E6F3930E3BF5D8196A20E9B /* axObservers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = axObservers.swift; sourceTree = ""; }; 883D7F7F87FBE7D0BDE4E87F /* ArrayEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrayEx.swift; sourceTree = ""; }; - A9EDFD4A9F45182CA6E0BD7B /* OptionalEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OptionalEx.swift; sourceTree = ""; }; AAE5DCAEC5EE619CE33859E7 /* SequenceEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SequenceEx.swift; sourceTree = ""; }; AF3BB3DD434C75536217CB88 /* NSScreenEx.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSScreenEx.swift; sourceTree = ""; }; BA7CD89E786588324DFB5575 /* defaultConfig.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = defaultConfig.swift; sourceTree = ""; }; @@ -166,7 +164,6 @@ F6507EBAA795220FD0C05384 /* Monitor.swift */, AF3BB3DD434C75536217CB88 /* NSScreenEx.swift */, 6935AF0A2DB3D186D1C6218F /* NSWorkspaceEx.swift */, - A9EDFD4A9F45182CA6E0BD7B /* OptionalEx.swift */, 28B788A95DD3C267878E05B5 /* Rect.swift */, AAE5DCAEC5EE619CE33859E7 /* SequenceEx.swift */, BD02433B4415EEB163074CE5 /* utils.swift */, @@ -262,7 +259,6 @@ 920FDF8498DCCB62149D1719 /* Monitor.swift in Sources */, 115F5CA4BEB80B645E66D198 /* NSScreenEx.swift in Sources */, A4F66097ADF0FD58C6B715AE /* NSWorkspaceEx.swift in Sources */, - C0A88261ECF505FC5648FC0A /* OptionalEx.swift in Sources */, 78EE0CEF814ABDBA67941B84 /* Rect.swift in Sources */, AE76A183D0454E4C8ADCE380 /* SequenceEx.swift in Sources */, 783B0B965BA45D7A2943F7BF /* TilingContainer.swift in Sources */, diff --git a/src/axWrappers/MacWindow.swift b/src/axWrappers/MacWindow.swift index 387c391f..88f4b830 100644 --- a/src/axWrappers/MacWindow.swift +++ b/src/axWrappers/MacWindow.swift @@ -49,8 +49,7 @@ class MacWindow: TreeNode, Hashable { parent = workspace weight = FLOATING_ADAPTIVE_WEIGHT } else { - let tilingParent = (workspace.lastActiveWindow?.parent).filterIsInstance(of: TilingContainer.self) - ?? workspace.rootTilingContainer + let tilingParent = workspace.lastActiveWindow?.parent as? TilingContainer ?? workspace.rootTilingContainer parent = tilingParent weight = parent.children.sumOf { $0.getWeight(tilingParent.orientation) } .div(parent.children.count) ?? 1 diff --git a/src/util/OptionalEx.swift b/src/util/OptionalEx.swift deleted file mode 100644 index e6c3feb8..00000000 --- a/src/util/OptionalEx.swift +++ /dev/null @@ -1,5 +0,0 @@ -extension Optional { - func filterIsInstance(of: R.Type) -> Optional { - self as? R ?? nil - } -}