Skip to content

Commit 2ca7c85

Browse files
authored
Merge pull request fuji-mak#72 from hubeen/contrib/intel-compat
Add Intel Mac source-build compatibility
2 parents f110641 + 085447a commit 2ca7c85

9 files changed

Lines changed: 69 additions & 23 deletions

File tree

.github/workflows/ci.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,42 @@ jobs:
3333
zsh -n scripts/notarize-pkg.sh
3434
zsh -n scripts/uninstall.sh
3535
36+
intel-compatibility:
37+
name: Intel x86_64 compatibility
38+
runs-on: macos-15-intel
39+
steps:
40+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
41+
- name: Build and test x86_64
42+
run: |
43+
test "$(uname -m)" = "x86_64"
44+
sw_vers
45+
swift --version
46+
xcodebuild -version
47+
swift build -c release
48+
swift test
49+
- name: Verify deployment targets
50+
run: |
51+
file .build/release/Capsomnia | grep -q 'x86_64'
52+
file .build/release/capsomnia-pmset | grep -q 'x86_64'
53+
otool -l .build/release/Capsomnia | grep -A3 LC_BUILD_VERSION | grep -q 'minos 13.5'
54+
otool -l .build/release/capsomnia-pmset | grep -A3 LC_BUILD_VERSION | grep -q 'minos 13.5'
55+
test "$(/usr/libexec/PlistBuddy -c 'Print :LSMinimumSystemVersion' resources/Info.plist)" = '13.5'
56+
57+
swift-59-compatibility:
58+
name: Swift 5.9 language compatibility
59+
runs-on: macos-14
60+
steps:
61+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
62+
- name: Build and test with Xcode 15.2
63+
run: |
64+
sudo xcode-select -s /Applications/Xcode_15.2.app
65+
swift --version | tee "$RUNNER_TEMP/swift-version"
66+
grep -Eq 'Swift version 5\.9(\.| )' "$RUNNER_TEMP/swift-version"
67+
xcodebuild -version | tee "$RUNNER_TEMP/xcode-version"
68+
grep -q 'Xcode 15.2' "$RUNNER_TEMP/xcode-version"
69+
swift build -c release
70+
swift test
71+
3672
site:
3773
name: GitHub Pages site
3874
runs-on: ubuntu-latest

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ All notable changes to Capsomnia will be documented in this file.
44

55
## Unreleased
66

7+
- Add Intel Mac source-install support for macOS 13.5 or later with Swift 5.9, while keeping the signed and notarized package Apple silicon-only on macOS 14 or later.
8+
79
## 3.0.0 - 2026-08-10
810

911
- Add an optional auto-off timer with 15-minute through 8-hour presets, a one-minute to 24-hour custom picker, a live countdown, and an explicit restart action in Advanced Settings.

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// swift-tools-version: 6.0
1+
// swift-tools-version: 5.9
22

33
import PackageDescription
44

55
let package = Package(
66
name: "Capsomnia",
77
platforms: [
8-
.macOS(.v14)
8+
.macOS("13.5")
99
],
1010
products: [
1111
.executable(name: "Capsomnia", targets: ["Capsomnia"]),
@@ -23,5 +23,5 @@ let package = Package(
2323
dependencies: ["Capsomnia"]
2424
)
2525
],
26-
swiftLanguageModes: [.v5]
26+
swiftLanguageVersions: [.v5]
2727
)

README.ja.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<p align="center">
1717
<a href="https://github.com/fuji-mak/Capsomnia/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fuji-mak/Capsomnia/ci.yml?branch=main&style=flat-square&label=CI&labelColor=111111&color=b7ff3c"></a>
1818
<img alt="macOS 14+" src="https://img.shields.io/badge/macOS-14%2B-b7ff3c?style=flat-square&labelColor=111111">
19-
<img alt="Swift 6" src="https://img.shields.io/badge/Swift-6-b7ff3c?style=flat-square&labelColor=111111">
19+
<img alt="Swift 5.9+" src="https://img.shields.io/badge/Swift-5.9%2B-b7ff3c?style=flat-square&labelColor=111111">
2020
<a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-b7ff3c?style=flat-square&labelColor=111111"></a>
2121
</p>
2222

