auto-terminal-profile 3.0.2 → 4.0.0
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/.github/funding.yml +1 -0
- package/actions/update-profile.js +9 -4
- package/changelog.md +18 -4
- package/package.json +3 -1
- package/readme.md +26 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
buy_me_a_coffee: patrikcsak
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import darkMode from 'dark-mode';
|
|
2
2
|
import {setTerminalProfile, setTerminalDefaultProfile} from 'terminal-profile';
|
|
3
3
|
import {config} from '../config.js';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
isAutomaticSwitchingEnabled,
|
|
6
|
+
isTerminalOpen,
|
|
7
|
+
} from '../functions/index.js';
|
|
5
8
|
|
|
6
9
|
export async function updateProfile() {
|
|
7
|
-
if (!(await isTerminalOpen()))
|
|
10
|
+
if (!(await isAutomaticSwitchingEnabled()) || !(await isTerminalOpen())) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
8
13
|
|
|
9
14
|
if (!config.darkProfile) {
|
|
10
15
|
throw new Error('Dark profile not set');
|
|
@@ -14,7 +19,7 @@ export async function updateProfile() {
|
|
|
14
19
|
throw new Error('Light profile not set');
|
|
15
20
|
}
|
|
16
21
|
|
|
17
|
-
const mode =
|
|
22
|
+
const mode = (await darkMode.isEnabled()) ? 'dark' : 'light';
|
|
18
23
|
const profile = config[`${mode}Profile`];
|
|
19
24
|
|
|
20
25
|
await Promise.all([
|
package/changelog.md
CHANGED
|
@@ -5,19 +5,33 @@ 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
|
-
## [
|
|
8
|
+
## [4.0.0](https://github.com/patrik-csak/terminal-profile/compare/v3.0.2...v4.0.0) – 2024-03-25
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Documentation explaining how to automatically update Terminal profile when opening Terminal
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- **BREAKING**: `update-profile` gets appearance mode from OS instead of from `DARKMODE` environment variable
|
|
17
|
+
|
|
18
|
+
## [3.0.2](https://github.com/patrik-csak/terminal-profile/compare/v3.0.1...v3.0.2) – 2024-02-21
|
|
9
19
|
|
|
10
20
|
### Fixed
|
|
11
21
|
|
|
12
22
|
- Fix Terminal opening when closed
|
|
13
23
|
|
|
14
|
-
## [
|
|
24
|
+
## [3.0.1](https://github.com/patrik-csak/terminal-profile/compare/v3.0.0...v3.0.1) – 2024-02-20
|
|
15
25
|
|
|
16
26
|
### Fixed
|
|
17
27
|
|
|
18
28
|
- Fix broken post-install compilation step
|
|
19
29
|
|
|
20
|
-
## [
|
|
30
|
+
## [3.0.0](https://github.com/patrik-csak/terminal-profile/compare/v2.1.0...v3.0.0) – 2024-02-19
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **BREAKING**: `update-profile` gets appearance mode from `DARKMODE` environment variable instead of from OS
|
|
21
35
|
|
|
22
36
|
### Removed
|
|
23
37
|
|
|
@@ -27,7 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
27
41
|
|
|
28
42
|
- Fix issue causing `auto-terminal-profile` to silently fail on macOS Sonoma
|
|
29
43
|
|
|
30
|
-
## [
|
|
44
|
+
## [2.1.0](https://github.com/patrik-csak/terminal-profile/compare/v2.0.0...v2.1.0) – 2023-07-04
|
|
31
45
|
|
|
32
46
|
### Changed
|
|
33
47
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-terminal-profile",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "Automatically switch macOS Terminal profile when system dark / light mode changes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"macos",
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
"profile"
|
|
11
11
|
],
|
|
12
12
|
"repository": "github:patrik-csak/auto-terminal-profile",
|
|
13
|
+
"funding": "https://buymeacoffee.com/patrikcsak",
|
|
13
14
|
"license": "MIT",
|
|
14
15
|
"author": "Patrik Csak <p@trikcsak.com> (https://patrikcsak.com)",
|
|
15
16
|
"type": "module",
|
|
@@ -22,6 +23,7 @@
|
|
|
22
23
|
"dependencies": {
|
|
23
24
|
"commander": "^12.0.0",
|
|
24
25
|
"conf": "^12.0.0",
|
|
26
|
+
"dark-mode": "^4.0.0",
|
|
25
27
|
"env-paths": "^3.0.0",
|
|
26
28
|
"execa": "^8.0.1",
|
|
27
29
|
"pupa": "^3.1.0",
|
package/readme.md
CHANGED
|
@@ -1,35 +1,51 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Auto Terminal Profile
|
|
2
2
|
|
|
3
|
-
Automatically switch
|
|
3
|
+
Automatically switch [macOS Terminal](https://en.wikipedia.org/wiki/Terminal_%28macOS%29) profiles when the [dark / light appearance mode](https://support.apple.com/guide/mac-help/use-a-light-or-dark-appearance-mchl52e1c2d2/mac) changes
|
|
4
4
|
|
|
5
5
|

|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
9
|
-
- [Node.js](https://nodejs.org/
|
|
9
|
+
- [Node.js](https://nodejs.org/) 18–20
|
|
10
10
|
|
|
11
11
|
## Installation
|
|
12
12
|
|
|
13
|
-
```
|
|
13
|
+
```shell
|
|
14
14
|
npm install --global auto-terminal-profile
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
## Usage
|
|
18
18
|
|
|
19
|
+
### Enable automatic profile switching
|
|
20
|
+
|
|
19
21
|
To get started, enable automatic profile switching and set your preferred dark and light mode profiles:
|
|
20
22
|
|
|
21
|
-
```
|
|
23
|
+
```shell
|
|
22
24
|
auto-terminal-profile enable \
|
|
23
25
|
--dark-profile='One Dark' \
|
|
24
26
|
--light-profile='One Light'
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
### Switch profile on Terminal startup
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
Auto Terminal Profile only runs if Terminal is running, so the profile can fall out of sync if the macOS appearance mode changes while Terminal isn’t running.
|
|
32
|
+
|
|
33
|
+
To sync the Terminal profile to the current macOS appearance mode once:
|
|
34
|
+
|
|
35
|
+
```shell
|
|
36
|
+
auto-terminal-profile update-profile
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
To sync the Terminal profile to the current macOS appearance mode when Terminal app is opened, you can add that line to your shell startup script (e.g. `.zshrc`), but it will increase the startup time of new shell sessions.
|
|
40
|
+
|
|
41
|
+
### Disable automatic profile switching
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
auto-terminal-profile disable
|
|
31
45
|
```
|
|
32
46
|
|
|
33
|
-
|
|
47
|
+
### Help
|
|
34
48
|
|
|
35
|
-
|
|
49
|
+
```shell
|
|
50
|
+
auto-terminal-profile --help
|
|
51
|
+
```
|