qdesk 1.0.2 → 1.0.4
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/dist/index.js +18 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
2
3
|
import process from "node:process";
|
|
3
4
|
import { normalizeChord, startListening } from "./chord-utils.js";
|
|
4
5
|
import { setScreenHue } from "./screen-hue.js";
|
|
@@ -6,6 +7,23 @@ import { activateWindowByHandle, getActiveWindowHandleAndName, } from "./window-
|
|
|
6
7
|
// Configure this chord at the top of file.
|
|
7
8
|
const DEFAULT_ADD_CHORD = "win+ctrl+a";
|
|
8
9
|
const DEFAULT_DROP_CHORD = "win+ctrl+d";
|
|
10
|
+
function hasCliFlag(flag) {
|
|
11
|
+
return process.argv.slice(2).includes(flag);
|
|
12
|
+
}
|
|
13
|
+
function getPackageVersion() {
|
|
14
|
+
try {
|
|
15
|
+
const packageJson = readFileSync(new URL("../package.json", import.meta.url), "utf8");
|
|
16
|
+
const parsed = JSON.parse(packageJson);
|
|
17
|
+
return parsed.version ?? "unknown";
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
return "unknown";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
if (hasCliFlag("--version") || hasCliFlag("-v")) {
|
|
24
|
+
console.log(getPackageVersion());
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
9
27
|
function normalizeChordInput(chord) {
|
|
10
28
|
return normalizeChord(chord.trim().toLowerCase());
|
|
11
29
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "qdesk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"homepage": "https://github.com/JakeBeaver/qdesk#readme",
|
|
13
13
|
"bin": {
|
|
14
|
-
"
|
|
14
|
+
"qdesk": "dist/index.js"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|