@@ -44,7 +44,8 @@ Capsomnia 本体はネットワーク通信を行わず、テレメトリを収
4444

4545
必要なもの:
4646

47-
- Apple silicon Mac(macOS 14以降)
47+
- 署名済み upstream パッケージ: macOS 14 以降の Apple silicon Mac
48+
- ソースインストール: macOS 14 以降の Apple silicon Mac、またはmacOS 13.5 以降の Intel Mac
4849
- インストール時の管理者権限
4950

5051
署名済みパッケージでインストール:
@@ -58,15 +59,15 @@ Capsomnia 本体はネットワーク通信を行わず、テレメトリを収
5859

5960
## ソースからビルド
6061

61-
開発者向けのソースインストールも利用できます。こちらは Swift 6 toolchain が必要です
62+
開発者向けのソースインストールは、macOS 14 以降の Apple silicon MacとmacOS 13.5 以降の Intel Macに対応します。Xcode 15以降に含まれるSwift 5.9以降のtoolchainが必要です
6263

6364
```sh
6465
git clone https://github.com/fuji-mak/Capsomnia.git
6566
cd Capsomnia
6667
./scripts/install.sh
6768
```
6869

69-
ソースインストーラはローカルで `Capsomnia.app` をビルドし、`~/Applications/` に配置します。あわせて、同じ helper、sudoers rule、ユーザー LaunchAgent を設定します
70+
ソースインストーラはローカルで`Capsomnia.app`をビルドして`~/Applications/`へ配置し、限定的なhelperとsudoers ruleをインストールして、ユーザーLaunchAgentを起動します。署名・公証済みのリリースパッケージは引き続きApple silicon専用で、macOS 14以降が必要です
7071

7172
## できること
7273

README.ko.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<p align="center">
1717
<a href="https://github.com/fuji-mak/Capsomnia/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fuji-mak/Capsomnia/ci.yml?branch=main&style=flat-square&label=CI&labelColor=111111&color=b7ff3c"></a>
1818
<img alt="macOS 14+" src="https://img.shields.io/badge/macOS-14%2B-b7ff3c?style=flat-square&labelColor=111111">
19-
<img alt="Swift 6" src="https://img.shields.io/badge/Swift-6-b7ff3c?style=flat-square&labelColor=111111">
19+
<img alt="Swift 5.9+" src="https://img.shields.io/badge/Swift-5.9%2B-b7ff3c?style=flat-square&labelColor=111111">
2020
<a href="LICENSE"><img alt="MIT 라이선스" src="https://img.shields.io/badge/License-MIT-b7ff3c?style=flat-square&labelColor=111111"></a>
2121
</p>
2222

@@ -44,7 +44,8 @@ Capsomnia 자체는 네트워크 요청을 보내지 않고, 텔레메트리를
4444

4545
필요한 환경:
4646

47-
- macOS 14 이상을 실행하는 Apple silicon Mac
47+
- 업스트림 서명 패키지: macOS 14 이상을 실행하는 Apple silicon Mac
48+
- 소스 설치: macOS 14 이상을 실행하는 Apple silicon Mac 또는 macOS 13.5 이상을 실행하는 Intel Mac
4849
- 설치할 때 사용할 관리자 권한
4950

5051
서명된 패키지 설치 방법:
@@ -58,15 +59,15 @@ Capsomnia 자체는 네트워크 요청을 보내지 않고, 텔레메트리를
5859

5960
## 소스에서 빌드하기
6061

61-
개발자용 소스 설치도 지원하며 Swift 6 툴체인이 필요합니다.
62+
개발자용 소스 설치는 macOS 14 이상의 Apple silicon Mac과 macOS 13.5 이상의 Intel Mac을 지원합니다. Xcode 15 이상에 포함된 Swift 5.9 이상의 툴체인이 필요합니다.
6263

