@domicile-desktop/sdk 1.0.0 → 2.2.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.
@@ -1,10 +1,25 @@
1
1
  {
2
2
  "$defs": {
3
+ "AccelProfile": {
4
+ "description": "How movement speed affects pointer acceleration.",
5
+ "enum": ["adaptive", "flat"],
6
+ "type": "string"
7
+ },
3
8
  "AccentColor": {
4
9
  "description": "An sRGB color, written `\"#rrggbb\"`.",
5
10
  "pattern": "^#[0-9a-fA-F]{6}$",
6
11
  "type": "string"
7
12
  },
13
+ "ButtonMap": {
14
+ "description": "Buttons assigned to one-, two- and three-finger taps.",
15
+ "enum": ["lrm", "lmr"],
16
+ "type": "string"
17
+ },
18
+ "ClickMethod": {
19
+ "description": "How a touchpad's physical button chooses a mouse button.",
20
+ "enum": ["default", "clickfinger", "button_areas"],
21
+ "type": "string"
22
+ },
8
23
  "Contrast": {
9
24
  "description": "How strongly clients set text and edges apart from their background.",
10
25
  "enum": ["normal", "high"],
@@ -23,6 +38,11 @@
23
38
  ],
24
39
  "description": "An XCursor theme's directory name, such as `Adwaita`, for both modes or\nfor each."
25
40
  },
41
+ "DisableWhileTyping": {
42
+ "description": "How typing suppression selects touchpads and handles contacts.",
43
+ "enum": ["enabled", "disabled", "internal", "libinput"],
44
+ "type": "string"
45
+ },
26
46
  "DisplayConfig": {
27
47
  "additionalProperties": false,
28
48
  "description": "One display, described in the config rather than discovered.\n\nA nested compositor has no monitors to enumerate. Each display becomes a\n`wl_output` and a region of the chrome page, which the shell addresses by\n`name`. `position` and `size` are logical units.",
@@ -215,12 +235,42 @@
215
235
  "keyboard": {
216
236
  "$ref": "#/$defs/KeyboardConfig"
217
237
  },
238
+ "mouse": {
239
+ "$ref": "#/$defs/MouseConfig",
240
+ "default": {
241
+ "accel_profile": "adaptive",
242
+ "middle_emulation": false,
243
+ "natural_scroll": false,
244
+ "scroll_factor": 1.0,
245
+ "speed": 0.0
246
+ }
247
+ },
218
248
  "pointers": {
219
249
  "description": "Tablets and touchscreens, each bound to the display it covers.\n\nRead on a tty only, on every hotplug. An unbound one covers no\ndisplay. See `docs/DISPLAYS.md#tablets-and-touchscreens`.",
220
250
  "items": {
221
251
  "$ref": "#/$defs/PointerConfig"
222
252
  },
223
253
  "type": "array"
254
+ },
255
+ "touchpad": {
256
+ "$ref": "#/$defs/TouchpadConfig",
257
+ "default": {
258
+ "accel_profile": "adaptive",
259
+ "click_method": "default",
260
+ "disable_while_typing": "enabled",
261
+ "drag_lock": false,
262
+ "middle_emulation": false,
263
+ "natural_scroll": false,
264
+ "scroll_acceleration": true,
265
+ "scroll_factor": 1.0,
266
+ "scroll_method": "default",
267
+ "speed": 0.0,
268
+ "tap": true,
269
+ "tap_button_map": "lrm",
270
+ "tap_drag": true,
271
+ "typing_pause_ms": 200,
272
+ "typing_repeat_pause_ms": 500
273
+ }
224
274
  }
225
275
  },
226
276
  "type": "object"
@@ -344,6 +394,41 @@
344
394
  },
345
395
  "type": "object"
346
396
  },
