auto-terminal-profile 2.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/actions/update-profile.js +2 -2
- package/changelog.md +22 -0
- package/config.js +1 -1
- package/constants/package-json.js +1 -1
- package/dark-mode-notify/Makefile +17 -0
- package/dark-mode-notify/Package.swift +15 -0
- package/dark-mode-notify/README.md +6 -2
- package/dark-mode-notify/{dark-mode-notify.swift → main.swift} +9 -5
- package/functions/get-launch-agent-plist-file-contents.js +4 -1
- package/package.json +14 -14
- package/readme.md +2 -2
- package/templates/launch-agent.xml +5 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import process from 'node:process';
|
|
2
2
|
import {setTerminalProfile, setTerminalDefaultProfile} from 'terminal-profile';
|
|
3
3
|
import {config} from '../config.js';
|
|
4
4
|
|
|
@@ -11,7 +11,7 @@ export async function updateProfile() {
|
|
|
11
11
|
throw new Error('Light profile not set');
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const mode =
|
|
14
|
+
const mode = process.env.DARKMODE === '1' ? 'dark' : 'light';
|
|
15
15
|
const profile = config[`${mode}Profile`];
|
|
16
16
|
|
|
17
17
|
await Promise.all([
|
package/changelog.md
CHANGED
|
@@ -5,6 +5,28 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [v3.0.1](https://github.com/ptrkcsk/terminal-profile/compare/v3.0.0...v3.0.1) – 2024-02-20
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Broken post-install compilation step
|
|
13
|
+
|
|
14
|
+
## [v3.0.0](https://github.com/ptrkcsk/terminal-profile/compare/v2.1.0...v3.0.0) – 2024-02-19
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
|
|
18
|
+
- Support for Node.js versions before 18
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Issue causing `auto-terminal-profile` to silently fail on macOS Sonoma
|
|
23
|
+
|
|
24
|
+
## [v2.1.0](https://github.com/ptrkcsk/terminal-profile/compare/v2.0.0...v2.1.0) – 2023-07-04
|
|
25
|
+
|
|
26
|
+
### Changed
|
|
27
|
+
|
|
28
|
+
- Update dependencies
|
|
29
|
+
|
|
8
30
|
## [2.0.0](https://github.com/ptrkcsk/terminal-profile/compare/v1.1.1...v2.0.0) – 2023-05-10
|
|
9
31
|
|
|
10
32
|
### Added
|
package/config.js
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
prefix ?= /usr/local
|
|
2
|
+
bindir = $(prefix)/bin
|
|
3
|
+
|
|
4
|
+
build:
|
|
5
|
+
swift build -c release --disable-sandbox
|
|
6
|
+
|
|
7
|
+
install: build
|
|
8
|
+
install -d "$(bindir)"
|
|
9
|
+
install ".build/release/dark-mode-notify" "$(bindir)"
|
|
10
|
+
|
|
11
|
+
uninstall:
|
|
12
|
+
rm -rf "$(bindir)/dark-mode-notify"
|
|
13
|
+
|
|
14
|
+
clean:
|
|
15
|
+
rm -rf .build
|
|
16
|
+
|
|
17
|
+
.PHONY: build install uninstall clean
|
|
@@ -4,9 +4,13 @@ This small Swift program will run a command whenever the dark mode status change
|
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Use make to compile the program, then run directly:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
```shell
|
|
10
|
+
.build/release/dark-mode-notify <your-program>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Alternatively you can install it by doing `make install`.
|
|
10
14
|
|
|
11
15
|
The program will be run immediately when the command starts, and every time the OS goes from dark mode to light mode or back. The environment variable `DARKMODE` will be set to either `1` or `0`.
|
|
12
16
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
#!/usr/bin/env swift
|
|
2
|
-
|
|
3
|
-
// Run as ./notify.swift <program to run when dark mode changes>
|
|
4
1
|
// The program will have the DARKMODE env flag set to 1 or 0
|
|
5
|
-
//
|
|
6
|
-
//
|
|
2
|
+
// Compile with:
|
|
3
|
+
// swift build
|
|
7
4
|
// And run the binary directly
|
|
8
5
|
// Most credit goes to https://github.com/mnewt/dotemacs/blob/master/bin/dark-mode-notifier.swift
|
|
9
6
|
|
|
@@ -35,4 +32,11 @@ DistributedNotificationCenter.default.addObserver(
|
|
|
35
32
|
shell(args)
|
|
36
33
|
}
|
|
37
34
|
|
|
35
|
+
NSWorkspace.shared.notificationCenter.addObserver(
|
|
36
|
+
forName: NSWorkspace.didWakeNotification,
|
|
37
|
+
object: nil,
|
|
38
|
+
queue: nil) { (notification) in
|
|
39
|
+
shell(args)
|
|
40
|
+
}
|
|
41
|
+
|
|
38
42
|
NSApplication.shared.run()
|
|
@@ -15,7 +15,10 @@ export async function getLaunchAgentPlistFileContents() {
|
|
|
15
15
|
new URL('../cli.js', import.meta.url),
|
|
16
16
|
),
|
|
17
17
|
darkModeNotifyPath: fileURLToPath(
|
|
18
|
-
new URL(
|
|
18
|
+
new URL(
|
|
19
|
+
'../dark-mode-notify/.build/release/dark-mode-notify',
|
|
20
|
+
import.meta.url,
|
|
21
|
+
),
|
|
19
22
|
),
|
|
20
23
|
logPath: envPaths(packageJson.name).log,
|
|
21
24
|
path: process.env.PATH,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-terminal-profile",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "Automatically switch
|
|
3
|
+
"version": "3.0.1",
|
|
4
|
+
"description": "Automatically switch macOS Terminal profile when system dark / light mode changes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"macos",
|
|
7
7
|
"terminal",
|
|
@@ -10,30 +10,30 @@
|
|
|
10
10
|
"profile"
|
|
11
11
|
],
|
|
12
12
|
"license": "MIT",
|
|
13
|
-
"author": "Patrik Csak <p@trikcsak.com>",
|
|
14
|
-
"funding": "https://www.buymeacoffee.com/patrikcsak",
|
|
13
|
+
"author": "Patrik Csak <p@trikcsak.com> (https://patrikcsak.com)",
|
|
15
14
|
"bin": "./cli.js",
|
|
16
15
|
"repository": "github:patrik-csak/auto-terminal-profile",
|
|
17
16
|
"scripts": {
|
|
18
|
-
"format": "xo --fix",
|
|
19
|
-
"
|
|
17
|
+
"format": "xo --fix && sort-package-json",
|
|
18
|
+
"postinstall": "cd dark-mode-notify && make build",
|
|
19
|
+
"test": "xo && sort-package-json --check"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"commander": "^
|
|
23
|
-
"conf": "^
|
|
24
|
-
"dark-mode": "^4.0.0",
|
|
22
|
+
"commander": "^12.0.0",
|
|
23
|
+
"conf": "^12.0.0",
|
|
25
24
|
"env-paths": "^3.0.0",
|
|
26
|
-
"execa": "^
|
|
25
|
+
"execa": "^8.0.1",
|
|
27
26
|
"pupa": "^3.1.0",
|
|
28
|
-
"read-
|
|
27
|
+
"read-package-up": "^11.0.0",
|
|
29
28
|
"terminal-profile": "^2.0.0",
|
|
30
|
-
"untildify": "^
|
|
29
|
+
"untildify": "^5.0.0"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
33
|
-
"
|
|
32
|
+
"sort-package-json": "^2.7.0",
|
|
33
|
+
"xo": "^0.57.0"
|
|
34
34
|
},
|
|
35
35
|
"engines": {
|
|
36
|
-
"node": ">=
|
|
36
|
+
"node": ">=18 <=20"
|
|
37
37
|
},
|
|
38
38
|
"os": [
|
|
39
39
|
"darwin"
|
package/readme.md
CHANGED
|
@@ -6,7 +6,7 @@ Automatically switch the macOS Terminal profile based on the system-wide dark /
|
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
9
|
-
- [Node.js](https://nodejs.org/en/)
|
|
9
|
+
- [Node.js](https://nodejs.org/en/) 18–20
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
@@ -32,4 +32,4 @@ auto-terminal-profile --help
|
|
|
32
32
|
|
|
33
33
|
## Acknowledgements
|
|
34
34
|
|
|
35
|
-
Thanks
|
|
35
|
+
Thanks [Bouke van der Bijl](https://bou.ke) for his project [dark-mode-notify](https://github.com/bouk/dark-mode-notify), which this project depends on
|
|
@@ -5,17 +5,22 @@
|
|
|
5
5
|
<dict>
|
|
6
6
|
<key>Label</key>
|
|
7
7
|
<string>ke.bou.dark-mode-notify</string>
|
|
8
|
+
|
|
8
9
|
<key>KeepAlive</key>
|
|
9
10
|
<true/>
|
|
11
|
+
|
|
10
12
|
<key>StandardErrorPath</key>
|
|
11
13
|
<string>{logPath}/dark-mode-notify-stderr.log</string>
|
|
14
|
+
|
|
12
15
|
<key>StandardOutPath</key>
|
|
13
16
|
<string>{logPath}/dark-mode-notify-stdout.log</string>
|
|
17
|
+
|
|
14
18
|
<key>EnvironmentVariables</key>
|
|
15
19
|
<dict>
|
|
16
20
|
<key>PATH</key>
|
|
17
21
|
<string>{path}</string>
|
|
18
22
|
</dict>
|
|
23
|
+
|
|
19
24
|
<key>ProgramArguments</key>
|
|
20
25
|
<array>
|
|
21
26
|
<string>{darkModeNotifyPath}</string>
|