6364
```sh
6465
git clone https://github.com/fuji-mak/Capsomnia.git
6566
cd Capsomnia
6667
./scripts/install.sh
6768
```
6869

69-
소스 설치 프로그램은 `Capsomnia.app`로컬에서 빌드해 `~/Applications/`넣고, 같은 helper와 sudoers 규칙을 설치한 뒤 사용자 LaunchAgent를 시작합니다.
70+
소스 설치 프로그램은 로컬에서 `Capsomnia.app`을 빌드해 `~/Applications/`배치하고, 제한된 helper와 sudoers 규칙을 설치한 뒤 사용자 LaunchAgent를 시작합니다. 서명 및 공증된 릴리스 패키지는 계속 Apple silicon 전용이며 macOS 14 이상이 필요합니다.
7071

7172
## 작동 방식
7273

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<p align="center">
1717
<a href="https://github.com/fuji-mak/Capsomnia/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fuji-mak/Capsomnia/ci.yml?branch=main&style=flat-square&label=CI&labelColor=111111&color=b7ff3c"></a>
1818
<img alt="macOS 14+" src="https://img.shields.io/badge/macOS-14%2B-b7ff3c?style=flat-square&labelColor=111111">
19-
<img alt="Swift 6" src="https://img.shields.io/badge/Swift-6-b7ff3c?style=flat-square&labelColor=111111">
19+
<img alt="Swift 5.9+" src="https://img.shields.io/badge/Swift-5.9%2B-b7ff3c?style=flat-square&labelColor=111111">
2020
<a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/License-MIT-b7ff3c?style=flat-square&labelColor=111111"></a>
2121
</p>
2222

@@ -44,7 +44,8 @@ Capsomnia itself does not make network requests, collect telemetry, or require a
4444

4545
Requirements:
4646

47-
- Apple silicon Mac with macOS 14 or later
47+
- Signed upstream package: Apple silicon Mac with macOS 14 or later
48+
- Source install: Apple silicon Mac with macOS 14 or later, or Intel Mac with macOS 13.5 or later
4849
- Administrator access during installation
4950