397
+ "MouseConfig": {
398
+ "additionalProperties": false,
399
+ "description": "Settings applied to every relative mouse on a tty.",
400
+ "properties": {
401
+ "accel_profile": {
402
+ "$ref": "#/$defs/AccelProfile",
403
+ "default": "adaptive"
404
+ },
405
+ "middle_emulation": {
406
+ "default": false,
407
+ "description": "Emulate a middle click by pressing left and right together.",
408
+ "type": "boolean"
409
+ },
410
+ "natural_scroll": {
411
+ "default": false,
412
+ "description": "Reverse the mouse wheel's scrolling direction.",
413
+ "type": "boolean"
414
+ },
415
+ "scroll_factor": {
416
+ "default": 1.0,
417
+ "description": "Multiplier applied once to both scrolling axes; must be positive.",
418
+ "exclusiveMinimum": 0.0,
419
+ "type": "number"
420
+ },
421
+ "speed": {
422
+ "default": 0.0,
423
+ "description": "Pointer acceleration speed, from -1 to 1.",
424
+ "format": "double",
425
+ "maximum": 1.0,
426
+ "minimum": -1.0,
427
+ "type": "number"
428
+ }
429
+ },
430
+ "type": "object"
431
+ },
347
432
  "OutputConfig": {
348
433
  "additionalProperties": false,
349
434
  "description": "Output settings.",
@@ -421,6 +506,11 @@
421
506
  "required": ["name", "displays"],
422
507
  "type": "object"
423
508
  },
509
+ "ScrollMethod": {
510
+ "description": "How a touchpad generates scrolling.",
511
+ "enum": ["default", "two_finger", "edge", "on_button_down"],
512
+ "type": "string"
513
+ },
424
514
  "StartupConfig": {
425
515
  "additionalProperties": false,
426
516
  "description": "The commands a desk starts with.\n\nRun once, when the compositor starts. A reload does not rerun them, which\nwould start duplicates, or stop them, which would kill programs in use.",
@@ -457,6 +547,18 @@
457
547
  "contrast": {
458
548
  "$ref": "#/$defs/Contrast"
459
549
  },
550
+ "cursor_hide_after_ms": {
551
+ "default": null,
552
+ "description": "Hides the engine's pointer after this many milliseconds without\npointer input. Unset never hides it. Zero is refused.",
553
+ "format": "uint32",
554
+ "minimum": 0,
555
+ "type": ["integer", "null"]
556
+ },
557
+ "cursor_hide_when_typing": {
558
+ "default": false,
559
+ "description": "Hides the engine's pointer on a typing key press, until the pointer is\nnext used.",
560
+ "type": "boolean"
561
+ },
460
562
  "cursor_size": {
461
563
  "default": null,
462
564
  "description": "The cursor size in logical pixels, for clients and the engine's\npointer. Unset leaves clients their own. Zero is refused.",
@@ -525,6 +627,97 @@
525
627
  }
526
628
  ]
527
629
  },
