Skip to content

Commit

Permalink
Amethyst 0.20.0 (#1475)
Browse files Browse the repository at this point in the history
* Amethyst 0.20.0 beta

* Remove observer for current notification on errors (#1500)

* 0.20.0 Beta 2

* Amethyst 0.20.0b3 to fix build issue

* Implement more robust window focus mechanism (#1530)

* Implement more robust window focus mechanism

* Clean things up a bit

* Bump version for beta 4

* Update to Podfile to satisfy libarclite linking error

* Update cocoapods

* Bump version to final
  • Loading branch information
ianyh committed Aug 14, 2023
1 parent 19bc2b1 commit 4d0e820
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 59 deletions.
34 changes: 16 additions & 18 deletions Amethyst.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
402DB6F21742E41A00D1C936 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 402DB6F01742E41A00D1C936 /* Credits.rtf */; };
402DB6F81742E41A00D1C936 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 402DB6F61742E41A00D1C936 /* MainMenu.xib */; };
402DB6FF1742E44E00D1C936 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 402DB6FE1742E44E00D1C936 /* Carbon.framework */; };
402F6FA62A81C9E30036B512 /* SkyLight.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 402F6FA52A81C9E30036B512 /* SkyLight.framework */; };
403E1A2A2337173600DB7B2A /* FloatingLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 403E1A292337173600DB7B2A /* FloatingLayoutTests.swift */; };
403E1A2C233719E500DB7B2A /* TallLayoutTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 403E1A2B233719E500DB7B2A /* TallLayoutTests.swift */; };
4045416F268FFDA000861BE8 /* CustomLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4045416E268FFDA000861BE8 /* CustomLayout.swift */; };
Expand Down Expand Up @@ -124,19 +125,6 @@
};
/* End PBXContainerItemProxy section */