5051
Install the signed package:
@@ -58,15 +59,15 @@ The package build and install scripts are public in [`scripts/build-pkg.sh`](scr
5859

5960
## Build From Source
6061

61-
Developer source install still works and requires a Swift 6 toolchain:
62+
Developer source installation supports Apple silicon Macs on macOS 14 or later and Intel Macs on macOS 13.5 or later. It requires Swift 5.9 or later, included with Xcode 15 or later:
6263

6364
```sh
6465
git clone https://github.com/fuji-mak/Capsomnia.git
6566
cd Capsomnia
6667
./scripts/install.sh
6768
```
6869

69-
The source installer builds `Capsomnia.app` locally, places it in `~/Applications/`, installs the same helper and sudoers rule, and starts a user LaunchAgent.
70+
The source installer builds `Capsomnia.app` locally, places it in `~/Applications/`, installs the restricted helper and sudoers rule, and starts a user LaunchAgent. The signed and notarized release package remains Apple silicon-only and requires macOS 14 or later.
7071

7172
## What It Does
7273

README.zh-Hans.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<p align="center">
1717
<a href="https://github.com/fuji-mak/Capsomnia/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/fuji-mak/Capsomnia/ci.yml?branch=main&style=flat-square&label=CI&labelColor=111111&color=b7ff3c"></a>
1818
<img alt="macOS 14+" src="https://img.shields.io/badge/macOS-14%2B-b7ff3c?style=flat-square&labelColor=111111">
19-
<img alt="Swift 6" src="https://img.shields.io/badge/Swift-6-b7ff3c?style=flat-square&labelColor=111111">
19+
<img alt="Swift 5.9+" src="https://img.shields.io/badge/Swift-5.9%2B-b7ff3c?style=flat-square&labelColor=111111">
2020
<a href="LICENSE"><img alt="MIT 许可证" src="https://img.shields.io/badge/License-MIT-b7ff3c?style=flat-square&labelColor=111111"></a>
2121
</p>
2222

@@ -46,7 +46,8 @@ Capsomnia本身不会发起网络请求、收集遥测数据,也不需要账
4646

4747
要求:
4848

49-
- 搭载Apple芯片、运行macOS 14或更高版本的Mac
49+
- 上游签名软件包:运行macOS 14或更高版本的Apple芯片Mac
50+
- 源代码安装:运行macOS 14或更高版本的Apple芯片Mac,或运行macOS 13.5或更高版本的Intel Mac
5051
- 安装时拥有管理员权限
5152

5253
安装已签名的软件包:
@@ -60,15 +61,15 @@ Capsomnia本身不会发起网络请求、收集遥测数据,也不需要账
6061

6162
## 从源代码构建
6263

63-
开发者仍可从源代码安装,需要Swift 6工具链
64+
开发者源代码安装支持运行macOS 14或更高版本的Apple芯片Mac,以及运行macOS 13.5或更高版本的Intel Mac。需要Xcode 15或更高版本附带的Swift 5.9或更高版本工具链
6465

6566
```sh
6667
git clone https://github.com/fuji-mak/Capsomnia.git
6768
cd Capsomnia
6869
./scripts/install.sh
6970
```
7071

71-
源代码安装器会在本地构建`Capsomnia.app`,将其放入`~/Applications/`安装同样的辅助程序和sudoers规则,并启动用户LaunchAgent。
72+
源代码安装程序会在本地构建`Capsomnia.app`,将其放入`~/Applications/`安装权限受限的辅助程序和sudoers规则,并启动用户LaunchAgent。已签名并经过公证的发布软件包仍仅支持Apple芯片,并要求macOS 14或更高版本
7273

7374
## 功能
7475

Tests/CapsomniaTests/SettingsWindowControllerTests.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ final class SettingsWindowControllerTests: XCTestCase {
2323
let contentView = try XCTUnwrap(controller.window?.contentView)
2424
contentView.layoutSubtreeIfNeeded()
2525

26-
var renderedText = Set(visibleDescendants(of: contentView).map(\NSTextField.stringValue))
26+
var renderedText = Set(
27+
(visibleDescendants(of: contentView) as [NSTextField]).map(\.stringValue)
28+
)
2729
XCTAssertTrue(renderedText.contains(strings.initialPreferencesHeading))
2830
XCTAssertTrue(renderedText.contains(strings.dedicatedCapsLockMode))
2931
XCTAssertFalse(renderedText.contains(strings.preferencesHeading))
@@ -39,7 +41,9 @@ final class SettingsWindowControllerTests: XCTestCase {
3941
controller.show(page: .settings)
4042
contentView.layoutSubtreeIfNeeded()
4143

42-
renderedText = Set(visibleDescendants(of: contentView).map(\NSTextField.stringValue))
44+
renderedText = Set(
45+
(visibleDescendants(of: contentView) as [NSTextField]).map(\.stringValue)
46+
)
4347
XCTAssertTrue(renderedText.contains(strings.preferencesHeading))
4448
XCTAssertFalse(renderedText.contains(strings.displaySleepOnLidClose))
4549
XCTAssertFalse(renderedText.contains(strings.openAtLogin))
@@ -155,7 +159,7 @@ final class SettingsWindowControllerTests: XCTestCase {
155159
XCTAssertEqual(advancedWindow.title, strings.advancedSettings)
156160

157161
let visibleLabels: [NSTextField] = visibleDescendants(of: contentView)
158-
let renderedText = Set(visibleLabels.map(\NSTextField.stringValue))
162+
let renderedText = Set(visibleLabels.map { $0.stringValue })
159163
for expected in [
160164
strings.advancedSettings,
161165
strings.preferencesHeading.uppercased(),

resources/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<string>3.0.0</string>
3535

3636
<key>LSMinimumSystemVersion</key>
37-
<string>14.0</string>
37+
<string>13.5</string>
3838

3939
<key>LSUIElement</key>
4040
<true/>

0 commit comments

Comments
 (0)