@sdeck/plugin-audio 0.2.0 → 0.4.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/bin/sdeck-audio.exe +0 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +131 -129
- package/dist/index.js.map +3 -3
- package/package.json +6 -6
- package/src/index.tsx +162 -142
package/bin/sdeck-audio.exe
CHANGED
|
Binary file
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAwBA,OAAO,EACL,KAAK,WAAW,EAMhB,KAAK,QAAQ,EAEd,MAAM,aAAa,CAAC;AAErB,cAAc,aAAa,CAAC;AA4B5B,0DAA0D;AAC1D,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK3C;AAED,mEAAmE;AACnE,wBAAgB,UAAU,CAAC,QAAQ,EAAE,QAAQ,GAAG,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;EAyBxD;AAgED,UAAU,cAAc;IACtB,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACnC,GAAG,EAAE,MAAM,CAAC;CACb;AAQD,yEAAyE;AACzE,wBAAgB,UAAU,CAAC,CAAC,EAAE,cAAc,GAAG,MAAM,CAIpD;AAsBD,iDAAiD;AACjD,wBAAgB,WAAW,CAAC,CAAC,EAAE,cAAc,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAM1E;AAiQD,2DAA2D;AAC3D,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,WAAW,GAAG,SAAS,CAGnF"}
|
package/dist/index.js
CHANGED
|
@@ -2,15 +2,27 @@
|
|
|
2
2
|
// src/index.tsx
|
|
3
3
|
import { existsSync as existsSync2 } from "fs";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
createPlugin,
|
|
6
|
+
Permissions,
|
|
7
|
+
setting,
|
|
7
8
|
useHostState,
|
|
8
9
|
useImage,
|
|
9
10
|
useKeyRepeat,
|
|
10
11
|
useSensorPressed,
|
|
11
12
|
useSensorRepeat
|
|
12
13
|
} from "@sdeck/plugin";
|
|
13
|
-
import {
|
|
14
|
+
import {
|
|
15
|
+
captionLayer,
|
|
16
|
+
iconLayer,
|
|
17
|
+
iconSize,
|
|
18
|
+
KEY,
|
|
19
|
+
meterLayer,
|
|
20
|
+
readable,
|
|
21
|
+
surface,
|
|
22
|
+
surfaceStyle,
|
|
23
|
+
textLayer,
|
|
24
|
+
volumeStepLayers
|
|
25
|
+
} from "@sdeck/schema";
|
|
14
26
|
|
|
15
27
|
// src/helper.ts
|
|
16
28
|
import { spawn } from "child_process";
|
|
@@ -208,6 +220,27 @@ class AudioHelper {
|
|
|
208
220
|
|
|
209
221
|
// src/index.tsx
|
|
210
222
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
223
|
+
var BLUE = "#60a5fa";
|
|
224
|
+
var plugin = createPlugin({
|
|
225
|
+
id: "@sdeck/plugin-audio",
|
|
226
|
+
name: "Audio",
|
|
227
|
+
version: "0.4.0",
|
|
228
|
+
namespace: "audio",
|
|
229
|
+
description: "Volume and mute for speakers, microphone and each app, and device switching.",
|
|
230
|
+
author: "sdeck",
|
|
231
|
+
permissions: [Permissions.audio, Permissions.process],
|
|
232
|
+
settings: {
|
|
233
|
+
helper: setting.text("Audio helper", {
|
|
234
|
+
placeholder: "Found automatically",
|
|
235
|
+
description: "Full path of sdeck-audio, if it is somewhere unusual."
|
|
236
|
+
})
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
var sources = {
|
|
240
|
+
outputs: plugin.source("outputs", () => deviceOptions("outputs")),
|
|
241
|
+
inputs: plugin.source("inputs", () => deviceOptions("inputs")),
|
|
242
|
+
apps: plugin.source("apps", async () => (await helper2.request("snapshot")).apps.map((a) => ({ value: a.name, label: a.name })))
|
|
243
|
+
};
|
|
211
244
|
function appKey(name) {
|
|
212
245
|
return name.trim().toLowerCase().replace(/\.exe$/, "");
|
|
213
246
|
}
|
|
@@ -236,26 +269,31 @@ function audioState(snapshot) {
|
|
|
236
269
|
apps: Object.fromEntries(snapshot.apps.map((app) => [appKey(app.name), app]))
|
|
237
270
|
};
|
|
238
271
|
}
|
|
239
|
-
var context;
|
|
240
272
|
var helper2 = new AudioHelper({
|
|
241
273
|
command: () => {
|
|
242
274
|
if (process.platform !== "win32") {
|
|
243
275
|
throw new AudioUnavailable("Audio control is available on Windows only");
|
|
244
276
|
}
|
|
245
|
-
const path = String(context?.settings().helper || "") || findHelper();
|
|
277
|
+
const path = String(plugin.context?.settings().helper || "") || findHelper();
|
|
246
278
|
if (!path)
|
|
247
279
|
throw new AudioUnavailable(`${BUILD_HINT}.`);
|
|
248
280
|
return [path];
|
|
249
281
|
},
|
|
250
|
-
onProblem: (problem) => context?.status(problem?.message, "error")
|
|
282
|
+
onProblem: (problem) => plugin.context?.status(problem?.message, "error")
|
|
251
283
|
});
|
|
252
|
-
var
|
|
253
|
-
id,
|
|
254
|
-
name,
|
|
255
|
-
type,
|
|
284
|
+
var from = (id, description) => ({
|
|
256
285
|
description,
|
|
257
286
|
start: (set) => helper2.subscribe((snapshot) => set(audioState(snapshot)[id]))
|
|
258
287
|
});
|
|
288
|
+
var values = {
|
|
289
|
+
master: plugin.state.json("master", "Speakers", from("master", "audio.master.volume, .muted, .name")),
|
|
290
|
+
mic: plugin.state.json("mic", "Microphone", from("mic", "audio.mic.volume, .muted, .name")),
|
|
291
|
+
output: plugin.state.string("output", "Output device", from("output", "The default output's name.")),
|
|
292
|
+
input: plugin.state.string("input", "Input device", from("input", "The default input's name.")),
|
|
293
|
+
outputs: plugin.state.json("outputs", "Output devices", from("outputs", "Every output with its level.")),
|
|
294
|
+
inputs: plugin.state.json("inputs", "Input devices", from("inputs", "Every input with its level.")),
|
|
295
|
+
apps: plugin.state.json("apps", "App volumes", from("apps", "audio.apps.spotify.volume, .muted, .active"))
|
|
296
|
+
};
|
|
259
297
|
var useIcon = (icon, color) => useImage(`icon:${icon}`, color);
|
|
260
298
|
var TARGETS = [
|
|
261
299
|
{ value: "output", label: "Speakers (default output)" },
|
|
@@ -301,15 +339,14 @@ function targetIcons(s) {
|
|
|
301
339
|
return brand ? { on: brand, off: brand } : { on: "lucide/app-window", off: "lucide/volume-x" };
|
|
302
340
|
}
|
|
303
341
|
var targetFields = {
|
|
304
|
-
target:
|
|
305
|
-
app: {
|
|
306
|
-
|
|
307
|
-
label: "App",
|
|
342
|
+
target: setting.select("Control", TARGETS, { default: "output" }),
|
|
343
|
+
app: setting.text("App", {
|
|
344
|
+
required: true,
|
|
308
345
|
source: "apps",
|
|
309
346
|
placeholder: "spotify.exe",
|
|
310
347
|
description: "The executable name, as it appears while the app plays sound.",
|
|
311
348
|
visibleIf: { target: "app" }
|
|
312
|
-
}
|
|
349
|
+
})
|
|
313
350
|
};
|
|
314
351
|
async function adjust(target, operation, step, level) {
|
|
315
352
|
switch (operation) {
|
|
@@ -333,7 +370,7 @@ var OPERATION_NAMES = {
|
|
|
333
370
|
unmute: "Unmute",
|
|
334
371
|
toggle: "Toggle mute"
|
|
335
372
|
};
|
|
336
|
-
var volume =
|
|
373
|
+
var volume = plugin.action({
|
|
337
374
|
id: "volume",
|
|
338
375
|
name: "Volume",
|
|
339
376
|
description: "Changes or mutes the speakers, the microphone or one app, and shows its level.",
|
|
@@ -342,29 +379,20 @@ var volume = defineAction({
|
|
|
342
379
|
slots: ["key", "sensor"],
|
|
343
380
|
settings: {
|
|
344
381
|
...targetFields,
|
|
345
|
-
operation: {
|
|
346
|
-
|
|
347
|
-
label: "When pressed",
|
|
348
|
-
default: "toggle",
|
|
349
|
-
options: Object.entries(OPERATION_NAMES).map(([value, label]) => ({ value, label }))
|
|
350
|
-
},
|
|
351
|
-
step: {
|
|
352
|
-
type: "number",
|
|
353
|
-
label: "Step (%)",
|
|
382
|
+
operation: setting.select("When pressed", OPERATION_NAMES, { default: "toggle" }),
|
|
383
|
+
step: setting.number("Step (%)", {
|
|
354
384
|
default: 5,
|
|
355
385
|
min: 1,
|
|
356
386
|
max: 50,
|
|
357
387
|
visibleIf: { operation: ["up", "down"] }
|
|
358
|
-
},
|
|
359
|
-
level: {
|
|
360
|
-
type: "number",
|
|
361
|
-
label: "Level (%)",
|
|
388
|
+
}),
|
|
389
|
+
level: setting.number("Level (%)", {
|
|
362
390
|
default: 50,
|
|
363
391
|
min: 0,
|
|
364
392
|
max: 100,
|
|
365
393
|
visibleIf: { operation: "set" }
|
|
366
|
-
},
|
|
367
|
-
background:
|
|
394
|
+
}),
|
|
395
|
+
background: setting.color("Background", { default: KEY, appearance: true })
|
|
368
396
|
},
|
|
369
397
|
run: async ({ settings }) => {
|
|
370
398
|
const target = targetOf(settings);
|
|
@@ -378,46 +406,63 @@ var volume = defineAction({
|
|
|
378
406
|
}
|
|
379
407
|
};
|
|
380
408
|
},
|
|
381
|
-
look: (s) => {
|
|
409
|
+
look: (s, slot) => {
|
|
382
410
|
const path = targetPath(s);
|
|
383
411
|
const muted = `${path}.muted`;
|
|
384
412
|
const icons = targetIcons(s);
|
|
385
413
|
const step = s.operation === "up" ? "plus" : s.operation === "down" ? "minus" : "";
|
|
414
|
+
const white = readable("#ffffff", s.background);
|
|
415
|
+
const red = readable("#f87171", s.background);
|
|
416
|
+
const blue = readable(BLUE, s.background);
|
|
417
|
+
const level = `{{${path}.volume == null ? "N/A" : ${path}.volume + "%"}}`;
|
|
418
|
+
const bar = meterLayer("bar", `${path}.volume ?? 0`, { color: BLUE });
|
|
419
|
+
if (step && s.target === "output") {
|
|
420
|
+
const layers = (color) => volumeStepLayers(step, slot, { color, stepColor: blue, center: 37, size: 52 });
|
|
421
|
+
const [icon, sign] = layers(white);
|
|
422
|
+
return {
|
|
423
|
+
background: surface(s.background),
|
|
424
|
+
layers: [
|
|
425
|
+
{ ...icon, visible: `!${muted}` },
|
|
426
|
+
{ ...layers(red)[0], id: "muted", visible: muted },
|
|
427
|
+
sign,
|
|
428
|
+
textLayer("level", level, {
|
|
429
|
+
color: white,
|
|
430
|
+
size: 18,
|
|
431
|
+
frame: { x: 0, y: 58, width: 100, height: 24 }
|
|
432
|
+
}),
|
|
433
|
+
bar
|
|
434
|
+
]
|
|
435
|
+
};
|
|
436
|
+
}
|
|
386
437
|
return {
|
|
387
|
-
background: s.background,
|
|
438
|
+
background: surface(s.background),
|
|
388
439
|
layers: [
|
|
389
440
|
iconLayer("icon", icons.on, {
|
|
390
|
-
|
|
391
|
-
|
|
441
|
+
color: white,
|
|
442
|
+
size: 40,
|
|
392
443
|
visible: `!${muted}`,
|
|
393
444
|
row: "icon"
|
|
394
445
|
}),
|
|
395
446
|
iconLayer("muted", icons.off, {
|
|
396
|
-
color:
|
|
397
|
-
size:
|
|
398
|
-
position: "top",
|
|
447
|
+
color: red,
|
|
448
|
+
size: 40,
|
|
399
449
|
visible: muted,
|
|
400
450
|
row: "icon"
|
|
401
451
|
}),
|
|
402
|
-
...step ? [
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
color: "#60a5fa",
|
|
412
|
-
track: "#1e293b",
|
|
413
|
-
position: "bottom",
|
|
414
|
-
thickness: 6
|
|
415
|
-
}
|
|
452
|
+
...step ? [
|
|
453
|
+
iconLayer("step", `lucide/${step}`, {
|
|
454
|
+
color: blue,
|
|
455
|
+
size: 20,
|
|
456
|
+
row: "icon"
|
|
457
|
+
})
|
|
458
|
+
] : [],
|
|
459
|
+
textLayer("level", level, { color: white, size: 18 }),
|
|
460
|
+
bar
|
|
416
461
|
]
|
|
417
462
|
};
|
|
418
463
|
}
|
|
419
464
|
});
|
|
420
|
-
var slider =
|
|
465
|
+
var slider = plugin.action({
|
|
421
466
|
id: "slider",
|
|
422
467
|
name: "Volume slider",
|
|
423
468
|
description: "A level bar on a sensor strip: touch it to step the volume (the left one lowers, the right one raises), hold to keep going.",
|
|
@@ -426,18 +471,13 @@ var slider = defineAction({
|
|
|
426
471
|
slots: ["sensor", "window", "key"],
|
|
427
472
|
settings: {
|
|
428
473
|
...targetFields,
|
|
429
|
-
direction: {
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
{ value: "up", label: "Raises" }
|
|
437
|
-
]
|
|
438
|
-
},
|
|
439
|
-
step: { type: "number", label: "Step (%)", default: 4, min: 1, max: 50 },
|
|
440
|
-
color: { type: "color", label: "Bar colour", default: "#60a5fa", appearance: true }
|
|
474
|
+
direction: setting.select("Touching it", {
|
|
475
|
+
auto: "Left lowers, right raises",
|
|
476
|
+
down: "Lowers",
|
|
477
|
+
up: "Raises"
|
|
478
|
+
}),
|
|
479
|
+
step: setting.number("Step (%)", { default: 4, min: 1, max: 50 }),
|
|
480
|
+
color: setting.color("Bar colour", { default: BLUE, appearance: true })
|
|
441
481
|
},
|
|
442
482
|
run: async ({ settings }) => {
|
|
443
483
|
const target = targetOf(settings);
|
|
@@ -482,7 +522,7 @@ var slider = defineAction({
|
|
|
482
522
|
position: "relative",
|
|
483
523
|
width: "100%",
|
|
484
524
|
height: "100%",
|
|
485
|
-
|
|
525
|
+
...surfaceStyle(strip && sensorPressed ? "#334155" : KEY),
|
|
486
526
|
alignItems: "center",
|
|
487
527
|
justifyContent: "center"
|
|
488
528
|
},
|
|
@@ -537,7 +577,7 @@ function nextDevice(devices) {
|
|
|
537
577
|
const at = devices.findIndex((d) => d.default);
|
|
538
578
|
return devices[(at + 1) % devices.length];
|
|
539
579
|
}
|
|
540
|
-
var defaultDevice =
|
|
580
|
+
var defaultDevice = plugin.action({
|
|
541
581
|
id: "default-device",
|
|
542
582
|
name: "Switch audio device",
|
|
543
583
|
description: "Makes another speaker or microphone the default, or steps through them.",
|
|
@@ -545,32 +585,21 @@ var defaultDevice = defineAction({
|
|
|
545
585
|
icon: "speaker",
|
|
546
586
|
slots: ["key", "sensor"],
|
|
547
587
|
settings: {
|
|
548
|
-
flow: {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
{ value: "input", label: "Input (microphone)" }
|
|
555
|
-
]
|
|
556
|
-
},
|
|
557
|
-
output: {
|
|
558
|
-
type: "select",
|
|
559
|
-
label: "To",
|
|
588
|
+
flow: setting.select("Switch the", {
|
|
589
|
+
output: "Output (speakers)",
|
|
590
|
+
input: "Input (microphone)"
|
|
591
|
+
}),
|
|
592
|
+
output: setting.pick("To", "outputs", {
|
|
593
|
+
first: [{ value: NEXT, label: "The next device" }],
|
|
560
594
|
default: NEXT,
|
|
561
|
-
source: "outputs",
|
|
562
|
-
options: [{ value: NEXT, label: "The next device" }],
|
|
563
595
|
visibleIf: { flow: "output" }
|
|
564
|
-
},
|
|
565
|
-
input: {
|
|
566
|
-
|
|
567
|
-
label: "To",
|
|
596
|
+
}),
|
|
597
|
+
input: setting.pick("To", "inputs", {
|
|
598
|
+
first: [{ value: NEXT, label: "The next device" }],
|
|
568
599
|
default: NEXT,
|
|
569
|
-
source: "inputs",
|
|
570
|
-
options: [{ value: NEXT, label: "The next device" }],
|
|
571
600
|
visibleIf: { flow: "input" }
|
|
572
|
-
},
|
|
573
|
-
background:
|
|
601
|
+
}),
|
|
602
|
+
background: setting.color("Background", { default: KEY, appearance: true })
|
|
574
603
|
},
|
|
575
604
|
run: async ({ settings }) => {
|
|
576
605
|
const wanted = settings.flow === "output" ? settings.output : settings.input;
|
|
@@ -589,40 +618,27 @@ var defaultDevice = defineAction({
|
|
|
589
618
|
};
|
|
590
619
|
},
|
|
591
620
|
look: (s) => ({
|
|
592
|
-
background: s.background,
|
|
621
|
+
background: surface(s.background),
|
|
593
622
|
layers: [
|
|
594
623
|
iconLayer("icon", s.flow === "output" ? "lucide/headphones" : "lucide/mic", {
|
|
595
|
-
|
|
596
|
-
|
|
624
|
+
color: readable("#ffffff", s.background),
|
|
625
|
+
size: iconSize(true) - 4,
|
|
597
626
|
row: "icon"
|
|
598
627
|
}),
|
|
599
628
|
iconLayer("switch", "lucide/arrow-left-right", {
|
|
600
|
-
color: "#c4b5fd",
|
|
601
|
-
size:
|
|
602
|
-
position: "top",
|
|
629
|
+
color: readable("#c4b5fd", s.background),
|
|
630
|
+
size: 20,
|
|
603
631
|
row: "icon"
|
|
604
632
|
}),
|
|
605
|
-
|
|
633
|
+
captionLayer("device", `{{${values[s.flow].key} ?? "N/A"}}`, {
|
|
634
|
+
color: readable("#f4f4f5", s.background),
|
|
635
|
+
size: 11
|
|
636
|
+
})
|
|
606
637
|
]
|
|
607
638
|
})
|
|
608
639
|
});
|
|
609
640
|
var deviceOptions = async (flow) => (await helper2.request("snapshot"))[flow].map((d) => ({ value: d.id, label: d.name }));
|
|
610
|
-
var src_default =
|
|
611
|
-
id: "@sdeck/plugin-audio",
|
|
612
|
-
name: "Audio",
|
|
613
|
-
version: "0.2.0",
|
|
614
|
-
namespace: "audio",
|
|
615
|
-
description: "Volume and mute for speakers, microphone and each app, and device switching.",
|
|
616
|
-
author: "sdeck",
|
|
617
|
-
permissions: ["audio", "process"],
|
|
618
|
-
settings: {
|
|
619
|
-
helper: {
|
|
620
|
-
type: "text",
|
|
621
|
-
label: "Audio helper",
|
|
622
|
-
placeholder: "Found automatically",
|
|
623
|
-
description: "Full path of sdeck-audio, if it is somewhere unusual."
|
|
624
|
-
}
|
|
625
|
-
},
|
|
641
|
+
var src_default = plugin.define({
|
|
626
642
|
onboarding: {
|
|
627
643
|
steps: [
|
|
628
644
|
{
|
|
@@ -638,22 +654,9 @@ var src_default = definePlugin({
|
|
|
638
654
|
]
|
|
639
655
|
},
|
|
640
656
|
actions: [volume, slider, defaultDevice],
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
inputs: () => deviceOptions("inputs"),
|
|
644
|
-
apps: async () => (await helper2.request("snapshot")).apps.map((a) => ({ value: a.name, label: a.name }))
|
|
645
|
-
},
|
|
646
|
-
state: [
|
|
647
|
-
stateOf("master", "Speakers", "json", "audio.master.volume, .muted, .name"),
|
|
648
|
-
stateOf("mic", "Microphone", "json", "audio.mic.volume, .muted, .name"),
|
|
649
|
-
stateOf("output", "Output device", "string", "The default output's name."),
|
|
650
|
-
stateOf("input", "Input device", "string", "The default input's name."),
|
|
651
|
-
stateOf("outputs", "Output devices", "json", "Every output with its level."),
|
|
652
|
-
stateOf("inputs", "Input devices", "json", "Every input with its level."),
|
|
653
|
-
stateOf("apps", "App volumes", "json", "audio.apps.spotify.volume, .muted, .active")
|
|
654
|
-
],
|
|
657
|
+
sources: Object.values(sources),
|
|
658
|
+
state: Object.values(values),
|
|
655
659
|
activate(activated) {
|
|
656
|
-
context = activated;
|
|
657
660
|
if (process.platform !== "win32") {
|
|
658
661
|
activated.status("Audio control is available on Windows only", "info");
|
|
659
662
|
} else if (!findHelper() && !activated.settings().helper) {
|
|
@@ -661,7 +664,6 @@ var src_default = definePlugin({
|
|
|
661
664
|
}
|
|
662
665
|
return () => {
|
|
663
666
|
helper2.close();
|
|
664
|
-
context = undefined;
|
|
665
667
|
};
|
|
666
668
|
}
|
|
667
669
|
});
|
|
@@ -678,4 +680,4 @@ export {
|
|
|
678
680
|
targetPath
|
|
679
681
|
};
|
|
680
682
|
|
|
681
|
-
//# debugId=
|
|
683
|
+
//# debugId=63A17C8D33B6ABFC64756E2164756E21
|
package/dist/index.js.map
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.tsx", "../src/helper.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import { existsSync } from \"node:fs\";\nimport {\n defineAction,\n definePlugin,\n type PluginContext,\n type StateDef,\n useHostState,\n useImage,\n useKeyRepeat,\n useSensorPressed,\n useSensorRepeat,\n} from \"@sdeck/plugin\";\nimport { iconLayer, type Look, textLayer } from \"@sdeck/schema\";\nimport {\n type AudioDevice,\n AudioHelper,\n AudioUnavailable,\n BUILD_HINT,\n type Change,\n findHelper,\n type Snapshot,\n type Target,\n} from \"./helper.ts\";\n\nexport * from \"./helper.ts\";\n\n/** `Spotify.exe` → `spotify`, the key of `audio.apps`. */\nexport function appKey(name: string): string {\n return name\n .trim()\n .toLowerCase()\n .replace(/\\.exe$/, \"\");\n}\n\n/** What the plugin publishes, from one snapshot of the devices. */\nexport function audioState(snapshot: Snapshot | undefined) {\n if (!snapshot) {\n return {\n master: undefined,\n mic: undefined,\n output: undefined,\n input: undefined,\n outputs: undefined,\n inputs: undefined,\n apps: undefined,\n };\n }\n const level = (d: AudioDevice | undefined) =>\n d && { volume: d.volume, muted: d.muted, name: d.name };\n const output = snapshot.outputs.find((d) => d.default);\n const input = snapshot.inputs.find((d) => d.default);\n return {\n master: level(output),\n mic: level(input),\n output: output?.name,\n input: input?.name,\n outputs: snapshot.outputs,\n inputs: snapshot.inputs,\n apps: Object.fromEntries(snapshot.apps.map((app) => [appKey(app.name), app])),\n };\n}\n\n// -- The helper ---------------------------------------------------------------------------------\n\nlet context: PluginContext | undefined;\n\nconst helper = new AudioHelper({\n command: () => {\n if (process.platform !== \"win32\") {\n throw new AudioUnavailable(\"Audio control is available on Windows only\");\n }\n const path = String(context?.settings().helper || \"\") || findHelper();\n if (!path) throw new AudioUnavailable(`${BUILD_HINT}.`);\n return [path];\n },\n onProblem: (problem) => context?.status(problem?.message, \"error\"),\n});\n\nconst stateOf = (\n id: keyof ReturnType<typeof audioState>,\n name: string,\n type: \"string\" | \"json\",\n description: string,\n): StateDef => ({\n id,\n name,\n type,\n description,\n start: (set) => helper.subscribe((snapshot) => set(audioState(snapshot)[id])),\n});\n\n/** An icon (`lucide/mic`) as an image, once loaded. */\nconst useIcon = (icon: string, color: string) => useImage(`icon:${icon}`, color);\n\n// -- Volume -------------------------------------------------------------------------------------\n\nconst TARGETS = [\n { value: \"output\", label: \"Speakers (default output)\" },\n { value: \"input\", label: \"Microphone (default input)\" },\n { value: \"app\", label: \"One app\" },\n] as const;\n\ninterface TargetSettings {\n target: \"output\" | \"input\" | \"app\";\n app: string;\n}\n\nfunction targetOf(s: TargetSettings): Target {\n if (s.target !== \"app\") return { kind: s.target };\n if (!s.app.trim()) throw new Error(\"choose an app\");\n return { kind: \"app\", app: s.app.trim() };\n}\n\n/** The state path of a target's level, for templates and expressions. */\nexport function targetPath(s: TargetSettings): string {\n if (s.target === \"output\") return \"audio.master\";\n if (s.target === \"input\") return \"audio.mic\";\n return `audio.apps[${JSON.stringify(appKey(s.app))}]`;\n}\n\nconst targetName = (s: TargetSettings) =>\n s.target === \"output\" ? \"Volume\" : s.target === \"input\" ? \"Mic\" : appKey(s.app) || \"App\";\n\n/** Brand icons of common apps, by executable name. */\nconst APP_ICONS: Record<string, string> = {\n spotify: \"si/SiSpotify\",\n discord: \"si/SiDiscord\",\n chrome: \"si/SiGooglechrome\",\n firefox: \"si/SiFirefoxbrowser\",\n msedge: \"fa6/FaEdge\",\n brave: \"si/SiBrave\",\n opera: \"si/SiOpera\",\n steam: \"si/SiSteam\",\n vlc: \"si/SiVlcmediaplayer\",\n obs64: \"si/SiObsstudio\",\n slack: \"fa6/FaSlack\",\n zoom: \"si/SiZoom\",\n system: \"lucide/bell\",\n};\n\n/** The icons of a target: sounding and muted. */\nexport function targetIcons(s: TargetSettings): { on: string; off: string } {\n if (s.target === \"output\") return { on: \"lucide/volume-2\", off: \"lucide/volume-x\" };\n if (s.target === \"input\") return { on: \"lucide/mic\", off: \"lucide/mic-off\" };\n const brand = APP_ICONS[appKey(s.app)];\n // A brand keeps its own mark when muted; it turns red.\n return brand ? { on: brand, off: brand } : { on: \"lucide/app-window\", off: \"lucide/volume-x\" };\n}\n\nconst targetFields = {\n target: { type: \"select\", label: \"Control\", default: \"output\", options: TARGETS },\n app: {\n type: \"text\",\n label: \"App\",\n source: \"apps\",\n placeholder: \"spotify.exe\",\n description: \"The executable name, as it appears while the app plays sound.\",\n visibleIf: { target: \"app\" },\n },\n} as const;\n\ntype Operation = \"up\" | \"down\" | \"set\" | \"mute\" | \"unmute\" | \"toggle\";\n\nasync function adjust(\n target: Target,\n operation: Operation,\n step: number,\n level: number,\n): Promise<Change> {\n switch (operation) {\n case \"up\":\n return helper.request(\"setVolume\", { target, delta: step });\n case \"down\":\n return helper.request(\"setVolume\", { target, delta: -step });\n case \"set\":\n return helper.request(\"setVolume\", { target, volume: level });\n case \"toggle\":\n return helper.request(\"setMute\", { target });\n default:\n return helper.request(\"setMute\", { target, muted: operation === \"mute\" });\n }\n}\n\nconst OPERATION_NAMES: Record<Operation, string> = {\n up: \"Volume up\",\n down: \"Volume down\",\n set: \"Set volume\",\n mute: \"Mute\",\n unmute: \"Unmute\",\n toggle: \"Toggle mute\",\n};\n\nconst volume = defineAction({\n id: \"volume\",\n name: \"Volume\",\n description: \"Changes or mutes the speakers, the microphone or one app, and shows its level.\",\n category: \"Audio\",\n icon: \"volume-2\",\n slots: [\"key\", \"sensor\"],\n settings: {\n ...targetFields,\n operation: {\n type: \"select\",\n label: \"When pressed\",\n default: \"toggle\",\n options: Object.entries(OPERATION_NAMES).map(([value, label]) => ({ value, label })) as {\n value: Operation;\n label: string;\n }[],\n },\n step: {\n type: \"number\",\n label: \"Step (%)\",\n default: 5,\n min: 1,\n max: 50,\n visibleIf: { operation: [\"up\", \"down\"] },\n },\n level: {\n type: \"number\",\n label: \"Level (%)\",\n default: 50,\n min: 0,\n max: 100,\n visibleIf: { operation: \"set\" },\n },\n background: { type: \"color\", label: \"Background\", default: \"#172554\", appearance: true },\n },\n run: async ({ settings }) => {\n const target = targetOf(settings);\n const { before, after } = await adjust(\n target,\n settings.operation,\n settings.step,\n settings.level,\n );\n return {\n result: after,\n label: `${OPERATION_NAMES[settings.operation]} (${targetName(settings)})`,\n undo: async () => {\n await helper.request(\"setVolume\", { target, volume: before.volume });\n await helper.request(\"setMute\", { target, muted: before.muted });\n },\n };\n },\n look: (s): Look => {\n const path = targetPath(s);\n const muted = `${path}.muted`;\n const icons = targetIcons(s);\n const step = s.operation === \"up\" ? \"plus\" : s.operation === \"down\" ? \"minus\" : \"\";\n return {\n background: s.background,\n layers: [\n iconLayer(\"icon\", icons.on, {\n size: 42,\n position: \"top\",\n visible: `!${muted}`,\n row: \"icon\",\n }),\n iconLayer(\"muted\", icons.off, {\n color: \"#f87171\",\n size: 42,\n position: \"top\",\n visible: muted,\n row: \"icon\",\n }),\n ...(step\n ? [iconLayer(\"step\", `lucide/${step}`, { size: 22, position: \"top\", row: \"icon\" })]\n : []),\n textLayer(\"level\", `{{${path}.volume == null ? \"N/A\" : ${path}.volume + \"%\"}}`, {\n size: 18,\n position: \"bottom\",\n }),\n {\n id: \"bar\",\n type: \"bar\",\n value: `${path}.volume ?? 0`,\n color: \"#60a5fa\",\n track: \"#1e293b\",\n position: \"bottom\",\n thickness: 6,\n },\n ],\n };\n },\n});\n\n// -- Slider -------------------------------------------------------------------------------------\n\nconst slider = defineAction({\n id: \"slider\",\n name: \"Volume slider\",\n description:\n \"A level bar on a sensor strip: touch it to step the volume (the left one lowers, the right one raises), hold to keep going.\",\n category: \"Audio\",\n icon: \"sliders-horizontal\",\n slots: [\"sensor\", \"window\", \"key\"],\n settings: {\n ...targetFields,\n direction: {\n type: \"select\",\n label: \"Touching it\",\n default: \"auto\",\n options: [\n { value: \"auto\", label: \"Left lowers, right raises\" },\n { value: \"down\", label: \"Lowers\" },\n { value: \"up\", label: \"Raises\" },\n ],\n },\n step: { type: \"number\", label: \"Step (%)\", default: 4, min: 1, max: 50 },\n color: { type: \"color\", label: \"Bar colour\", default: \"#60a5fa\", appearance: true },\n },\n run: async ({ settings }) => {\n const target = targetOf(settings);\n const delta = settings.direction === \"down\" ? -settings.step : settings.step;\n const { before, after } = await helper.request(\"setVolume\", { target, delta });\n return {\n result: after,\n label: `${targetName(settings)} ${after.volume}%`,\n undo: () => helper.request(\"setVolume\", { target, volume: before.volume }),\n };\n },\n component: ({ settings, slot, plugin }) => {\n const name = settings.target === \"output\" ? \"master\" : settings.target === \"input\" ? \"mic\" : \"\";\n const whole = useHostState(name ? `audio.${name}` : \"audio.apps\");\n const level = (\n name ? whole : (whole as Record<string, unknown> | undefined)?.[appKey(settings.app)]\n ) as { volume: number; muted: boolean } | undefined;\n const down =\n settings.direction === \"down\" ||\n (settings.direction === \"auto\" && slot.kind !== \"window\" && slot.index % 2 === 0);\n const step = () => {\n helper\n .request(\"setVolume\", {\n target: targetOf(settings),\n delta: down ? -settings.step : settings.step,\n })\n .catch((error: Error) => plugin.log(\"slider:\", error.message));\n };\n const sensorPressed = useSensorPressed(slot.kind === \"sensor\" ? slot.index : 0);\n const index = slot.kind === \"window\" ? -1 : slot.index;\n useSensorRepeat((i) => slot.kind === \"sensor\" && i === index && step(), {\n sensor: slot.kind === \"sensor\" ? index : -1,\n intervalMs: 150,\n });\n useKeyRepeat((i) => slot.kind === \"key\" && i === index && step(), {\n key: slot.kind === \"key\" ? index : -1,\n intervalMs: 150,\n });\n const strip = slot.kind === \"sensor\";\n const text = !level ? \"N/A\" : `${level.volume}%`;\n const icons = targetIcons(settings);\n const size = strip ? 12 : 24;\n const icon = useIcon(level?.muted ? icons.off : icons.on, \"#ffffff\");\n const arrow = useIcon(down ? \"lucide/minus\" : \"lucide/plus\", \"#ffffff\");\n return (\n <div\n style={{\n display: \"flex\",\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n background: strip && sensorPressed ? \"#334155\" : \"#0f172a\",\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n position: \"absolute\",\n left: 0,\n top: 0,\n bottom: 0,\n width: `${level?.volume ?? 0}%`,\n background: level?.muted ? \"#7f1d1d\" : settings.color,\n opacity: 0.6,\n }}\n />\n <div\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: strip ? 3 : 6,\n color: \"#ffffff\",\n fontWeight: 700,\n fontSize: 20,\n }}\n >\n {strip && arrow ? <img src={arrow} width={10} height={10} alt=\"\" /> : null}\n {icon ? <img src={icon} width={size} height={size} alt=\"\" /> : null}\n {/* On a sensor the bar alone shows the level. */}\n {strip ? null : <div style={{ display: \"flex\" }}>{text}</div>}\n </div>\n </div>\n );\n },\n});\n\n// -- Default device -----------------------------------------------------------------------------\n\nconst NEXT = \"__next\";\n\n/** The device after the default one, for \"Next device\". */\nexport function nextDevice(devices: readonly AudioDevice[]): AudioDevice | undefined {\n const at = devices.findIndex((d) => d.default);\n return devices[(at + 1) % devices.length];\n}\n\nconst defaultDevice = defineAction({\n id: \"default-device\",\n name: \"Switch audio device\",\n description: \"Makes another speaker or microphone the default, or steps through them.\",\n category: \"Audio\",\n icon: \"speaker\",\n slots: [\"key\", \"sensor\"],\n settings: {\n flow: {\n type: \"select\",\n label: \"Switch the\",\n default: \"output\",\n options: [\n { value: \"output\", label: \"Output (speakers)\" },\n { value: \"input\", label: \"Input (microphone)\" },\n ],\n },\n output: {\n type: \"select\",\n label: \"To\",\n default: NEXT,\n source: \"outputs\",\n options: [{ value: NEXT, label: \"The next device\" }],\n visibleIf: { flow: \"output\" },\n },\n input: {\n type: \"select\",\n label: \"To\",\n default: NEXT,\n source: \"inputs\",\n options: [{ value: NEXT, label: \"The next device\" }],\n visibleIf: { flow: \"input\" },\n },\n background: { type: \"color\", label: \"Background\", default: \"#3b0764\", appearance: true },\n },\n run: async ({ settings }) => {\n const wanted = settings.flow === \"output\" ? settings.output : settings.input;\n const snapshot = await helper.request(\"snapshot\");\n const devices = settings.flow === \"output\" ? snapshot.outputs : snapshot.inputs;\n const device = wanted === NEXT ? nextDevice(devices) : devices.find((d) => d.id === wanted);\n if (!device) throw new Error(\"that audio device is not connected\");\n const { previous } = await helper.request(\"setDefault\", { device: device.id });\n return {\n result: device.name,\n label: `Audio ${settings.flow}: ${device.name}`,\n ...(previous && {\n undo: () => helper.request(\"setDefault\", { device: previous }),\n }),\n };\n },\n look: (s): Look => ({\n background: s.background,\n layers: [\n iconLayer(\"icon\", s.flow === \"output\" ? \"lucide/headphones\" : \"lucide/mic\", {\n size: 44,\n position: \"top\",\n row: \"icon\",\n }),\n iconLayer(\"switch\", \"lucide/arrow-left-right\", {\n color: \"#c4b5fd\",\n size: 22,\n position: \"top\",\n row: \"icon\",\n }),\n textLayer(\"device\", `{{audio.${s.flow} ?? \"N/A\"}}`, { size: 11, position: \"bottom\" }),\n ],\n }),\n});\n\nconst deviceOptions = async (flow: \"outputs\" | \"inputs\") =>\n (await helper.request(\"snapshot\"))[flow].map((d) => ({ value: d.id, label: d.name }));\n\nexport default definePlugin({\n id: \"@sdeck/plugin-audio\",\n name: \"Audio\",\n version: \"0.2.0\",\n namespace: \"audio\",\n description: \"Volume and mute for speakers, microphone and each app, and device switching.\",\n author: \"sdeck\",\n permissions: [\"audio\", \"process\"],\n settings: {\n helper: {\n type: \"text\",\n label: \"Audio helper\",\n placeholder: \"Found automatically\",\n description: \"Full path of sdeck-audio, if it is somewhere unusual.\",\n },\n },\n onboarding: {\n steps: [\n {\n id: \"helper\",\n title: \"The audio helper\",\n body: \"sdeck reaches your speakers, microphone and apps through a small helper that comes with this plugin on Windows. Leave this empty unless it is somewhere else.\",\n settings: [\"helper\"],\n done: (activated) => {\n const custom = String(activated.settings().helper ?? \"\").trim();\n return custom ? existsSync(custom) : findHelper() !== undefined;\n },\n },\n ],\n },\n actions: [volume, slider, defaultDevice],\n optionSources: {\n outputs: () => deviceOptions(\"outputs\"),\n inputs: () => deviceOptions(\"inputs\"),\n apps: async () =>\n (await helper.request(\"snapshot\")).apps.map((a) => ({ value: a.name, label: a.name })),\n },\n state: [\n stateOf(\"master\", \"Speakers\", \"json\", \"audio.master.volume, .muted, .name\"),\n stateOf(\"mic\", \"Microphone\", \"json\", \"audio.mic.volume, .muted, .name\"),\n stateOf(\"output\", \"Output device\", \"string\", \"The default output's name.\"),\n stateOf(\"input\", \"Input device\", \"string\", \"The default input's name.\"),\n stateOf(\"outputs\", \"Output devices\", \"json\", \"Every output with its level.\"),\n stateOf(\"inputs\", \"Input devices\", \"json\", \"Every input with its level.\"),\n stateOf(\"apps\", \"App volumes\", \"json\", \"audio.apps.spotify.volume, .muted, .active\"),\n ],\n activate(activated) {\n context = activated;\n if (process.platform !== \"win32\") {\n activated.status(\"Audio control is available on Windows only\", \"info\");\n } else if (!findHelper() && !activated.settings().helper) {\n activated.status(`${BUILD_HINT}.`, \"info\");\n }\n return () => {\n helper.close();\n context = undefined;\n };\n },\n});\n",
|
|
5
|
+
"import { existsSync } from \"node:fs\";\nimport {\n createPlugin,\n Permissions,\n setting,\n useHostState,\n useImage,\n useKeyRepeat,\n useSensorPressed,\n useSensorRepeat,\n} from \"@sdeck/plugin\";\nimport {\n captionLayer,\n iconLayer,\n iconSize,\n KEY,\n type Look,\n meterLayer,\n readable,\n surface,\n surfaceStyle,\n textLayer,\n volumeStepLayers,\n} from \"@sdeck/schema\";\nimport {\n type AudioDevice,\n AudioHelper,\n AudioUnavailable,\n BUILD_HINT,\n type Change,\n findHelper,\n type Snapshot,\n type Target,\n} from \"./helper.ts\";\n\nexport * from \"./helper.ts\";\n\nconst BLUE = \"#60a5fa\";\n\nconst plugin = createPlugin({\n id: \"@sdeck/plugin-audio\",\n name: \"Audio\",\n version: \"0.4.0\",\n namespace: \"audio\",\n description: \"Volume and mute for speakers, microphone and each app, and device switching.\",\n author: \"sdeck\",\n permissions: [Permissions.audio, Permissions.process],\n settings: {\n helper: setting.text(\"Audio helper\", {\n placeholder: \"Found automatically\",\n description: \"Full path of sdeck-audio, if it is somewhere unusual.\",\n }),\n },\n});\n\nconst sources = {\n outputs: plugin.source(\"outputs\", () => deviceOptions(\"outputs\")),\n inputs: plugin.source(\"inputs\", () => deviceOptions(\"inputs\")),\n apps: plugin.source(\"apps\", async () =>\n (await helper.request(\"snapshot\")).apps.map((a) => ({ value: a.name, label: a.name })),\n ),\n};\n\n/** `Spotify.exe` → `spotify`, the key of `audio.apps`. */\nexport function appKey(name: string): string {\n return name\n .trim()\n .toLowerCase()\n .replace(/\\.exe$/, \"\");\n}\n\n/** What the plugin publishes, from one snapshot of the devices. */\nexport function audioState(snapshot: Snapshot | undefined) {\n if (!snapshot) {\n return {\n master: undefined,\n mic: undefined,\n output: undefined,\n input: undefined,\n outputs: undefined,\n inputs: undefined,\n apps: undefined,\n };\n }\n const level = (d: AudioDevice | undefined) =>\n d && { volume: d.volume, muted: d.muted, name: d.name };\n const output = snapshot.outputs.find((d) => d.default);\n const input = snapshot.inputs.find((d) => d.default);\n return {\n master: level(output),\n mic: level(input),\n output: output?.name,\n input: input?.name,\n outputs: snapshot.outputs,\n inputs: snapshot.inputs,\n apps: Object.fromEntries(snapshot.apps.map((app) => [appKey(app.name), app])),\n };\n}\n\n// -- The helper ---------------------------------------------------------------------------------\n\nconst helper = new AudioHelper({\n command: () => {\n if (process.platform !== \"win32\") {\n throw new AudioUnavailable(\"Audio control is available on Windows only\");\n }\n const path = String(plugin.context?.settings().helper || \"\") || findHelper();\n if (!path) throw new AudioUnavailable(`${BUILD_HINT}.`);\n return [path];\n },\n onProblem: (problem) => plugin.context?.status(problem?.message, \"error\"),\n});\n\n/** One part of what the helper reports. */\nconst from = <K extends keyof ReturnType<typeof audioState>>(id: K, description: string) => ({\n description,\n start: (set: (value: ReturnType<typeof audioState>[K]) => void) =>\n helper.subscribe((snapshot) => set(audioState(snapshot)[id])),\n});\n\nconst values = {\n master: plugin.state.json(\n \"master\",\n \"Speakers\",\n from(\"master\", \"audio.master.volume, .muted, .name\"),\n ),\n mic: plugin.state.json(\"mic\", \"Microphone\", from(\"mic\", \"audio.mic.volume, .muted, .name\")),\n output: plugin.state.string(\n \"output\",\n \"Output device\",\n from(\"output\", \"The default output's name.\"),\n ),\n input: plugin.state.string(\"input\", \"Input device\", from(\"input\", \"The default input's name.\")),\n outputs: plugin.state.json(\n \"outputs\",\n \"Output devices\",\n from(\"outputs\", \"Every output with its level.\"),\n ),\n inputs: plugin.state.json(\n \"inputs\",\n \"Input devices\",\n from(\"inputs\", \"Every input with its level.\"),\n ),\n apps: plugin.state.json(\n \"apps\",\n \"App volumes\",\n from(\"apps\", \"audio.apps.spotify.volume, .muted, .active\"),\n ),\n};\n\n/** An icon (`lucide/mic`) as an image, once loaded. */\nconst useIcon = (icon: string, color: string) => useImage(`icon:${icon}`, color);\n\n// -- Volume -------------------------------------------------------------------------------------\n\nconst TARGETS = [\n { value: \"output\", label: \"Speakers (default output)\" },\n { value: \"input\", label: \"Microphone (default input)\" },\n { value: \"app\", label: \"One app\" },\n] as const;\n\ninterface TargetSettings {\n target: \"output\" | \"input\" | \"app\";\n app: string;\n}\n\nfunction targetOf(s: TargetSettings): Target {\n if (s.target !== \"app\") return { kind: s.target };\n if (!s.app.trim()) throw new Error(\"choose an app\");\n return { kind: \"app\", app: s.app.trim() };\n}\n\n/** The state path of a target's level, for templates and expressions. */\nexport function targetPath(s: TargetSettings): string {\n if (s.target === \"output\") return \"audio.master\";\n if (s.target === \"input\") return \"audio.mic\";\n return `audio.apps[${JSON.stringify(appKey(s.app))}]`;\n}\n\nconst targetName = (s: TargetSettings) =>\n s.target === \"output\" ? \"Volume\" : s.target === \"input\" ? \"Mic\" : appKey(s.app) || \"App\";\n\n/** Brand icons of common apps, by executable name. */\nconst APP_ICONS: Record<string, string> = {\n spotify: \"si/SiSpotify\",\n discord: \"si/SiDiscord\",\n chrome: \"si/SiGooglechrome\",\n firefox: \"si/SiFirefoxbrowser\",\n msedge: \"fa6/FaEdge\",\n brave: \"si/SiBrave\",\n opera: \"si/SiOpera\",\n steam: \"si/SiSteam\",\n vlc: \"si/SiVlcmediaplayer\",\n obs64: \"si/SiObsstudio\",\n slack: \"fa6/FaSlack\",\n zoom: \"si/SiZoom\",\n system: \"lucide/bell\",\n};\n\n/** The icons of a target: sounding and muted. */\nexport function targetIcons(s: TargetSettings): { on: string; off: string } {\n if (s.target === \"output\") return { on: \"lucide/volume-2\", off: \"lucide/volume-x\" };\n if (s.target === \"input\") return { on: \"lucide/mic\", off: \"lucide/mic-off\" };\n const brand = APP_ICONS[appKey(s.app)];\n // A brand keeps its own mark when muted; it turns red.\n return brand ? { on: brand, off: brand } : { on: \"lucide/app-window\", off: \"lucide/volume-x\" };\n}\n\nconst targetFields = {\n target: setting.select(\"Control\", TARGETS, { default: \"output\" }),\n app: setting.text(\"App\", {\n required: true,\n source: \"apps\",\n placeholder: \"spotify.exe\",\n description: \"The executable name, as it appears while the app plays sound.\",\n visibleIf: { target: \"app\" },\n }),\n};\n\ntype Operation = \"up\" | \"down\" | \"set\" | \"mute\" | \"unmute\" | \"toggle\";\n\nasync function adjust(\n target: Target,\n operation: Operation,\n step: number,\n level: number,\n): Promise<Change> {\n switch (operation) {\n case \"up\":\n return helper.request(\"setVolume\", { target, delta: step });\n case \"down\":\n return helper.request(\"setVolume\", { target, delta: -step });\n case \"set\":\n return helper.request(\"setVolume\", { target, volume: level });\n case \"toggle\":\n return helper.request(\"setMute\", { target });\n default:\n return helper.request(\"setMute\", { target, muted: operation === \"mute\" });\n }\n}\n\nconst OPERATION_NAMES: Record<Operation, string> = {\n up: \"Volume up\",\n down: \"Volume down\",\n set: \"Set volume\",\n mute: \"Mute\",\n unmute: \"Unmute\",\n toggle: \"Toggle mute\",\n};\n\nconst volume = plugin.action({\n id: \"volume\",\n name: \"Volume\",\n description: \"Changes or mutes the speakers, the microphone or one app, and shows its level.\",\n category: \"Audio\",\n icon: \"volume-2\",\n slots: [\"key\", \"sensor\"],\n settings: {\n ...targetFields,\n operation: setting.select(\"When pressed\", OPERATION_NAMES, { default: \"toggle\" }),\n step: setting.number(\"Step (%)\", {\n default: 5,\n min: 1,\n max: 50,\n visibleIf: { operation: [\"up\", \"down\"] },\n }),\n level: setting.number(\"Level (%)\", {\n default: 50,\n min: 0,\n max: 100,\n visibleIf: { operation: \"set\" },\n }),\n background: setting.color(\"Background\", { default: KEY, appearance: true }),\n },\n run: async ({ settings }) => {\n const target = targetOf(settings);\n const { before, after } = await adjust(\n target,\n settings.operation,\n settings.step,\n settings.level,\n );\n return {\n result: after,\n label: `${OPERATION_NAMES[settings.operation]} (${targetName(settings)})`,\n undo: async () => {\n await helper.request(\"setVolume\", { target, volume: before.volume });\n await helper.request(\"setMute\", { target, muted: before.muted });\n },\n };\n },\n look: (s, slot): Look => {\n const path = targetPath(s);\n const muted = `${path}.muted`;\n const icons = targetIcons(s);\n const step = s.operation === \"up\" ? \"plus\" : s.operation === \"down\" ? \"minus\" : \"\";\n const white = readable(\"#ffffff\", s.background);\n const red = readable(\"#f87171\", s.background);\n const blue = readable(BLUE, s.background);\n const level = `{{${path}.volume == null ? \"N/A\" : ${path}.volume + \"%\"}}`;\n const bar = meterLayer(\"bar\", `${path}.volume ?? 0`, { color: BLUE });\n if (step && s.target === \"output\") {\n const layers = (color: string) =>\n volumeStepLayers(step, slot, { color, stepColor: blue, center: 37, size: 52 });\n const [icon, sign] = layers(white);\n return {\n background: surface(s.background),\n layers: [\n { ...icon, visible: `!${muted}` },\n { ...layers(red)[0], id: \"muted\", visible: muted },\n sign,\n textLayer(\"level\", level, {\n color: white,\n size: 18,\n frame: { x: 0, y: 58, width: 100, height: 24 },\n }),\n bar,\n ],\n };\n }\n return {\n background: surface(s.background),\n layers: [\n iconLayer(\"icon\", icons.on, {\n color: white,\n size: 40,\n visible: `!${muted}`,\n row: \"icon\",\n }),\n iconLayer(\"muted\", icons.off, {\n color: red,\n size: 40,\n visible: muted,\n row: \"icon\",\n }),\n ...(step\n ? [\n iconLayer(\"step\", `lucide/${step}`, {\n color: blue,\n size: 20,\n row: \"icon\",\n }),\n ]\n : []),\n textLayer(\"level\", level, { color: white, size: 18 }),\n bar,\n ],\n };\n },\n});\n\n// -- Slider -------------------------------------------------------------------------------------\n\nconst slider = plugin.action({\n id: \"slider\",\n name: \"Volume slider\",\n description:\n \"A level bar on a sensor strip: touch it to step the volume (the left one lowers, the right one raises), hold to keep going.\",\n category: \"Audio\",\n icon: \"sliders-horizontal\",\n slots: [\"sensor\", \"window\", \"key\"],\n settings: {\n ...targetFields,\n direction: setting.select(\"Touching it\", {\n auto: \"Left lowers, right raises\",\n down: \"Lowers\",\n up: \"Raises\",\n }),\n step: setting.number(\"Step (%)\", { default: 4, min: 1, max: 50 }),\n color: setting.color(\"Bar colour\", { default: BLUE, appearance: true }),\n },\n run: async ({ settings }) => {\n const target = targetOf(settings);\n const delta = settings.direction === \"down\" ? -settings.step : settings.step;\n const { before, after } = await helper.request(\"setVolume\", { target, delta });\n return {\n result: after,\n label: `${targetName(settings)} ${after.volume}%`,\n undo: () => helper.request(\"setVolume\", { target, volume: before.volume }),\n };\n },\n component: ({ settings, slot, plugin }) => {\n const name = settings.target === \"output\" ? \"master\" : settings.target === \"input\" ? \"mic\" : \"\";\n const whole = useHostState(name ? `audio.${name}` : \"audio.apps\");\n const level = (\n name ? whole : (whole as Record<string, unknown> | undefined)?.[appKey(settings.app)]\n ) as { volume: number; muted: boolean } | undefined;\n const down =\n settings.direction === \"down\" ||\n (settings.direction === \"auto\" && slot.kind !== \"window\" && slot.index % 2 === 0);\n const step = () => {\n helper\n .request(\"setVolume\", {\n target: targetOf(settings),\n delta: down ? -settings.step : settings.step,\n })\n .catch((error: Error) => plugin.log(\"slider:\", error.message));\n };\n const sensorPressed = useSensorPressed(slot.kind === \"sensor\" ? slot.index : 0);\n const index = slot.kind === \"window\" ? -1 : slot.index;\n useSensorRepeat((i) => slot.kind === \"sensor\" && i === index && step(), {\n sensor: slot.kind === \"sensor\" ? index : -1,\n intervalMs: 150,\n });\n useKeyRepeat((i) => slot.kind === \"key\" && i === index && step(), {\n key: slot.kind === \"key\" ? index : -1,\n intervalMs: 150,\n });\n const strip = slot.kind === \"sensor\";\n const text = !level ? \"N/A\" : `${level.volume}%`;\n const icons = targetIcons(settings);\n const size = strip ? 12 : 24;\n const icon = useIcon(level?.muted ? icons.off : icons.on, \"#ffffff\");\n const arrow = useIcon(down ? \"lucide/minus\" : \"lucide/plus\", \"#ffffff\");\n return (\n <div\n style={{\n display: \"flex\",\n position: \"relative\",\n width: \"100%\",\n height: \"100%\",\n ...surfaceStyle(strip && sensorPressed ? \"#334155\" : KEY),\n alignItems: \"center\",\n justifyContent: \"center\",\n }}\n >\n <div\n style={{\n display: \"flex\",\n position: \"absolute\",\n left: 0,\n top: 0,\n bottom: 0,\n width: `${level?.volume ?? 0}%`,\n background: level?.muted ? \"#7f1d1d\" : settings.color,\n opacity: 0.6,\n }}\n />\n <div\n style={{\n display: \"flex\",\n flexDirection: \"row\",\n alignItems: \"center\",\n gap: strip ? 3 : 6,\n color: \"#ffffff\",\n fontWeight: 700,\n fontSize: 20,\n }}\n >\n {strip && arrow ? <img src={arrow} width={10} height={10} alt=\"\" /> : null}\n {icon ? <img src={icon} width={size} height={size} alt=\"\" /> : null}\n {/* On a sensor the bar alone shows the level. */}\n {strip ? null : <div style={{ display: \"flex\" }}>{text}</div>}\n </div>\n </div>\n );\n },\n});\n\n// -- Default device -----------------------------------------------------------------------------\n\nconst NEXT = \"__next\";\n\n/** The device after the default one, for \"Next device\". */\nexport function nextDevice(devices: readonly AudioDevice[]): AudioDevice | undefined {\n const at = devices.findIndex((d) => d.default);\n return devices[(at + 1) % devices.length];\n}\n\nconst defaultDevice = plugin.action({\n id: \"default-device\",\n name: \"Switch audio device\",\n description: \"Makes another speaker or microphone the default, or steps through them.\",\n category: \"Audio\",\n icon: \"speaker\",\n slots: [\"key\", \"sensor\"],\n settings: {\n flow: setting.select(\"Switch the\", {\n output: \"Output (speakers)\",\n input: \"Input (microphone)\",\n }),\n output: setting.pick(\"To\", \"outputs\", {\n first: [{ value: NEXT, label: \"The next device\" }],\n default: NEXT,\n visibleIf: { flow: \"output\" },\n }),\n input: setting.pick(\"To\", \"inputs\", {\n first: [{ value: NEXT, label: \"The next device\" }],\n default: NEXT,\n visibleIf: { flow: \"input\" },\n }),\n background: setting.color(\"Background\", { default: KEY, appearance: true }),\n },\n run: async ({ settings }) => {\n const wanted = settings.flow === \"output\" ? settings.output : settings.input;\n const snapshot = await helper.request(\"snapshot\");\n const devices = settings.flow === \"output\" ? snapshot.outputs : snapshot.inputs;\n const device = wanted === NEXT ? nextDevice(devices) : devices.find((d) => d.id === wanted);\n if (!device) throw new Error(\"that audio device is not connected\");\n const { previous } = await helper.request(\"setDefault\", { device: device.id });\n return {\n result: device.name,\n label: `Audio ${settings.flow}: ${device.name}`,\n ...(previous && {\n undo: () => helper.request(\"setDefault\", { device: previous }),\n }),\n };\n },\n look: (s): Look => ({\n background: surface(s.background),\n layers: [\n iconLayer(\"icon\", s.flow === \"output\" ? \"lucide/headphones\" : \"lucide/mic\", {\n color: readable(\"#ffffff\", s.background),\n size: iconSize(true) - 4,\n row: \"icon\",\n }),\n iconLayer(\"switch\", \"lucide/arrow-left-right\", {\n color: readable(\"#c4b5fd\", s.background),\n size: 20,\n row: \"icon\",\n }),\n captionLayer(\"device\", `{{${values[s.flow].key} ?? \"N/A\"}}`, {\n color: readable(\"#f4f4f5\", s.background),\n size: 11,\n }),\n ],\n }),\n});\n\nconst deviceOptions = async (flow: \"outputs\" | \"inputs\") =>\n (await helper.request(\"snapshot\"))[flow].map((d) => ({ value: d.id, label: d.name }));\n\nexport default plugin.define({\n onboarding: {\n steps: [\n {\n id: \"helper\",\n title: \"The audio helper\",\n body: \"sdeck reaches your speakers, microphone and apps through a small helper that comes with this plugin on Windows. Leave this empty unless it is somewhere else.\",\n settings: [\"helper\"],\n done: (activated) => {\n const custom = String(activated.settings().helper ?? \"\").trim();\n return custom ? existsSync(custom) : findHelper() !== undefined;\n },\n },\n ],\n },\n actions: [volume, slider, defaultDevice],\n sources: Object.values(sources),\n state: Object.values(values),\n activate(activated) {\n if (process.platform !== \"win32\") {\n activated.status(\"Audio control is available on Windows only\", \"info\");\n } else if (!findHelper() && !activated.settings().helper) {\n activated.status(`${BUILD_HINT}.`, \"info\");\n }\n return () => {\n helper.close();\n };\n },\n});\n",
|
|
6
6
|
"/**\n * Talks to `sdeck-audio`, the helper process that reaches the system's audio devices. It runs\n * only while something needs it, and is restarted if it stops on its own.\n */\nimport { type ChildProcess, spawn } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport interface Level {\n /** 0–100. */\n volume: number;\n muted: boolean;\n}\n\nexport interface AudioDevice extends Level {\n id: string;\n name: string;\n default: boolean;\n}\n\nexport interface AudioApp extends Level {\n /** Executable name, lowercased (`system` for system sounds). */\n name: string;\n active: boolean;\n}\n\nexport interface Snapshot {\n outputs: AudioDevice[];\n inputs: AudioDevice[];\n apps: AudioApp[];\n}\n\nexport interface Change {\n before: Level;\n after: Level;\n}\n\nexport type Target =\n | { kind: \"output\"; device?: string }\n | { kind: \"input\"; device?: string }\n | { kind: \"app\"; app: string };\n\nexport interface Requests {\n snapshot: { params: undefined; result: Snapshot };\n setVolume: { params: { target: Target; volume?: number; delta?: number }; result: Change };\n setMute: { params: { target: Target; muted?: boolean }; result: Change };\n setDefault: { params: { device: string }; result: { previous: string | null } };\n}\n\n/** Why there is no audio: shown to the user. */\nexport class AudioUnavailable extends Error {}\n\nexport const BUILD_HINT = \"Build the audio helper with `bun run build:audio`\";\n\n/**\n * Where the helper is: `SDECK_AUDIO_BIN`, the cargo build next to this package, or `bin/` next to\n * a bundled app.\n */\nexport function findHelper(\n env: Record<string, string | undefined> = process.env,\n base: string = import.meta.dir,\n exists: (path: string) => boolean = existsSync,\n): string | undefined {\n const name = process.platform === \"win32\" ? \"sdeck-audio.exe\" : \"sdeck-audio\";\n return [\n env.SDECK_AUDIO_BIN,\n join(base, \"..\", \"native\", \"target\", \"release\", name),\n join(base, \"..\", \"bin\", name),\n join(base, \"..\", \"native\", \"target\", \"debug\", name),\n ].find((path): path is string => Boolean(path) && exists(path as string));\n}\n\ninterface Pending {\n resolve: (value: unknown) => void;\n reject: (error: Error) => void;\n timer: ReturnType<typeof setTimeout>;\n}\n\nexport interface AudioHelperOptions {\n /** The command line to run; throw {@link AudioUnavailable} when there is none. */\n command: () => string[];\n /** The helper could not run, or stopped. `undefined`: it works again. */\n onProblem?: (problem: Error | undefined) => void;\n /** How long it keeps running after the last user leaves. */\n lingerMs?: number;\n timeoutMs?: number;\n}\n\nexport class AudioHelper {\n readonly #options: AudioHelperOptions;\n readonly #listeners = new Set<(snapshot: Snapshot | undefined) => void>();\n readonly #pending = new Map<number, Pending>();\n #child: ChildProcess | undefined;\n #snapshot: Snapshot | undefined;\n #users = 0;\n #next = 1;\n #linger: ReturnType<typeof setTimeout> | undefined;\n #restart: ReturnType<typeof setTimeout> | undefined;\n #delay = 1000;\n\n constructor(options: AudioHelperOptions) {\n this.#options = options;\n }\n\n /** The devices as last reported, while the helper runs. */\n get snapshot(): Snapshot | undefined {\n return this.#snapshot;\n }\n\n /** Whether the helper process is running. */\n get running(): boolean {\n return this.#child !== undefined;\n }\n\n /** Hears every snapshot while subscribed (which keeps the helper running). */\n subscribe(listener: (snapshot: Snapshot | undefined) => void): () => void {\n this.#listeners.add(listener);\n const release = this.#acquire();\n if (this.#snapshot) listener(this.#snapshot);\n return () => {\n this.#listeners.delete(listener);\n release();\n };\n }\n\n async request<M extends keyof Requests>(\n method: M,\n params?: Requests[M][\"params\"],\n ): Promise<Requests[M][\"result\"]> {\n const release = this.#acquire();\n try {\n const child = this.#child ?? this.#start();\n const id = this.#next++;\n return (await new Promise<unknown>((resolve, reject) => {\n const timer = setTimeout(() => {\n this.#pending.delete(id);\n reject(new Error(\"the audio helper did not answer\"));\n }, this.#options.timeoutMs ?? 5000);\n this.#pending.set(id, { resolve, reject, timer });\n child.stdin?.write(`${JSON.stringify({ id, method, params })}\\n`);\n })) as Requests[M][\"result\"];\n } finally {\n release();\n }\n }\n\n /** Stops the helper now, whoever uses it. */\n close(): void {\n this.#users = 0;\n this.#listeners.clear();\n clearTimeout(this.#linger);\n this.#stop();\n }\n\n #acquire(): () => void {\n this.#users++;\n clearTimeout(this.#linger);\n if (!this.#child && !this.#restart) {\n try {\n this.#start();\n } catch (error) {\n this.#options.onProblem?.(error as Error);\n }\n }\n let released = false;\n return () => {\n if (released) return;\n released = true;\n this.#users--;\n if (this.#users > 0) return;\n this.#linger = setTimeout(() => this.#stop(), this.#options.lingerMs ?? 3000);\n };\n }\n\n #start(): ChildProcess {\n clearTimeout(this.#restart);\n this.#restart = undefined;\n const [file, ...args] = this.#options.command();\n if (!file) throw new AudioUnavailable(BUILD_HINT);\n const child = spawn(file, args, { stdio: [\"pipe\", \"pipe\", \"pipe\"], windowsHide: true });\n this.#child = child;\n let buffer = \"\";\n let errors = \"\";\n child.stdout?.setEncoding(\"utf8\");\n child.stdout?.on(\"data\", (chunk: string) => {\n buffer += chunk;\n const lines = buffer.split(\"\\n\");\n buffer = lines.pop() ?? \"\";\n for (const line of lines) this.#receive(line);\n });\n child.stderr?.setEncoding(\"utf8\");\n child.stderr?.on(\"data\", (chunk: string) => {\n errors = (errors + chunk).slice(-2000);\n });\n // Writing to a helper that just died must not crash the host.\n child.stdin?.on(\"error\", () => {});\n const ended = (reason: string) => {\n if (this.#child !== child) return;\n this.#child = undefined;\n this.#fail(new Error(reason));\n this.#publish(undefined);\n this.#options.onProblem?.(new AudioUnavailable(reason));\n if (this.#users <= 0) return;\n this.#restart = setTimeout(() => {\n this.#restart = undefined;\n if (this.#users <= 0 || this.#child) return;\n try {\n this.#start();\n } catch (error) {\n this.#options.onProblem?.(error as Error);\n }\n }, this.#delay);\n this.#delay = Math.min(this.#delay * 2, 30_000);\n };\n child.once(\"error\", (error) => ended(`the audio helper cannot run: ${error.message}`));\n child.once(\"close\", (code) =>\n ended(errors.trim() || `the audio helper stopped (exit ${code})`),\n );\n return child;\n }\n\n #stop(): void {\n clearTimeout(this.#restart);\n this.#restart = undefined;\n const child = this.#child;\n this.#child = undefined;\n this.#fail(new Error(\"the audio helper was stopped\"));\n this.#publish(undefined);\n if (!child) return;\n // Closing its input asks it to exit; insist if it does not.\n child.stdin?.end();\n const kill = setTimeout(() => child.kill(), 2000);\n child.once(\"close\", () => clearTimeout(kill));\n }\n\n #receive(line: string): void {\n let message: { id?: number; result?: unknown; error?: string; event?: string; data?: unknown };\n try {\n message = JSON.parse(line);\n } catch {\n return;\n }\n if (message.event === \"snapshot\") {\n this.#delay = 1000;\n this.#options.onProblem?.(undefined);\n this.#publish(message.data as Snapshot);\n return;\n }\n const pending = this.#pending.get(message.id ?? -1);\n if (!pending) return;\n this.#pending.delete(message.id as number);\n clearTimeout(pending.timer);\n if (message.error !== undefined) pending.reject(new Error(message.error));\n else pending.resolve(message.result);\n }\n\n #publish(snapshot: Snapshot | undefined): void {\n if (this.#snapshot === undefined && snapshot === undefined) return;\n this.#snapshot = snapshot;\n for (const listener of [...this.#listeners]) listener(snapshot);\n }\n\n #fail(error: Error): void {\n for (const pending of this.#pending.values()) {\n clearTimeout(pending.timer);\n pending.reject(error);\n }\n this.#pending.clear();\n }\n}\n"
|
|
7
7
|
],
|
|
8
|
-
"mappings": ";;AAAA,uBAAS;AACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWA;;;ACRA;AACA;AACA;AAAA;AA4CO,MAAM,yBAAyB,MAAM;AAAC;AAEtC,IAAM,aAAa;AAMnB,SAAS,UAAU,CACxB,MAA0C,QAAQ,KAClD,OAAe,YAAY,KAC3B,SAAoC,YAChB;AAAA,EACpB,MAAM,OAAO,QAAQ,aAAa,UAAU,oBAAoB;AAAA,EAChE,OAAO;AAAA,IACL,IAAI;AAAA,IACJ,KAAK,MAAM,MAAM,UAAU,UAAU,WAAW,IAAI;AAAA,IACpD,KAAK,MAAM,MAAM,OAAO,IAAI;AAAA,IAC5B,KAAK,MAAM,MAAM,UAAU,UAAU,SAAS,IAAI;AAAA,EACpD,EAAE,KAAK,CAAC,SAAyB,QAAQ,IAAI,KAAK,OAAO,IAAc,CAAC;AAAA;AAAA;AAmBnE,MAAM,YAAY;AAAA,EACd;AAAA,EACA,aAAa,IAAI;AAAA,EACjB,WAAW,IAAI;AAAA,EAC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AAC,WAAW,KAAK,CAAC,UAAU,SAAS,EAAE,QAAQ;AAAA,MACxD,UAAU,OAAO,GAAG,eAAe,MAAM;AAAA,IAC3C;AAAA,IACA,OAAO,MAAM;AAAA,MACX,QAAO,MAAM;AAAA;AAAA;AAGnB,CAAC;",
|
|
9
|
+
"debugId": "63A17C8D33B6ABFC64756E2164756E21",
|
|
10
10
|
"names": []
|
|
11
11
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdeck/plugin-audio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Built-in sdeck audio actions: volume and mute for devices and apps, device switching.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"./package.json": "./package.json"
|
|
28
28
|
},
|
|
29
29
|
"sdeck": {
|
|
30
|
-
"apiVersion":
|
|
30
|
+
"apiVersion": 3,
|
|
31
31
|
"entry": "./dist/index.js"
|
|
32
32
|
},
|
|
33
33
|
"scripts": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"build:native": "cargo build --release --manifest-path native/Cargo.toml"
|
|
38
38
|
},
|
|
39
39
|
"peerDependencies": {
|
|
40
|
-
"@sdeck/plugin": "^0.
|
|
41
|
-
"@sdeck/schema": "^0.
|
|
40
|
+
"@sdeck/plugin": "^0.4.0",
|
|
41
|
+
"@sdeck/schema": "^0.4.0",
|
|
42
42
|
"react": ">=19.3"
|
|
43
43
|
},
|
|
44
44
|
"peerDependenciesMeta": {
|
|
@@ -53,8 +53,8 @@
|
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@sdeck/plugin": "0.
|
|
57
|
-
"@sdeck/schema": "0.
|
|
56
|
+
"@sdeck/plugin": "0.4.0",
|
|
57
|
+
"@sdeck/schema": "0.4.0"
|
|
58
58
|
},
|
|
59
59
|
"repository": {
|
|
60
60
|
"type": "git",
|
package/src/index.tsx
CHANGED
|
@@ -1,16 +1,27 @@
|
|
|
1
1
|
import { existsSync } from "node:fs";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
type StateDef,
|
|
3
|
+
createPlugin,
|
|
4
|
+
Permissions,
|
|
5
|
+
setting,
|
|
7
6
|
useHostState,
|
|
8
7
|
useImage,
|
|
9
8
|
useKeyRepeat,
|
|
10
9
|
useSensorPressed,
|
|
11
10
|
useSensorRepeat,
|
|
12
11
|
} from "@sdeck/plugin";
|
|
13
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
captionLayer,
|
|
14
|
+
iconLayer,
|
|
15
|
+
iconSize,
|
|
16
|
+
KEY,
|
|
17
|
+
type Look,
|
|
18
|
+
meterLayer,
|
|
19
|
+
readable,
|
|
20
|
+
surface,
|
|
21
|
+
surfaceStyle,
|
|
22
|
+
textLayer,
|
|
23
|
+
volumeStepLayers,
|
|
24
|
+
} from "@sdeck/schema";
|
|
14
25
|
import {
|
|
15
26
|
type AudioDevice,
|
|
16
27
|
AudioHelper,
|
|
@@ -24,6 +35,32 @@ import {
|
|
|
24
35
|
|
|
25
36
|
export * from "./helper.ts";
|
|
26
37
|
|
|
38
|
+
const BLUE = "#60a5fa";
|
|
39
|
+
|
|
40
|
+
const plugin = createPlugin({
|
|
41
|
+
id: "@sdeck/plugin-audio",
|
|
42
|
+
name: "Audio",
|
|
43
|
+
version: "0.4.0",
|
|
44
|
+
namespace: "audio",
|
|
45
|
+
description: "Volume and mute for speakers, microphone and each app, and device switching.",
|
|
46
|
+
author: "sdeck",
|
|
47
|
+
permissions: [Permissions.audio, Permissions.process],
|
|
48
|
+
settings: {
|
|
49
|
+
helper: setting.text("Audio helper", {
|
|
50
|
+
placeholder: "Found automatically",
|
|
51
|
+
description: "Full path of sdeck-audio, if it is somewhere unusual.",
|
|
52
|
+
}),
|
|
53
|
+
},
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
const sources = {
|
|
57
|
+
outputs: plugin.source("outputs", () => deviceOptions("outputs")),
|
|
58
|
+
inputs: plugin.source("inputs", () => deviceOptions("inputs")),
|
|
59
|
+
apps: plugin.source("apps", async () =>
|
|
60
|
+
(await helper.request("snapshot")).apps.map((a) => ({ value: a.name, label: a.name })),
|
|
61
|
+
),
|
|
62
|
+
};
|
|
63
|
+
|
|
27
64
|
/** `Spotify.exe` → `spotify`, the key of `audio.apps`. */
|
|
28
65
|
export function appKey(name: string): string {
|
|
29
66
|
return name
|
|
@@ -62,33 +99,55 @@ export function audioState(snapshot: Snapshot | undefined) {
|
|
|
62
99
|
|
|
63
100
|
// -- The helper ---------------------------------------------------------------------------------
|
|
64
101
|
|
|
65
|
-
let context: PluginContext | undefined;
|
|
66
|
-
|
|
67
102
|
const helper = new AudioHelper({
|
|
68
103
|
command: () => {
|
|
69
104
|
if (process.platform !== "win32") {
|
|
70
105
|
throw new AudioUnavailable("Audio control is available on Windows only");
|
|
71
106
|
}
|
|
72
|
-
const path = String(context?.settings().helper || "") || findHelper();
|
|
107
|
+
const path = String(plugin.context?.settings().helper || "") || findHelper();
|
|
73
108
|
if (!path) throw new AudioUnavailable(`${BUILD_HINT}.`);
|
|
74
109
|
return [path];
|
|
75
110
|
},
|
|
76
|
-
onProblem: (problem) => context?.status(problem?.message, "error"),
|
|
111
|
+
onProblem: (problem) => plugin.context?.status(problem?.message, "error"),
|
|
77
112
|
});
|
|
78
113
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
name: string,
|
|
82
|
-
type: "string" | "json",
|
|
83
|
-
description: string,
|
|
84
|
-
): StateDef => ({
|
|
85
|
-
id,
|
|
86
|
-
name,
|
|
87
|
-
type,
|
|
114
|
+
/** One part of what the helper reports. */
|
|
115
|
+
const from = <K extends keyof ReturnType<typeof audioState>>(id: K, description: string) => ({
|
|
88
116
|
description,
|
|
89
|
-
start: (set
|
|
117
|
+
start: (set: (value: ReturnType<typeof audioState>[K]) => void) =>
|
|
118
|
+
helper.subscribe((snapshot) => set(audioState(snapshot)[id])),
|
|
90
119
|
});
|
|
91
120
|
|
|
121
|
+
const values = {
|
|
122
|
+
master: plugin.state.json(
|
|
123
|
+
"master",
|
|
124
|
+
"Speakers",
|
|
125
|
+
from("master", "audio.master.volume, .muted, .name"),
|
|
126
|
+
),
|
|
127
|
+
mic: plugin.state.json("mic", "Microphone", from("mic", "audio.mic.volume, .muted, .name")),
|
|
128
|
+
output: plugin.state.string(
|
|
129
|
+
"output",
|
|
130
|
+
"Output device",
|
|
131
|
+
from("output", "The default output's name."),
|
|
132
|
+
),
|
|
133
|
+
input: plugin.state.string("input", "Input device", from("input", "The default input's name.")),
|
|
134
|
+
outputs: plugin.state.json(
|
|
135
|
+
"outputs",
|
|
136
|
+
"Output devices",
|
|
137
|
+
from("outputs", "Every output with its level."),
|
|
138
|
+
),
|
|
139
|
+
inputs: plugin.state.json(
|
|
140
|
+
"inputs",
|
|
141
|
+
"Input devices",
|
|
142
|
+
from("inputs", "Every input with its level."),
|
|
143
|
+
),
|
|
144
|
+
apps: plugin.state.json(
|
|
145
|
+
"apps",
|
|
146
|
+
"App volumes",
|
|
147
|
+
from("apps", "audio.apps.spotify.volume, .muted, .active"),
|
|
148
|
+
),
|
|
149
|
+
};
|
|
150
|
+
|
|
92
151
|
/** An icon (`lucide/mic`) as an image, once loaded. */
|
|
93
152
|
const useIcon = (icon: string, color: string) => useImage(`icon:${icon}`, color);
|
|
94
153
|
|
|
@@ -148,16 +207,15 @@ export function targetIcons(s: TargetSettings): { on: string; off: string } {
|
|
|
148
207
|
}
|
|
149
208
|
|
|
150
209
|
const targetFields = {
|
|
151
|
-
target:
|
|
152
|
-
app: {
|
|
153
|
-
|
|
154
|
-
label: "App",
|
|
210
|
+
target: setting.select("Control", TARGETS, { default: "output" }),
|
|
211
|
+
app: setting.text("App", {
|
|
212
|
+
required: true,
|
|
155
213
|
source: "apps",
|
|
156
214
|
placeholder: "spotify.exe",
|
|
157
215
|
description: "The executable name, as it appears while the app plays sound.",
|
|
158
216
|
visibleIf: { target: "app" },
|
|
159
|
-
},
|
|
160
|
-
}
|
|
217
|
+
}),
|
|
218
|
+
};
|
|
161
219
|
|
|
162
220
|
type Operation = "up" | "down" | "set" | "mute" | "unmute" | "toggle";
|
|
163
221
|
|
|
@@ -190,7 +248,7 @@ const OPERATION_NAMES: Record<Operation, string> = {
|
|
|
190
248
|
toggle: "Toggle mute",
|
|
191
249
|
};
|
|
192
250
|
|
|
193
|
-
const volume =
|
|
251
|
+
const volume = plugin.action({
|
|
194
252
|
id: "volume",
|
|
195
253
|
name: "Volume",
|
|
196
254
|
description: "Changes or mutes the speakers, the microphone or one app, and shows its level.",
|
|
@@ -199,32 +257,20 @@ const volume = defineAction({
|
|
|
199
257
|
slots: ["key", "sensor"],
|
|
200
258
|
settings: {
|
|
201
259
|
...targetFields,
|
|
202
|
-
operation: {
|
|
203
|
-
|
|
204
|
-
label: "When pressed",
|
|
205
|
-
default: "toggle",
|
|
206
|
-
options: Object.entries(OPERATION_NAMES).map(([value, label]) => ({ value, label })) as {
|
|
207
|
-
value: Operation;
|
|
208
|
-
label: string;
|
|
209
|
-
}[],
|
|
210
|
-
},
|
|
211
|
-
step: {
|
|
212
|
-
type: "number",
|
|
213
|
-
label: "Step (%)",
|
|
260
|
+
operation: setting.select("When pressed", OPERATION_NAMES, { default: "toggle" }),
|
|
261
|
+
step: setting.number("Step (%)", {
|
|
214
262
|
default: 5,
|
|
215
263
|
min: 1,
|
|
216
264
|
max: 50,
|
|
217
265
|
visibleIf: { operation: ["up", "down"] },
|
|
218
|
-
},
|
|
219
|
-
level: {
|
|
220
|
-
type: "number",
|
|
221
|
-
label: "Level (%)",
|
|
266
|
+
}),
|
|
267
|
+
level: setting.number("Level (%)", {
|
|
222
268
|
default: 50,
|
|
223
269
|
min: 0,
|
|
224
270
|
max: 100,
|
|
225
271
|
visibleIf: { operation: "set" },
|
|
226
|
-
},
|
|
227
|
-
background:
|
|
272
|
+
}),
|
|
273
|
+
background: setting.color("Background", { default: KEY, appearance: true }),
|
|
228
274
|
},
|
|
229
275
|
run: async ({ settings }) => {
|
|
230
276
|
const target = targetOf(settings);
|
|
@@ -243,43 +289,61 @@ const volume = defineAction({
|
|
|
243
289
|
},
|
|
244
290
|
};
|
|
245
291
|
},
|
|
246
|
-
look: (s): Look => {
|
|
292
|
+
look: (s, slot): Look => {
|
|
247
293
|
const path = targetPath(s);
|
|
248
294
|
const muted = `${path}.muted`;
|
|
249
295
|
const icons = targetIcons(s);
|
|
250
296
|
const step = s.operation === "up" ? "plus" : s.operation === "down" ? "minus" : "";
|
|
297
|
+
const white = readable("#ffffff", s.background);
|
|
298
|
+
const red = readable("#f87171", s.background);
|
|
299
|
+
const blue = readable(BLUE, s.background);
|
|
300
|
+
const level = `{{${path}.volume == null ? "N/A" : ${path}.volume + "%"}}`;
|
|
301
|
+
const bar = meterLayer("bar", `${path}.volume ?? 0`, { color: BLUE });
|
|
302
|
+
if (step && s.target === "output") {
|
|
303
|
+
const layers = (color: string) =>
|
|
304
|
+
volumeStepLayers(step, slot, { color, stepColor: blue, center: 37, size: 52 });
|
|
305
|
+
const [icon, sign] = layers(white);
|
|
306
|
+
return {
|
|
307
|
+
background: surface(s.background),
|
|
308
|
+
layers: [
|
|
309
|
+
{ ...icon, visible: `!${muted}` },
|
|
310
|
+
{ ...layers(red)[0], id: "muted", visible: muted },
|
|
311
|
+
sign,
|
|
312
|
+
textLayer("level", level, {
|
|
313
|
+
color: white,
|
|
314
|
+
size: 18,
|
|
315
|
+
frame: { x: 0, y: 58, width: 100, height: 24 },
|
|
316
|
+
}),
|
|
317
|
+
bar,
|
|
318
|
+
],
|
|
319
|
+
};
|
|
320
|
+
}
|
|
251
321
|
return {
|
|
252
|
-
background: s.background,
|
|
322
|
+
background: surface(s.background),
|
|
253
323
|
layers: [
|
|
254
324
|
iconLayer("icon", icons.on, {
|
|
255
|
-
|
|
256
|
-
|
|
325
|
+
color: white,
|
|
326
|
+
size: 40,
|
|
257
327
|
visible: `!${muted}`,
|
|
258
328
|
row: "icon",
|
|
259
329
|
}),
|
|
260
330
|
iconLayer("muted", icons.off, {
|
|
261
|
-
color:
|
|
262
|
-
size:
|
|
263
|
-
position: "top",
|
|
331
|
+
color: red,
|
|
332
|
+
size: 40,
|
|
264
333
|
visible: muted,
|
|
265
334
|
row: "icon",
|
|
266
335
|
}),
|
|
267
336
|
...(step
|
|
268
|
-
? [
|
|
337
|
+
? [
|
|
338
|
+
iconLayer("step", `lucide/${step}`, {
|
|
339
|
+
color: blue,
|
|
340
|
+
size: 20,
|
|
341
|
+
row: "icon",
|
|
342
|
+
}),
|
|
343
|
+
]
|
|
269
344
|
: []),
|
|
270
|
-
textLayer("level",
|
|
271
|
-
|
|
272
|
-
position: "bottom",
|
|
273
|
-
}),
|
|
274
|
-
{
|
|
275
|
-
id: "bar",
|
|
276
|
-
type: "bar",
|
|
277
|
-
value: `${path}.volume ?? 0`,
|
|
278
|
-
color: "#60a5fa",
|
|
279
|
-
track: "#1e293b",
|
|
280
|
-
position: "bottom",
|
|
281
|
-
thickness: 6,
|
|
282
|
-
},
|
|
345
|
+
textLayer("level", level, { color: white, size: 18 }),
|
|
346
|
+
bar,
|
|
283
347
|
],
|
|
284
348
|
};
|
|
285
349
|
},
|
|
@@ -287,7 +351,7 @@ const volume = defineAction({
|
|
|
287
351
|
|
|
288
352
|
// -- Slider -------------------------------------------------------------------------------------
|
|
289
353
|
|
|
290
|
-
const slider =
|
|
354
|
+
const slider = plugin.action({
|
|
291
355
|
id: "slider",
|
|
292
356
|
name: "Volume slider",
|
|
293
357
|
description:
|
|
@@ -297,18 +361,13 @@ const slider = defineAction({
|
|
|
297
361
|
slots: ["sensor", "window", "key"],
|
|
298
362
|
settings: {
|
|
299
363
|
...targetFields,
|
|
300
|
-
direction: {
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
{ value: "up", label: "Raises" },
|
|
308
|
-
],
|
|
309
|
-
},
|
|
310
|
-
step: { type: "number", label: "Step (%)", default: 4, min: 1, max: 50 },
|
|
311
|
-
color: { type: "color", label: "Bar colour", default: "#60a5fa", appearance: true },
|
|
364
|
+
direction: setting.select("Touching it", {
|
|
365
|
+
auto: "Left lowers, right raises",
|
|
366
|
+
down: "Lowers",
|
|
367
|
+
up: "Raises",
|
|
368
|
+
}),
|
|
369
|
+
step: setting.number("Step (%)", { default: 4, min: 1, max: 50 }),
|
|
370
|
+
color: setting.color("Bar colour", { default: BLUE, appearance: true }),
|
|
312
371
|
},
|
|
313
372
|
run: async ({ settings }) => {
|
|
314
373
|
const target = targetOf(settings);
|
|
@@ -360,7 +419,7 @@ const slider = defineAction({
|
|
|
360
419
|
position: "relative",
|
|
361
420
|
width: "100%",
|
|
362
421
|
height: "100%",
|
|
363
|
-
|
|
422
|
+
...surfaceStyle(strip && sensorPressed ? "#334155" : KEY),
|
|
364
423
|
alignItems: "center",
|
|
365
424
|
justifyContent: "center",
|
|
366
425
|
}}
|
|
@@ -408,7 +467,7 @@ export function nextDevice(devices: readonly AudioDevice[]): AudioDevice | undef
|
|
|
408
467
|
return devices[(at + 1) % devices.length];
|
|
409
468
|
}
|
|
410
469
|
|
|
411
|
-
const defaultDevice =
|
|
470
|
+
const defaultDevice = plugin.action({
|
|
412
471
|
id: "default-device",
|
|
413
472
|
name: "Switch audio device",
|
|
414
473
|
description: "Makes another speaker or microphone the default, or steps through them.",
|
|
@@ -416,32 +475,21 @@ const defaultDevice = defineAction({
|
|
|
416
475
|
icon: "speaker",
|
|
417
476
|
slots: ["key", "sensor"],
|
|
418
477
|
settings: {
|
|
419
|
-
flow: {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
{ value: "input", label: "Input (microphone)" },
|
|
426
|
-
],
|
|
427
|
-
},
|
|
428
|
-
output: {
|
|
429
|
-
type: "select",
|
|
430
|
-
label: "To",
|
|
478
|
+
flow: setting.select("Switch the", {
|
|
479
|
+
output: "Output (speakers)",
|
|
480
|
+
input: "Input (microphone)",
|
|
481
|
+
}),
|
|
482
|
+
output: setting.pick("To", "outputs", {
|
|
483
|
+
first: [{ value: NEXT, label: "The next device" }],
|
|
431
484
|
default: NEXT,
|
|
432
|
-
source: "outputs",
|
|
433
|
-
options: [{ value: NEXT, label: "The next device" }],
|
|
434
485
|
visibleIf: { flow: "output" },
|
|
435
|
-
},
|
|
436
|
-
input: {
|
|
437
|
-
|
|
438
|
-
label: "To",
|
|
486
|
+
}),
|
|
487
|
+
input: setting.pick("To", "inputs", {
|
|
488
|
+
first: [{ value: NEXT, label: "The next device" }],
|
|
439
489
|
default: NEXT,
|
|
440
|
-
source: "inputs",
|
|
441
|
-
options: [{ value: NEXT, label: "The next device" }],
|
|
442
490
|
visibleIf: { flow: "input" },
|
|
443
|
-
},
|
|
444
|
-
background:
|
|
491
|
+
}),
|
|
492
|
+
background: setting.color("Background", { default: KEY, appearance: true }),
|
|
445
493
|
},
|
|
446
494
|
run: async ({ settings }) => {
|
|
447
495
|
const wanted = settings.flow === "output" ? settings.output : settings.input;
|
|
@@ -459,20 +507,22 @@ const defaultDevice = defineAction({
|
|
|
459
507
|
};
|
|
460
508
|
},
|
|
461
509
|
look: (s): Look => ({
|
|
462
|
-
background: s.background,
|
|
510
|
+
background: surface(s.background),
|
|
463
511
|
layers: [
|
|
464
512
|
iconLayer("icon", s.flow === "output" ? "lucide/headphones" : "lucide/mic", {
|
|
465
|
-
|
|
466
|
-
|
|
513
|
+
color: readable("#ffffff", s.background),
|
|
514
|
+
size: iconSize(true) - 4,
|
|
467
515
|
row: "icon",
|
|
468
516
|
}),
|
|
469
517
|
iconLayer("switch", "lucide/arrow-left-right", {
|
|
470
|
-
color: "#c4b5fd",
|
|
471
|
-
size:
|
|
472
|
-
position: "top",
|
|
518
|
+
color: readable("#c4b5fd", s.background),
|
|
519
|
+
size: 20,
|
|
473
520
|
row: "icon",
|
|
474
521
|
}),
|
|
475
|
-
|
|
522
|
+
captionLayer("device", `{{${values[s.flow].key} ?? "N/A"}}`, {
|
|
523
|
+
color: readable("#f4f4f5", s.background),
|
|
524
|
+
size: 11,
|
|
525
|
+
}),
|
|
476
526
|
],
|
|
477
527
|
}),
|
|
478
528
|
});
|
|
@@ -480,22 +530,7 @@ const defaultDevice = defineAction({
|
|
|
480
530
|
const deviceOptions = async (flow: "outputs" | "inputs") =>
|
|
481
531
|
(await helper.request("snapshot"))[flow].map((d) => ({ value: d.id, label: d.name }));
|
|
482
532
|
|
|
483
|
-
export default
|
|
484
|
-
id: "@sdeck/plugin-audio",
|
|
485
|
-
name: "Audio",
|
|
486
|
-
version: "0.2.0",
|
|
487
|
-
namespace: "audio",
|
|
488
|
-
description: "Volume and mute for speakers, microphone and each app, and device switching.",
|
|
489
|
-
author: "sdeck",
|
|
490
|
-
permissions: ["audio", "process"],
|
|
491
|
-
settings: {
|
|
492
|
-
helper: {
|
|
493
|
-
type: "text",
|
|
494
|
-
label: "Audio helper",
|
|
495
|
-
placeholder: "Found automatically",
|
|
496
|
-
description: "Full path of sdeck-audio, if it is somewhere unusual.",
|
|
497
|
-
},
|
|
498
|
-
},
|
|
533
|
+
export default plugin.define({
|
|
499
534
|
onboarding: {
|
|
500
535
|
steps: [
|
|
501
536
|
{
|
|
@@ -511,23 +546,9 @@ export default definePlugin({
|
|
|
511
546
|
],
|
|
512
547
|
},
|
|
513
548
|
actions: [volume, slider, defaultDevice],
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
inputs: () => deviceOptions("inputs"),
|
|
517
|
-
apps: async () =>
|
|
518
|
-
(await helper.request("snapshot")).apps.map((a) => ({ value: a.name, label: a.name })),
|
|
519
|
-
},
|
|
520
|
-
state: [
|
|
521
|
-
stateOf("master", "Speakers", "json", "audio.master.volume, .muted, .name"),
|
|
522
|
-
stateOf("mic", "Microphone", "json", "audio.mic.volume, .muted, .name"),
|
|
523
|
-
stateOf("output", "Output device", "string", "The default output's name."),
|
|
524
|
-
stateOf("input", "Input device", "string", "The default input's name."),
|
|
525
|
-
stateOf("outputs", "Output devices", "json", "Every output with its level."),
|
|
526
|
-
stateOf("inputs", "Input devices", "json", "Every input with its level."),
|
|
527
|
-
stateOf("apps", "App volumes", "json", "audio.apps.spotify.volume, .muted, .active"),
|
|
528
|
-
],
|
|
549
|
+
sources: Object.values(sources),
|
|
550
|
+
state: Object.values(values),
|
|
529
551
|
activate(activated) {
|
|
530
|
-
context = activated;
|
|
531
552
|
if (process.platform !== "win32") {
|
|
532
553
|
activated.status("Audio control is available on Windows only", "info");
|
|
533
554
|
} else if (!findHelper() && !activated.settings().helper) {
|
|
@@ -535,7 +556,6 @@ export default definePlugin({
|
|
|
535
556
|
}
|
|
536
557
|
return () => {
|
|
537
558
|
helper.close();
|
|
538
|
-
context = undefined;
|
|
539
559
|
};
|
|
540
560
|
},
|
|
541
561
|
});
|