betterdisplaycli 0.1.12 → 0.1.14

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.
Files changed (2) hide show
  1. package/package.json +4 -3
  2. package/src/Device.ts +43 -7
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "betterdisplaycli",
3
- "version": "0.1.12",
3
+ "version": "0.1.14",
4
4
  "description": "TypeScript bindings for `betterdisplaycli`.",
5
5
  "author": "Lucas Garron <code@garron.net>",
6
6
  "license": "MIT",
@@ -15,11 +15,12 @@
15
15
  }
16
16
  },
17
17
  "dependencies": {
18
- "printable-shell-command": "^2.6.3"
18
+ "printable-shell-command": "^5.0.6"
19
19
  },
20
20
  "devDependencies": {
21
- "@biomejs/biome": "^2.3.4",
21
+ "@biomejs/biome": "2.3.9",
22
22
  "@cubing/dev-config": ">=0.8.3",
23
+ "@types/bun": "^1.3.5",
23
24
  "bun-dx": "^0.1.4",
24
25
  "typescript": "^5.9.3"
25
26
  },
package/src/Device.ts CHANGED
@@ -72,7 +72,7 @@ class SingleDisplay extends Device {
72
72
  },
73
73
 
74
74
  set: async (
75
- setting: "connected" | "hiDPI",
75
+ settingName: "connected" | "hiDPI",
76
76
  on: boolean,
77
77
  options?: QuietOption,
78
78
  ): Promise<void> => {
@@ -80,22 +80,58 @@ class SingleDisplay extends Device {
80
80
  new PrintableShellCommand("betterdisplaycli", [
81
81
  "set",
82
82
  `--name=${this.info.name}`,
83
- `--${setting}=${on ? "on" : "off"}`,
83
+ `--${settingName}=${on ? "on" : "off"}`,
84
84
  ]),
85
85
  { argumentLineWrapping: "inline" },
86
86
  options,
87
- ).spawn().success;
87
+ ).shellOut({ print: false });
88
88
  },
89
89
 
90
90
  toggle: async (
91
91
  settingName: "connected" | "hiDPI",
92
92
  options?: QuietOption,
93
93
  ): Promise<void> => {
94
- await this.boolean.set(
95
- settingName,
96
- await this.boolean.get(settingName, options),
94
+ await print(
95
+ new PrintableShellCommand("betterdisplaycli", [
96
+ "toggle",
97
+ `--name=${this.info.name}`,
98
+ `--${settingName}`,
99
+ ]),
100
+ { argumentLineWrapping: "inline" },
101
+ options,
102
+ ).shellOut({ print: false });
103
+ },
104
+ };
105
+ string = {
106
+ get: async (
107
+ settingName: "resolution",
108
+ options?: QuietOption,
109
+ ): Promise<string> => {
110
+ return print(
111
+ new PrintableShellCommand("betterdisplaycli", [
112
+ "get",
113
+ `--name=${this.info.name}`,
114
+ `--${settingName}`,
115
+ ]),
116
+ { argumentLineWrapping: "inline" },
117
+ options,
118
+ ).text();
119
+ },
120
+
121
+ set: async (
122
+ settingName: "resolution",
123
+ value: string,
124
+ options?: QuietOption,
125
+ ): Promise<void> => {
126
+ await print(
127
+ new PrintableShellCommand("betterdisplaycli", [
128
+ "set",
129
+ `--name=${this.info.name}`,
130
+ `--${settingName}=${value}`,
131
+ ]),
132
+ { argumentLineWrapping: "inline" },
97
133
  options,
98
- );
134
+ ).shellOut({ print: false });
99
135
  },
100
136
  };
101
137
  }