auto-terminal-profile 3.0.1 → 3.0.2
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 +3 -0
- package/changelog.md +12 -6
- package/config.js +5 -5
- package/functions/index.js +1 -0
- package/functions/is-terminal-open.js +18 -0
- package/package.json +5 -4
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
2
|
import {setTerminalProfile, setTerminalDefaultProfile} from 'terminal-profile';
|
|
3
3
|
import {config} from '../config.js';
|
|
4
|
+
import {isTerminalOpen} from '../functions/index.js';
|
|
4
5
|
|
|
5
6
|
export async function updateProfile() {
|
|
7
|
+
if (!(await isTerminalOpen())) return;
|
|
8
|
+
|
|
6
9
|
if (!config.darkProfile) {
|
|
7
10
|
throw new Error('Dark profile not set');
|
|
8
11
|
}
|
package/changelog.md
CHANGED
|
@@ -5,13 +5,19 @@ 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.
|
|
8
|
+
## [v3.0.2](https://github.com/patrik-csak/terminal-profile/compare/v3.0.1...v3.0.2) – 2024-02-21
|
|
9
9
|
|
|
10
10
|
### Fixed
|
|
11
11
|
|
|
12
|
-
-
|
|
12
|
+
- Fix Terminal opening when closed
|
|
13
13
|
|
|
14
|
-
## [v3.0.
|
|
14
|
+
## [v3.0.1](https://github.com/patrik-csak/terminal-profile/compare/v3.0.0...v3.0.1) – 2024-02-20
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Fix broken post-install compilation step
|
|
19
|
+
|
|
20
|
+
## [v3.0.0](https://github.com/patrik-csak/terminal-profile/compare/v2.1.0...v3.0.0) – 2024-02-19
|
|
15
21
|
|
|
16
22
|
### Removed
|
|
17
23
|
|
|
@@ -19,15 +25,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
19
25
|
|
|
20
26
|
### Fixed
|
|
21
27
|
|
|
22
|
-
-
|
|
28
|
+
- Fix issue causing `auto-terminal-profile` to silently fail on macOS Sonoma
|
|
23
29
|
|
|
24
|
-
## [v2.1.0](https://github.com/
|
|
30
|
+
## [v2.1.0](https://github.com/patrik-csak/terminal-profile/compare/v2.0.0...v2.1.0) – 2023-07-04
|
|
25
31
|
|
|
26
32
|
### Changed
|
|
27
33
|
|
|
28
34
|
- Update dependencies
|
|
29
35
|
|
|
30
|
-
## [2.0.0](https://github.com/
|
|
36
|
+
## [2.0.0](https://github.com/patrik-csak/terminal-profile/compare/v1.1.1...v2.0.0) – 2023-05-10
|
|
31
37
|
|
|
32
38
|
### Added
|
|
33
39
|
|
package/config.js
CHANGED
|
@@ -3,7 +3,7 @@ import {readPackageUp} from 'read-package-up';
|
|
|
3
3
|
|
|
4
4
|
const {packageJson} = await readPackageUp({cwd: new URL('.', import.meta.url)});
|
|
5
5
|
|
|
6
|
-
const
|
|
6
|
+
const config_ = new Conf({projectName: packageJson.name});
|
|
7
7
|
|
|
8
8
|
class Config {
|
|
9
9
|
keys = {
|
|
@@ -15,28 +15,28 @@ class Config {
|
|
|
15
15
|
* @return {string}
|
|
16
16
|
*/
|
|
17
17
|
get darkProfile() {
|
|
18
|
-
return
|
|
18
|
+
return config_.get(this.keys.darkProfile);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* @param {string} profile
|
|
23
23
|
*/
|
|
24
24
|
set darkProfile(profile) {
|
|
25
|
-
|
|
25
|
+
config_.set(this.keys.darkProfile, profile);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
29
|
* @return {string}
|
|
30
30
|
*/
|
|
31
31
|
get lightProfile() {
|
|
32
|
-
return
|
|
32
|
+
return config_.get(this.keys.lightProfile);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @param {string} profile
|
|
37
37
|
*/
|
|
38
38
|
set lightProfile(profile) {
|
|
39
|
-
|
|
39
|
+
config_.set(this.keys.lightProfile, profile);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
package/functions/index.js
CHANGED
|
@@ -2,3 +2,4 @@ export {enableAutomaticSwitching} from './enable-automatic-switching.js';
|
|
|
2
2
|
export {disableAutomaticSwitching} from './disable-automatic-switching.js';
|
|
3
3
|
export {getLaunchAgentPlistFileContents} from './get-launch-agent-plist-file-contents.js';
|
|
4
4
|
export {isAutomaticSwitchingEnabled} from './is-automatic-switching-enabled.js';
|
|
5
|
+
export {isTerminalOpen} from './is-terminal-open.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {runAppleScript} from 'run-applescript';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @returns {Promise<boolean>}
|
|
5
|
+
*/
|
|
6
|
+
export async function isTerminalOpen() {
|
|
7
|
+
const result = await runAppleScript(`tell application "System Events"
|
|
8
|
+
set isOpen to (name of processes) contains "Terminal"
|
|
9
|
+
end tell
|
|
10
|
+
|
|
11
|
+
if isOpen then
|
|
12
|
+
return "true"
|
|
13
|
+
else
|
|
14
|
+
return "false"
|
|
15
|
+
end if`);
|
|
16
|
+
|
|
17
|
+
return result === 'true';
|
|
18
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-terminal-profile",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Automatically switch macOS Terminal profile when system dark / light mode changes",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"macos",
|
|
@@ -9,10 +9,11 @@
|
|
|
9
9
|
"dark mode",
|
|
10
10
|
"profile"
|
|
11
11
|
],
|
|
12
|
+
"repository": "github:patrik-csak/auto-terminal-profile",
|
|
12
13
|
"license": "MIT",
|
|
13
14
|
"author": "Patrik Csak <p@trikcsak.com> (https://patrikcsak.com)",
|
|
15
|
+
"type": "module",
|
|
14
16
|
"bin": "./cli.js",
|
|
15
|
-
"repository": "github:patrik-csak/auto-terminal-profile",
|
|
16
17
|
"scripts": {
|
|
17
18
|
"format": "xo --fix && sort-package-json",
|
|
18
19
|
"postinstall": "cd dark-mode-notify && make build",
|
|
@@ -25,6 +26,7 @@
|
|
|
25
26
|
"execa": "^8.0.1",
|
|
26
27
|
"pupa": "^3.1.0",
|
|
27
28
|
"read-package-up": "^11.0.0",
|
|
29
|
+
"run-applescript": "^7.0.0",
|
|
28
30
|
"terminal-profile": "^2.0.0",
|
|
29
31
|
"untildify": "^5.0.0"
|
|
30
32
|
},
|
|
@@ -37,6 +39,5 @@
|
|
|
37
39
|
},
|
|
38
40
|
"os": [
|
|
39
41
|
"darwin"
|
|
40
|
-
]
|
|
41
|
-
"type": "module"
|
|
42
|
+
]
|
|
42
43
|
}
|