betterdisplaycli 0.1.13 → 0.1.15
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/package.json +3 -3
- package/src/Device.ts +52 -18
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "betterdisplaycli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.15",
|
|
4
4
|
"description": "TypeScript bindings for `betterdisplaycli`.",
|
|
5
5
|
"author": "Lucas Garron <code@garron.net>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"printable-shell-command": "
|
|
18
|
+
"printable-shell-command": "^5.0.7"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@biomejs/biome": "
|
|
21
|
+
"@biomejs/biome": "2.3.9",
|
|
22
22
|
"@cubing/dev-config": ">=0.8.3",
|
|
23
23
|
"@types/bun": "^1.3.5",
|
|
24
24
|
"bun-dx": "^0.1.4",
|
package/src/Device.ts
CHANGED
|
@@ -48,17 +48,15 @@ class SingleDisplay extends Device {
|
|
|
48
48
|
options?: QuietOption,
|
|
49
49
|
): Promise<boolean> => {
|
|
50
50
|
switch (
|
|
51
|
-
(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
).text()
|
|
61
|
-
).trim()
|
|
51
|
+
await print(
|
|
52
|
+
new PrintableShellCommand("betterdisplaycli", [
|
|
53
|
+
"get",
|
|
54
|
+
`--name=${this.info.name}`,
|
|
55
|
+
`--${settingName}`,
|
|
56
|
+
]),
|
|
57
|
+
{ argumentLineWrapping: "inline" },
|
|
58
|
+
options,
|
|
59
|
+
).text({ trimTrailingNewlines: "single-required" })
|
|
62
60
|
) {
|
|
63
61
|
case "on": {
|
|
64
62
|
return true;
|
|
@@ -72,7 +70,7 @@ class SingleDisplay extends Device {
|
|
|
72
70
|
},
|
|
73
71
|
|
|
74
72
|
set: async (
|
|
75
|
-
|
|
73
|
+
settingName: "connected" | "hiDPI",
|
|
76
74
|
on: boolean,
|
|
77
75
|
options?: QuietOption,
|
|
78
76
|
): Promise<void> => {
|
|
@@ -80,22 +78,58 @@ class SingleDisplay extends Device {
|
|
|
80
78
|
new PrintableShellCommand("betterdisplaycli", [
|
|
81
79
|
"set",
|
|
82
80
|
`--name=${this.info.name}`,
|
|
83
|
-
`--${
|
|
81
|
+
`--${settingName}=${on ? "on" : "off"}`,
|
|
84
82
|
]),
|
|
85
83
|
{ argumentLineWrapping: "inline" },
|
|
86
84
|
options,
|
|
87
|
-
).
|
|
85
|
+
).shellOut({ print: false });
|
|
88
86
|
},
|
|
89
87
|
|
|
90
88
|
toggle: async (
|
|
91
89
|
settingName: "connected" | "hiDPI",
|
|
92
90
|
options?: QuietOption,
|
|
93
91
|
): Promise<void> => {
|
|
94
|
-
await
|
|
95
|
-
|
|
96
|
-
|
|
92
|
+
await print(
|
|
93
|
+
new PrintableShellCommand("betterdisplaycli", [
|
|
94
|
+
"toggle",
|
|
95
|
+
`--name=${this.info.name}`,
|
|
96
|
+
`--${settingName}`,
|
|
97
|
+
]),
|
|
98
|
+
{ argumentLineWrapping: "inline" },
|
|
99
|
+
options,
|
|
100
|
+
).shellOut({ print: false });
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
string = {
|
|
104
|
+
get: async (
|
|
105
|
+
settingName: "resolution",
|
|
106
|
+
options?: QuietOption,
|
|
107
|
+
): Promise<string> => {
|
|
108
|
+
return print(
|
|
109
|
+
new PrintableShellCommand("betterdisplaycli", [
|
|
110
|
+
"get",
|
|
111
|
+
`--name=${this.info.name}`,
|
|
112
|
+
`--${settingName}`,
|
|
113
|
+
]),
|
|
114
|
+
{ argumentLineWrapping: "inline" },
|
|
115
|
+
options,
|
|
116
|
+
).text({ trimTrailingNewlines: "single-required" });
|
|
117
|
+
},
|
|
118
|
+
|
|
119
|
+
set: async (
|
|
120
|
+
settingName: "resolution",
|
|
121
|
+
value: string,
|
|
122
|
+
options?: QuietOption,
|
|
123
|
+
): Promise<void> => {
|
|
124
|
+
await print(
|
|
125
|
+
new PrintableShellCommand("betterdisplaycli", [
|
|
126
|
+
"set",
|
|
127
|
+
`--name=${this.info.name}`,
|
|
128
|
+
`--${settingName}=${value}`,
|
|
129
|
+
]),
|
|
130
|
+
{ argumentLineWrapping: "inline" },
|
|
97
131
|
options,
|
|
98
|
-
);
|
|
132
|
+
).shellOut({ print: false });
|
|
99
133
|
},
|
|
100
134
|
};
|
|
101
135
|
}
|