/* Begin PBXCopyFilesBuildPhase section */
40B42F3225315F410000380A /* Embed Frameworks */ = {
isa = PBXCopyFilesBuildPhase;
buildActionMask = 12;
dstPath = "";
dstSubfolderSpec = 10;
files = (
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXCopyFilesBuildPhase section */

/* Begin PBXFileReference section */
1A4B46EA20AA7717003D5110 /* NSTableView+Amethyst.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSTableView+Amethyst.swift"; sourceTree = "<group>"; };
2A6D9A4025E5D24D006A36B5 /* AppManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppManager.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -178,6 +166,7 @@
402DB6EB1742E41A00D1C936 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
402DB6F11742E41A00D1C936 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = "<group>"; };
402DB6FE1742E44E00D1C936 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = System/Library/Frameworks/Carbon.framework; sourceTree = SDKROOT; };
402F6FA52A81C9E30036B512 /* SkyLight.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SkyLight.framework; path = /System/Library/PrivateFrameworks/SkyLight.framework; sourceTree = "<absolute>"; };
40378E22238F39B900D11E22 /* Amethyst.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = Amethyst.entitlements; sourceTree = "<group>"; };
403E1A292337173600DB7B2A /* FloatingLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FloatingLayoutTests.swift; sourceTree = "<group>"; };
403E1A2B233719E500DB7B2A /* TallLayoutTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TallLayoutTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -271,6 +260,7 @@
40C3F91E1BD1B22E00F58660 /* Security.framework in Frameworks */,
40CF37C029B440A100CDB07A /* ArgumentParser in Frameworks */,
ED989E6BAE0E8D035277478A /* Pods_Amethyst.framework in Frameworks */,
402F6FA62A81C9E30036B512 /* SkyLight.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -386,6 +376,7 @@
402DB6E01742E41A00D1C936 /* Frameworks */ = {
isa = PBXGroup;
children = (
402F6FA52A81C9E30036B512 /* SkyLight.framework */,
40C3F9241BD1B36C00F58660 /* libz.tbd */,
40C3F9221BD1B35E00F58660 /* libc++.tbd */,
40C3F91A1BD1B22E00F58660 /* Security.framework */,
Expand Down Expand Up @@ -608,7 +599,6 @@
402DB6DB1742E41A00D1C936 /* Frameworks */,
402DB6DC1742E41A00D1C936 /* Resources */,
D47F3405558308F2EB634A66 /* [CP] Embed Pods Frameworks */,
40B42F3225315F410000380A /* Embed Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -1090,7 +1080,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 103;
CURRENT_PROJECT_VERSION = 108;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -1107,13 +1097,17 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"DEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.amethyst.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Amethyst/Amethyst-Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SYSTEM_FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
);
WRAPPER_EXTENSION = app;
};
name = Debug;
Expand All @@ -1128,7 +1122,7 @@
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 103;
CURRENT_PROJECT_VERSION = 108;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = 82P2XLB4UH;
ENABLE_HARDENED_RUNTIME = YES;
Expand All @@ -1145,13 +1139,17 @@
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MARKETING_VERSION = 0.19.0;
MARKETING_VERSION = 0.20.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"RELEASE\"";
PRODUCT_BUNDLE_IDENTIFIER = "com.amethyst.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "Amethyst/Amethyst-Bridging-Header.h";
SYSTEM_FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks",
);
WRAPPER_EXTENSION = app;
};
name = Release;
Expand Down
46 changes: 46 additions & 0 deletions Amethyst/Model/Window.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@
import Foundation
import Silica

// swiftlint:disable identifier_name
@_silgen_name("GetProcessForPID") @discardableResult
func GetProcessForPID(_ pid: pid_t, _ psn: inout ProcessSerialNumber) -> OSStatus

@_silgen_name("_SLPSSetFrontProcessWithOptions") @discardableResult
func _SLPSSetFrontProcessWithOptions(_ psn: inout ProcessSerialNumber, _ wid: UInt32, _ mode: UInt32) -> CGError

@_silgen_name("SLPSPostEventRecordTo") @discardableResult
func SLPSPostEventRecordTo(_ psn: inout ProcessSerialNumber, _ bytes: inout UInt8) -> CGError

let kCPSUserGenerated: UInt32 = 0x200
// swiftlint:enable identifier_name

/// Generic protocol for objects acting as windows in the system.
protocol WindowType: Equatable {
associatedtype Screen: ScreenType
Expand Down Expand Up @@ -270,8 +283,41 @@ extension AXWindow: WindowType {
- Returns:
`true` if the window was successfully focused, `false` otherwise.
- Description:
What a mess. See: https://github.com/Hammerspoon/hammerspoon/issues/370#issuecomment-545545468
*/
@discardableResult override func focus() -> Bool {
var pid = self.pid()
var wid = self.cgID()
var psn = ProcessSerialNumber()
let status = GetProcessForPID(pid, &psn)

guard status == noErr else {
return false
}

var cgStatus = _SLPSSetFrontProcessWithOptions(&psn, wid, kCPSUserGenerated)

guard cgStatus == .success else {
return false
}

for byte in [0x01, 0x02] {
var bytes = [UInt8](repeating: 0, count: 0xf8)
bytes[0x04] = 0xF8
bytes[0x08] = UInt8(byte)
bytes[0x3a] = 0x10
memcpy(&bytes[0x3c], &wid, MemoryLayout<UInt32>.size)
memset(&bytes[0x20], 0xFF, 0x10)
cgStatus = bytes.withUnsafeMutableBufferPointer { pointer in
return SLPSPostEventRecordTo(&psn, &pointer.baseAddress!.pointee)
}
guard cgStatus == .success else {
return false
}
}

guard super.focus() else {
return false
}
Expand Down
54 changes: 27 additions & 27 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,40 @@ GEM
specs:
CFPropertyList (3.0.6)
rexml
activesupport (7.0.4.3)
activesupport (7.0.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
addressable (2.8.1)
addressable (2.8.5)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.15)
atomos (0.1.3)
aws-eventstream (1.2.0)
aws-partitions (1.721.0)
aws-sdk-core (3.170.0)
aws-partitions (1.799.0)
aws-sdk-core (3.180.2)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.63.0)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-kms (1.71.0)
aws-sdk-core (~> 3, >= 3.177.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.119.1)
aws-sdk-core (~> 3, >= 3.165.0)
aws-sdk-s3 (1.132.0)
aws-sdk-core (~> 3, >= 3.179.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.4)
aws-sigv4 (1.5.2)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.6.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
claide (1.1.0)
cocoapods (1.12.0)
cocoapods (1.12.1)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.12.0)
cocoapods-core (= 1.12.1)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.6.0, < 2.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -51,7 +51,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.21.0, < 2.0)
cocoapods-core (1.12.0)
cocoapods-core (1.12.1)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -76,7 +76,7 @@ GEM
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
declarative (0.0.20)
digest-crc (0.6.4)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
Expand All @@ -85,7 +85,7 @@ GEM
escape (0.0.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.99.0)
excon (0.100.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
Expand Down Expand Up @@ -114,8 +114,8 @@ GEM
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.2.6)
fastlane (2.212.1)
fastimage (2.2.7)
fastlane (2.214.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
Expand All @@ -139,7 +139,7 @@ GEM
json (< 3.0.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (~> 0.1.1)
plist (>= 3.1.0, < 4.0.0)
Expand All @@ -158,9 +158,9 @@ GEM
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-apis-androidpublisher_v3 (0.34.0)
google-apis-core (>= 0.9.1, < 2.a)
google-apis-core (0.11.0)
google-apis-androidpublisher_v3 (0.47.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.1)
addressable (~> 2.5, >= 2.5.1)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
Expand Down Expand Up @@ -189,7 +189,7 @@ GEM
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (1.3.0)
googleauth (1.7.0)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
Expand All @@ -200,18 +200,18 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.12.0)
i18n (1.14.1)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.6.3)
jwt (2.7.0)
jwt (2.7.1)
memoist (0.16.2)
mini_magick (4.12.0)
mini_mime (1.1.2)
minitest (5.18.0)
minitest (5.19.0)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.0.0)
multipart-post (2.3.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.1)
Expand All @@ -226,7 +226,7 @@ GEM
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.5)
rexml (3.2.6)
rouge (2.0.7)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
Expand Down
8 changes: 8 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ target 'Amethyst' do
pod 'Quick', '~> 6.1.0'
end
end

post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['MACOSX_DEPLOYMENT_TARGET'] = '10.15'
end
end
end
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,6 @@ SPEC CHECKSUMS:
SwiftyJSON: 2f33a42c6fbc52764d96f13368585094bfd8aa5e
Yams: 271b5757cee031e087ae6322128895c04826c4f3

PODFILE CHECKSUM: 7f3c6d976af94958786a21fa983f23ac6d6a2228
PODFILE CHECKSUM: e7a446e7b3ceed16b4b55f718810ae8d01c36a0d

COCOAPODS: 1.12.0
COCOAPODS: 1.12.1
26 changes: 14 additions & 12 deletions fastlane/README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
fastlane documentation
================
----

# Installation

Make sure you have the latest version of the Xcode command line tools installed:

```
```sh
xcode-select --install
```

Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew install fastlane`
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)

# Available Actions

### mac

```sh
[bundle exec] fastlane mac
```
fastlane mac
```



----

This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.

More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).

The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).

0 comments on commit 4d0e820

Please sign in to comment.