630
+ "TouchpadConfig": {
631
+ "additionalProperties": false,
632
+ "description": "Settings applied to every touchpad on a tty, including newly attached ones.",
633
+ "properties": {
634
+ "accel_profile": {
635
+ "$ref": "#/$defs/AccelProfile",
636
+ "default": "adaptive"
637
+ },
638
+ "click_method": {
639
+ "$ref": "#/$defs/ClickMethod",
640
+ "default": "default",
641
+ "description": "Physical click behavior; `default` uses the device's libinput default.\nClickfinger uses left, right and middle for one, two and three fingers."
642
+ },
643
+ "disable_while_typing": {
644
+ "$ref": "#/$defs/DisableWhileTyping",
645
+ "default": "enabled",
646
+ "description": "Typing suppression policy; `libinput` preserves native keyboard pairing and contacts.\nCustom `internal` excludes external pads; `enabled` includes every touchpad."
647
+ },
648
+ "drag_lock": {
649
+ "default": false,
650
+ "description": "Keep a tap drag held when the fingers lift briefly.",
651
+ "type": "boolean"
652
+ },
653
+ "middle_emulation": {
654
+ "default": false,
655
+ "description": "Emulate a middle click by pressing left and right together.",
656
+ "type": "boolean"
657
+ },
658
+ "natural_scroll": {
659
+ "default": false,
660
+ "description": "Move content in the direction the fingers move.",
661
+ "type": "boolean"
662
+ },
663
+ "scroll_acceleration": {
664
+ "default": true,
665
+ "description": "Increase page scroll distance with gesture speed, up to four times.",
666
+ "type": "boolean"
667
+ },
668
+ "scroll_factor": {
669
+ "default": 1.0,
670
+ "description": "Multiplier applied once to both scrolling axes; must be positive.",
671
+ "exclusiveMinimum": 0.0,
672
+ "type": "number"
673
+ },
674
+ "scroll_method": {
675
+ "$ref": "#/$defs/ScrollMethod",
676
+ "default": "default",
677
+ "description": "Scrolling gesture; `default` uses the device's libinput default."
678
+ },
679
+ "speed": {
680
+ "default": 0.0,
681
+ "description": "Pointer acceleration speed, from -1 to 1.",
682
+ "format": "double",
683
+ "maximum": 1.0,
684
+ "minimum": -1.0,
685
+ "type": "number"
686
+ },
687
+ "tap": {
688
+ "default": true,
689
+ "description": "Tap to click.",
690
+ "type": "boolean"
691
+ },
692
+ "tap_button_map": {
693
+ "$ref": "#/$defs/ButtonMap",
694
+ "default": "lrm",
695
+ "description": "Buttons for one-, two- and three-finger taps."
696
+ },
697
+ "tap_drag": {
698
+ "default": true,
699
+ "description": "Drag by tapping, then holding a second tap.",
700
+ "type": "boolean"
701
+ },
702
+ "typing_pause_ms": {
703
+ "default": 200,
704
+ "description": "Custom pause after one typing key; zero means no pause.\nNative `libinput` mode requires the default 200 and uses its own timers.",
705
+ "format": "uint32",
706
+ "maximum": 2147483647,
707
+ "minimum": 0,
708
+ "type": "integer"
709
+ },
710
+ "typing_repeat_pause_ms": {
711
+ "default": 500,
712
+ "description": "Custom pause during continued typing; zero means no pause.\nNative `libinput` mode requires the default 500 and uses its own timers.",
713
+ "format": "uint32",
714
+ "maximum": 2147483647,
715
+ "minimum": 0,
716
+ "type": "integer"
717
+ }
718
+ },
719
+ "type": "object"
720
+ },
528
721
  "Transform": {
529
722
  "description": "Which way up a monitor is, named for the matching `wl_output.transform`.\n\nRotations only; nothing needs flips.",
530
723
  "oneOf": [
@@ -1,3 +1,4 @@
1
+ import type { Gestures } from "./desktop/gestures";
1
2
  import type { Keyboard } from "./desktop/keyboard";
2
3
  import type { ShellNamespace } from "./desktop/shell";
3
4
  import type { ShellKeybindings } from "./own-keybindings";
@@ -18,11 +19,12 @@ export type KeyHandlers = {
18
19
  export type KeyBinding = {
19
20
  /** Switch to binding mode `name`; see {@link bindKeys}. */
20
21
  setMode: (name: string) => void;
21
- /** Stop handling keys, and give back every chord grabbed. */
22
+ /** Stop handling keys, and give back every chord and gesture grabbed. */
22
23
  unbind: () => void;
23
24
  };
24
25
  /** The part of the desktop that `bindKeys` uses. */
25
26
  export type KeyDesktop = {
27
+ readonly gestures: Pick<Gestures, "grab" | "on" | "ungrab">;
26
28
  readonly keyboard: Pick<Keyboard, "grab" | "on" | "ungrab">;
27
29
  readonly shell: Pick<ShellNamespace, "commands">;
28
30
  };
@@ -31,10 +33,13 @@ export type KeyDesktop = {
31
33
  *
32
34
  * - Every chord in every mode is grabbed once, until `unbind`. A key bound in
33
35
  * any mode is grabbed from all clients while bound.
36
+ * - So is every gesture's kind and count: `swipe:3:left` grabs every
37
+ * three-finger swipe, whichever way it goes. An edge swipe's side is
38
+ * grabbed: `edge:left` withholds only fingers landing at the left edge.
34
39
  * - `setMode` syncs the mode across pages without calling `onModeChanged`. An
35
40
  * unknown mode falls back to `default` and is reported.
36
41
  *
37
- * @throws for an invalid chord (see `ownKeybindings`), before anything is
42
+ * @throws for an invalid chord or gesture (see `ownKeybindings`), before anything is
38
43
  * grabbed. A keysym the layout cannot type is logged, so the other keys
39
44
  * still work.
40
45
  */
package/dist/bind-keys.js CHANGED
@@ -4,10 +4,17 @@
4
4
  // every press, from a `<webview>` or the page, as a `shortcut` event carrying
5
5
  // the chord.
6
6
  //
7
+ // Touchpad gestures (`swipe:3:left`) and touchscreen edge swipes
8
+ // (`edge:left`) bind beside chords and share their modes. `grabGesture`
9
+ // takes each kind and count, or edge; the engine sends every
10
+ // phase as a `gesture` event, and a binding runs once its gesture ends going
11
+ // its way. See docs/architecture/GESTURES.md.
12
+ //
7
13
  // Binding modes are tracked here; the engine does not know about them. A
8
14
  // command typed as `domicile send-shell` arrives as a shell command system
9
15
  // event and runs as its `SendShell` binding would. See
10
16
  // docs/architecture/KEYBINDINGS.md.
17
+ import { bestGesture, gestureTracker, grabOf, isGesture, parseGesture, } from "./gesture-binding";
11
18
  import { KeyActionKind } from "./key-action";
12
19
  import { ownKeybindings } from "./own-keybindings";
13
20
  /** The initial binding mode. */
@@ -17,10 +24,13 @@ const DEFAULT_MODE = "default";
17
24
  *
18
25
  * - Every chord in every mode is grabbed once, until `unbind`. A key bound in
19
26
  * any mode is grabbed from all clients while bound.
27
+ * - So is every gesture's kind and count: `swipe:3:left` grabs every
28
+ * three-finger swipe, whichever way it goes. An edge swipe's side is
29
+ * grabbed: `edge:left` withholds only fingers landing at the left edge.
20
30
  * - `setMode` syncs the mode across pages without calling `onModeChanged`. An
21
31
  * unknown mode falls back to `default` and is reported.
22
32
  *
23
- * @throws for an invalid chord (see `ownKeybindings`), before anything is
33
+ * @throws for an invalid chord or gesture (see `ownKeybindings`), before anything is
24
34
  * grabbed. A keysym the layout cannot type is logged, so the other keys
25
35
  * still work.
26
36
  */
@@ -33,8 +43,7 @@ export const bindKeys = (domicile, own, { onCommand, onModeChanged, report = rep
33
43
  onModeChanged(next);
34
44
  }
35
45
  };
36
- const onShortcut = ({ chord }) => {
37
- const action = bindings.get(mode)?.get(chord);
46
+ const run = (action) => {
38
47
  switch (action?.kind) {
39
48
  case KeyActionKind.SendShell: {
40
49
  onCommand(action.args);
@@ -49,8 +58,27 @@ export const bindKeys = (domicile, own, { onCommand, onModeChanged, report = rep
49
58
  }
50
59
  }
51
60
  };
52
- const grabbed = grabEach(domicile.keyboard, new Set([...bindings.values()].flatMap((byChord) => [...byChord.keys()])));
53
- const stopShortcuts = domicile.keyboard.on("shortcut", onShortcut);
61
+ const gesturesByMode = new Map([...bindings].map(([name, byName]) => [
62
+ name,
63
+ [...byName]
64
+ .filter(([written]) => isGesture(written))
65
+ .map(([written, action]) => [parseGesture(written), action]),
66
+ ]));
67
+ const onGesture = (finished) => {
68
+ if (finished !== undefined) {
69
+ run(bestGesture(gesturesByMode.get(mode) ?? [], finished));
70
+ }
71
+ };
72
+ const names = new Set([...bindings.values()].flatMap((byName) => [...byName.keys()]));
73
+ const grabbed = grabEach(domicile.keyboard, [...names].filter((name) => !isGesture(name)));
74
+ const grabbedGestures = grabEach(domicile.gestures, new Set([...gesturesByMode.values()].flatMap((byGesture) => byGesture.map(([gesture]) => grabOf(gesture)))));
75
+ const stopShortcuts = domicile.keyboard.on("shortcut", ({ chord }) => {
76
+ run(bindings.get(mode)?.get(chord));
77
+ });
78
+ const tracker = gestureTracker();
79
+ const stopGestures = domicile.gestures.on("gesture", (gesture) => {
80
+ onGesture(tracker.feed(gesture));
81
+ });
54
82
  const commands = hearCommands(domicile.shell, onCommand, report);
55
83
  return {
56
84
  setMode: (name) => {
@@ -63,21 +91,25 @@ export const bindKeys = (domicile, own, { onCommand, onModeChanged, report = rep
63
91
  },
64
92
  unbind: () => {
65
93
  stopShortcuts();
94
+ stopGestures();
66
95
  commands.stop();
67
96
  // Emptied, so a second unbind does not answer somebody else's grab.
68
97
  for (const chord of grabbed.splice(0)) {
69
98
  domicile.keyboard.ungrab(chord);
70
99
  }
100
+ for (const gesture of grabbedGestures.splice(0)) {
101
+ domicile.gestures.ungrab(gesture);
102
+ }
71
103
  },
72
104
  };
73
105
  };
74
106
  /**
75
- * Grab each of `chords`, and return those the engine took. A keysym the
76
- * layout cannot type is logged.
107
+ * Grab each of `names`, and return those the engine took. One it refuses,
108
+ * such as a keysym the layout cannot type, is logged.
77
109
  */
78
- const grabEach = (keyboard, chords) => [...chords].filter((chord) => {
110
+ const grabEach = (grabber, names) => [...names].filter((name) => {
79
111
  try {
80
- keyboard.grab(chord);
112
+ grabber.grab(name);
81
113
  return true;
82
114
  }
83
115
  catch (error) {
package/dist/config.d.ts CHANGED
@@ -23,8 +23,14 @@ export type Config = {
23
23
  startup?: StartupConfig;
24
24
  theme?: ThemeConfig;
25
25
  };
26
+ /** How movement speed affects pointer acceleration. */
27
+ export type AccelProfile = "adaptive" | "flat";
26
28
  /** An sRGB color, written `"#rrggbb"`. */
27
29
  export type AccentColor = string;
30
+ /** Buttons assigned to one-, two- and three-finger taps. */
31
+ export type ButtonMap = "lrm" | "lmr";
32
+ /** How a touchpad's physical button chooses a mouse button. */
33
+ export type ClickMethod = "default" | "clickfinger" | "button_areas";
28
34
  /** How strongly clients set text and edges apart from their background. */
29
35
  export type Contrast = "normal" | "high";
30
36
  /**
@@ -32,6 +38,8 @@ export type Contrast = "normal" | "high";
32
38
  * for each.
33
39
  */
34
40
  export type CursorThemeName = string | PerModeCursorThemes;
41
+ /** How typing suppression selects touchpads and handles contacts. */
42
+ export type DisableWhileTyping = "enabled" | "disabled" | "internal" | "libinput";
35
43
  /**
36
44
  * One display, described in the config rather than discovered.
37
45
  *
@@ -187,6 +195,7 @@ export type IdleConfig = {
187
195
  /** Input-device settings. */
188
196
  export type InputConfig = {
189
197
  keyboard?: KeyboardConfig;
198
+ mouse?: MouseConfig;
190
199
  /**
191
200
  * Tablets and touchscreens, each bound to the display it covers.
192
201
  *
@@ -194,6 +203,7 @@ export type InputConfig = {
194
203
  * display. See `docs/DISPLAYS.md#tablets-and-touchscreens`.
195
204
  */
196
205
  pointers?: PointerConfig[];
206
+ touchpad?: TouchpadConfig;
197
207
  };
198
208
  /**
199
209
  * Keyboard settings, named after SwayWM's `xkb_*` options.
@@ -269,6 +279,18 @@ export type LockdownConfig = {
269
279
  disable_save_to_disk?: boolean;
270
280
  disable_sound_output?: boolean;
271
281
  };
282
+ /** Settings applied to every relative mouse on a tty. */
283
+ export type MouseConfig = {
284
+ accel_profile?: AccelProfile;
285
+ /** Emulate a middle click by pressing left and right together. */
286
+ middle_emulation?: boolean;
287
+ /** Reverse the mouse wheel's scrolling direction. */
288
+ natural_scroll?: boolean;
289
+ /** Multiplier applied once to both scrolling axes; must be positive. */
290
+ scroll_factor?: number;
291
+ /** Pointer acceleration speed, from -1 to 1. */
292
+ speed?: number;
293
+ };
272
294
  /** Output settings. */
273
295
  export type OutputConfig = {
274
296
  /**
@@ -324,6 +346,8 @@ export type Profile = {
324
346
  */
325
347
  name: string;
326
348
  };
349
+ /** How a touchpad generates scrolling. */
350
+ export type ScrollMethod = "default" | "two_finger" | "edge" | "on_button_down";
327
351
  /**
328
352
  * The commands a desk starts with.
329
353
  *
@@ -347,6 +371,16 @@ export type ThemeConfig = {
347
371
  /** The color clients highlight with, or their own when unset. */
348
372
  accent_color?: AccentColor | null;
349
373
  contrast?: Contrast;
374
+ /**
375
+ * Hides the engine's pointer after this many milliseconds without
376
+ * pointer input. Unset never hides it. Zero is refused.
377
+ */
378
+ cursor_hide_after_ms?: number | null;
379
+ /**
380
+ * Hides the engine's pointer on a typing key press, until the pointer is
381
+ * next used.
382
+ */
383
+ cursor_hide_when_typing?: boolean;
350
384
  /**
351
385
  * The cursor size in logical pixels, for clients and the engine's
352
386
  * pointer. Unset leaves clients their own. Zero is refused.
@@ -390,6 +424,50 @@ export type ThemeConfig = {
390
424
  * portal; see the compositor's `portals::settings`.
391
425
  */
392
426
  export type ThemeMode = "dark" | "light";
427
+ /** Settings applied to every touchpad on a tty, including newly attached ones. */
428
+ export type TouchpadConfig = {
429
+ accel_profile?: AccelProfile;
430
+ /**
431
+ * Physical click behavior; `default` uses the device's libinput default.
432
+ * Clickfinger uses left, right and middle for one, two and three fingers.
433
+ */
434
+ click_method?: ClickMethod;
435
+ /**
436
+ * Typing suppression policy; `libinput` preserves native keyboard pairing and contacts.
437
+ * Custom `internal` excludes external pads; `enabled` includes every touchpad.
438
+ */
439
+ disable_while_typing?: DisableWhileTyping;
440
+ /** Keep a tap drag held when the fingers lift briefly. */
441
+ drag_lock?: boolean;
442
+ /** Emulate a middle click by pressing left and right together. */
443
+ middle_emulation?: boolean;
444
+ /** Move content in the direction the fingers move. */
445
+ natural_scroll?: boolean;
446
+ /** Increase page scroll distance with gesture speed, up to four times. */
447
+ scroll_acceleration?: boolean;
448
+ /** Multiplier applied once to both scrolling axes; must be positive. */
449
+ scroll_factor?: number;
450
+ /** Scrolling gesture; `default` uses the device's libinput default. */
451
+ scroll_method?: ScrollMethod;
452
+ /** Pointer acceleration speed, from -1 to 1. */
453
+ speed?: number;
454
+ /** Tap to click. */
455
+ tap?: boolean;
456
+ /** Buttons for one-, two- and three-finger taps. */
457
+ tap_button_map?: ButtonMap;
458
+ /** Drag by tapping, then holding a second tap. */
459
+ tap_drag?: boolean;
460
+ /**
461
+ * Custom pause after one typing key; zero means no pause.
462
+ * Native `libinput` mode requires the default 200 and uses its own timers.
463
+ */
464
+ typing_pause_ms?: number;
465
+ /**
466
+ * Custom pause during continued typing; zero means no pause.
467
+ * Native `libinput` mode requires the default 500 and uses its own timers.
468
+ */
469
+ typing_repeat_pause_ms?: number;
470
+ };
393
471
  /**
394
472
  * Which way up a monitor is, named for the matching `wl_output.transform`.
395
473
  *
@@ -8,6 +8,7 @@ import type { Displays } from "./displays";
8
8
  import type { Downloads } from "./downloads";
9
9
  import type { Extensions } from "./extensions";
10
10
  import type { Files } from "./files";
11
+ import type { Gestures } from "./gestures";
11
12
  import type { GoogleCast } from "./google-cast";
12
13
  import type { Keyboard } from "./keyboard";
13
14
  import type { Notifications } from "./notifications";
@@ -41,6 +42,7 @@ export type Domicile = {
41
42
  readonly downloads: Downloads;
42
43
  readonly extensions: Extensions;
43
44
  readonly files: Files;
45
+ readonly gestures: Gestures;
44
46
  readonly googleCast: GoogleCast;
45
47
  readonly keyboard: Keyboard;
46
48
  readonly notifications: Notifications;
@@ -9,6 +9,7 @@ import { displays } from "./displays";
9
9
  import { downloads } from "./downloads";
10
10
  import { extensions } from "./extensions";
11
11
  import { files } from "./files";
12
+ import { gestures } from "./gestures";
12
13
  import { googleCast } from "./google-cast";
13
14
  import { keyboard } from "./keyboard";
14
15
  import { notifications } from "./notifications";
@@ -49,6 +50,7 @@ const build = (host) => {
49
50
  downloads: downloads(host),
50
51
  extensions: extensions(host),
51
52
  files: files(host, calls),
53
+ gestures: gestures(host),
52
54
  googleCast: googleCast(host),
53
55
  keyboard: keyboard(host, calls),
54
56
  notifications: notifications(host),
@@ -24,9 +24,12 @@ export type Displays = {
24
24
  */
25
25
  addVirtual: System["addVirtualMonitor"];
26
26
  /**
27
- * Draw every monitor as if its white were a light of `kelvin` (1000 to
28
- * 6500), as a night light does; 6500 draws colors as they are. Allowed while
29
- * the desktop is locked. Changes nothing on a nested desktop.
27
+ * Draw `display` (a {@link Display.name}), or every monitor when it is
28
+ * left out, as if its white were a light of `kelvin` (1000 to 6500), as a
29
+ * night light does; 6500 draws colors as they are. Every monitor's replaces
30
+ * each one's. Allowed while the desktop is locked. Changes nothing on a
31
+ * nested desktop, nor on a monitor a night-light app such as gammastep
32
+ * holds.
30
33
  */
31
34
  setColorTemperature: System["setColorTemperature"];
32
35
  on: On<DisplaysListeners>;
@@ -12,7 +12,7 @@ export const displays = (host, calls) => {
12
12
  on: on({
13
13
  change: (listener) => hostEvent(host, "displayschanged", () => listener()),
14
14
  }),
15
- setColorTemperature: (kelvin) => calls.setColorTemperature(kelvin),
15
+ setColorTemperature: (kelvin, display) => calls.setColorTemperature(kelvin, display),
16
16
  };
17
17
  };
18
18
  const displayOf = (display) => ({
@@ -0,0 +1,46 @@
1
+ import type { DomicileHost } from "../domicile-host";
2
+ import type { On } from "./subscribe";
3
+ export type GestureKind = "edge" | "hold" | "pinch" | "swipe";
4
+ /** The side of the display an edge swipe came in from. */
5
+ export type GestureEdge = "bottom" | "left" | "right" | "top";
6
+ export type GesturePhase = "begin" | "end" | "update";
7
+ /** A phase of a grabbed gesture. */
8
+ export type Gesture = {
9
+ kind: GestureKind;
10
+ phase: GesturePhase;
11
+ fingers: number;
12
+ /**
13
+ * This update's motion, in the touchpad's accelerated pointer units, or an
14
+ * edge swipe's in the display's pixels.
15
+ */
16
+ dx: number;
17
+ dy: number;
18
+ /** A pinch's scale relative to its begin. */
19
+ scale: number;
20
+ /** This update's rotation, in degrees clockwise. */
21
+ rotation: number;
22
+ /** On an end: the gesture was abandoned rather than finished. */
23
+ canceled: boolean;
24
+ /** An edge swipe's side; `undefined` for every other kind. */
25
+ edge: GestureEdge | undefined;
26
+ };
27
+ export type GesturesListeners = {
28
+ /** A phase of a grabbed gesture, wherever the pointer is. */
29
+ gesture: (gesture: Gesture) => void;
30
+ };
31
+ export type Gestures = {
32
+ /**
33
+ * Route `gesture`, written `swipe`, `pinch` or `hold` with an optional
34
+ * finger count such as `swipe:3`, to the page rather than to the window
35
+ * under the pointer. A count left out is any of three or more. Or a
36
+ * touchscreen finger in from a display's edge: `edge:left`, `right`, `top`
37
+ * or `bottom`, or `edge` for any. Throws a SyntaxError for a gesture
38
+ * written wrong or of fewer than three fingers.
39
+ */
40
+ grab: (gesture: string) => void;
41
+ /** Answer one {@link Gestures.grab}; the last gives the gesture back. */
42
+ ungrab: (gesture: string) => void;
43
+ on: On<GesturesListeners>;
44
+ };
45
+ export type GesturesHost = Pick<DomicileHost, "addEventListener" | "grabGesture" | "removeEventListener" | "ungrabGesture">;
46
+ export declare const gestures: (host: GesturesHost) => Gestures;