@domicile-desktop/sdk 0.0.0-alpha-e2b4bc54df6c → 0.0.0-alpha-e821d1f6e4b2

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.
@@ -101,6 +101,11 @@
101
101
  "additionalProperties": false,
102
102
  "description": "One display of a profile: which monitor, and what to do with it.\n\nEvery field but `display` defaults to leaving the monitor as it is.",
103
103
  "properties": {
104
+ "adaptive_sync": {
105
+ "default": false,
106
+ "description": "Whether to scan out with a variable refresh rate (adaptive sync,\nFreeSync, G-Sync Compatible), so a frame that runs late is shown as\nsoon as it is ready instead of at the next fixed refresh.\n\nOff by default. Asked for only where the monitor, its connector and\nits driver report they can; a driver that refuses it gets the same\nmode without it. Each display reports whether it took.",
107
+ "type": "boolean"
108
+ },
104
109
  "display": {
105
110
  "description": "The connected display this entry places, matched by exact name.\n\nOn a tty the output name is `drm-<id>`, or the connector (`HDMI-A-1`)\nfor a monitor with no EDID name. Ozone derives the id from the EDID, so\nit survives a replug. A panel name also matches.",
106
111
  "type": "string"
package/dist/config.d.ts CHANGED
@@ -78,6 +78,16 @@ export type DisplayConfig = {
78
78
  * Every field but `display` defaults to leaving the monitor as it is.
79
79
  */
80
80
  export type DisplayPlacement = {
81
+ /**
82
+ * Whether to scan out with a variable refresh rate (adaptive sync,
83
+ * FreeSync, G-Sync Compatible), so a frame that runs late is shown as
84
+ * soon as it is ready instead of at the next fixed refresh.
85
+ *
86
+ * Off by default. Asked for only where the monitor, its connector and
87
+ * its driver report they can; a driver that refuses it gets the same
88
+ * mode without it. Each display reports whether it took.
89
+ */
90
+ adaptive_sync?: boolean;
81
91
  /**
82
92
  * The connected display this entry places, matched by exact name.
83
93
  *
@@ -2,8 +2,16 @@ import type { DisplayTransform } from "../display-transform";
2
2
  import type { DomicileDisplay, DomicileHost } from "../domicile-host";
3
3
  import type { On } from "./subscribe";
4
4
  import type { System } from "./system-calls";
5
+ /**
6
+ * Whether a screen scans out with a variable refresh rate. `unsupported` when
7
+ * its panel, connector or driver cannot, or when Domicile runs in a window.
8
+ * `off` when it can and its display profile does not ask for it, or the
9
+ * driver refused it.
10
+ */
11
+ export type AdaptiveSync = "unsupported" | "off" | "on";
5
12
  /** One screen. Sizes are whole CSS pixels; see `DomicileDisplay`. */
6
- export type Display = Omit<DomicileDisplay, "transform"> & {
13
+ export type Display = Omit<DomicileDisplay, "adaptiveSync" | "transform"> & {
14
+ readonly adaptiveSync: AdaptiveSync;
7
15
  readonly transform: DisplayTransform;
8
16
  };
9
17
  export type DisplaysListeners = {
@@ -2,6 +2,10 @@
2
2
  import { asDisplayTransform } from "../display-transform";
3
3
  import { memoizeLast } from "./memoize-last";
4
4
  import { hostEvent, on } from "./subscribe";
5
+ // A state this SDK has no name for asks nothing of a shell.
6
+ const asAdaptiveSync = (adaptiveSync) => adaptiveSync === "off" || adaptiveSync === "on"
7
+ ? adaptiveSync
8
+ : "unsupported";
5
9
  export const displays = (host, calls) => {
6
10
  const listOf = memoizeLast((list) => list?.map(displayOf));
7
11
  return {
@@ -16,6 +20,7 @@ export const displays = (host, calls) => {
16
20
  };
17
21
  };
18
22
  const displayOf = (display) => ({
23
+ adaptiveSync: asAdaptiveSync(display.adaptiveSync),
19
24
  height: display.height,
20
25
  modeHeight: display.modeHeight,
21
26
  modeWidth: display.modeWidth,
@@ -12,7 +12,7 @@ import { wireKeymapChoice } from "../keymap-choice";
12
12
  import { PreviewedWindowKind } from "../previewed-window";
13
13
  import { Bus, FileType, Listened, ScreenshotKept, Signal, SystemErrorKind, UnlockRefusal, } from "../system";
14
14
  import { parseSystemMessage } from "../system-message";
15
- import { WindowRequest, wireWindowState } from "../window-state";
15
+ import { ResizeEdge, WindowRequest, wireWindowState } from "../window-state";
16
16
  /** The system calls through `host`. Any number may share one host. */
17
17
  export const system = (host) => {
18
18
  const calls = callsOn(host);
@@ -458,6 +458,30 @@ const windowRequest = (appId, request) => {
458
458
  return WindowRequest.Unfullscreen(appId);
459
459
  case "minimize":
460
460
  return WindowRequest.Minimize(appId);
461
+ case "move":
462
+ return WindowRequest.Move(appId);
463
+ case "resize":
464
+ return WindowRequest.Resize(appId, resizeEdgeOf(request.edges));
465
+ }
466
+ };
467
+ const resizeEdgeOf = (edges) => {
468
+ switch (edges) {
469
+ case "top":
470
+ return ResizeEdge.Top;
471
+ case "bottom":
472
+ return ResizeEdge.Bottom;
473
+ case "left":
474
+ return ResizeEdge.Left;
475
+ case "right":
476
+ return ResizeEdge.Right;
477
+ case "top_left":
478
+ return ResizeEdge.TopLeft;
479
+ case "top_right":
480
+ return ResizeEdge.TopRight;
481
+ case "bottom_left":
482
+ return ResizeEdge.BottomLeft;
483
+ case "bottom_right":
484
+ return ResizeEdge.BottomRight;
461
485
  }
462
486
  };
463
487
  const unexpected = (answer) => {
@@ -301,6 +301,12 @@ export type DomicileDisplay = {
301
301
  * window.
302
302
  */
303
303
  readonly refreshMhz: number;
304
+ /**
305
+ * Whether the panel scans out with a variable refresh rate: `unsupported`
306
+ * (the panel, its connector or its driver cannot, or Domicile runs in a
307
+ * window), `off` or `on`. A DOMString for the reason `transform` is.
308
+ */
309
+ readonly adaptiveSync: string;
304
310
  /**
305
311
  * The monitor's rotation: `normal`, `rotate-90`, `rotate-180` or
306
312
  * `rotate-270`, as the config file spells them.
@@ -126,6 +126,20 @@ declare const systemEventSchema: z.ZodObject<{
126
126
  kind: z.ZodLiteral<"unfullscreen">;
127
127
  }, z.core.$loose>, z.ZodObject<{
128
128
  kind: z.ZodLiteral<"minimize">;
129
+ }, z.core.$loose>, z.ZodObject<{
130
+ kind: z.ZodLiteral<"move">;
131
+ }, z.core.$loose>, z.ZodObject<{
132
+ edges: z.ZodEnum<{
133
+ bottom: "bottom";
134
+ bottom_left: "bottom_left";
135
+ bottom_right: "bottom_right";
136
+ left: "left";
137
+ right: "right";
138
+ top: "top";
139
+ top_left: "top_left";
140
+ top_right: "top_right";
141
+ }>;
142
+ kind: z.ZodLiteral<"resize">;
129
143
  }, z.core.$loose>], "kind">;
130
144
  }, z.core.$loose>, z.ZodObject<{
131
145
  active: z.ZodString;
@@ -293,6 +307,20 @@ declare const systemMessageSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
293
307
  kind: z.ZodLiteral<"unfullscreen">;
294
308
  }, z.core.$loose>, z.ZodObject<{
295
309
  kind: z.ZodLiteral<"minimize">;
310
+ }, z.core.$loose>, z.ZodObject<{
311
+ kind: z.ZodLiteral<"move">;
312
+ }, z.core.$loose>, z.ZodObject<{
313
+ edges: z.ZodEnum<{
314
+ bottom: "bottom";
315
+ bottom_left: "bottom_left";
316
+ bottom_right: "bottom_right";
317
+ left: "left";
318
+ right: "right";
319
+ top: "top";
320
+ top_left: "top_left";
321
+ top_right: "top_right";
322
+ }>;
323
+ kind: z.ZodLiteral<"resize">;
296
324
  }, z.core.$loose>], "kind">;
297
325
  }, z.core.$loose>, z.ZodObject<{
298
326
  active: z.ZodString;
@@ -110,6 +110,20 @@ const systemEventSchema = z.looseObject({
110
110
  }),
111
111
  z.looseObject({ kind: z.literal("unfullscreen") }),
112
112
  z.looseObject({ kind: z.literal("minimize") }),
113
+ z.looseObject({ kind: z.literal("move") }),
114
+ z.looseObject({
115
+ edges: z.enum([
116
+ "top",
117
+ "bottom",
118
+ "left",
119
+ "right",
120
+ "top_left",
121
+ "top_right",
122
+ "bottom_left",
123
+ "bottom_right",
124
+ ]),
125
+ kind: z.literal("resize"),
126
+ }),
113
127
  ]),
114
128
  }),
115
129
  z.looseObject({
@@ -19,7 +19,22 @@ export declare enum WindowRequestKind {
19
19
  Unmaximize = 1,
20
20
  Fullscreen = 2,
21
21
  Unfullscreen = 3,
22
- Minimize = 4
22
+ Minimize = 4,
23
+ /** The client's title bar was pressed; the drag is the shell's to run. */
24
+ Move = 5,
25
+ /** The client's resize border was pressed; the drag is the shell's to run. */
26
+ Resize = 6
27
+ }
28
+ /** The edges a client's resize drag pulls. */
29
+ export declare enum ResizeEdge {
30
+ Top = 0,
31
+ Bottom = 1,
32
+ Left = 2,
33
+ Right = 3,
34
+ TopLeft = 4,
35
+ TopRight = 5,
36
+ BottomLeft = 6,
37
+ BottomRight = 7
23
38
  }
24
39
  /**
25
40
  * What a client asked of window `appId`. The compositor grants nothing; the
@@ -41,6 +56,20 @@ export declare const WindowRequest: {
41
56
  appId: string;
42
57
  kind: WindowRequestKind.Minimize;
43
58
  };
59
+ /**
60
+ * The button is still down and the client no longer sees the pointer, so
61
+ * the shell drags the window until it comes up, or the press is lost.
62
+ */
63
+ Move: (appId: string) => {
64
+ appId: string;
65
+ kind: WindowRequestKind.Move;
66
+ };
67
+ /** As `Move`, resizing from `edges`. */
68
+ Resize: (appId: string, edges: ResizeEdge) => {
69
+ appId: string;
70
+ edges: ResizeEdge;
71
+ kind: WindowRequestKind.Resize;
72
+ };
44
73
  Unfullscreen: (appId: string) => {
45
74
  appId: string;
46
75
  kind: WindowRequestKind.Unfullscreen;
@@ -25,7 +25,23 @@ export var WindowRequestKind;
25
25
  WindowRequestKind[WindowRequestKind["Fullscreen"] = 2] = "Fullscreen";
26
26
  WindowRequestKind[WindowRequestKind["Unfullscreen"] = 3] = "Unfullscreen";
27
27
  WindowRequestKind[WindowRequestKind["Minimize"] = 4] = "Minimize";
28
+ /** The client's title bar was pressed; the drag is the shell's to run. */
29
+ WindowRequestKind[WindowRequestKind["Move"] = 5] = "Move";
30
+ /** The client's resize border was pressed; the drag is the shell's to run. */
31
+ WindowRequestKind[WindowRequestKind["Resize"] = 6] = "Resize";
28
32
  })(WindowRequestKind || (WindowRequestKind = {}));
33
+ /** The edges a client's resize drag pulls. */
34
+ export var ResizeEdge;
35
+ (function (ResizeEdge) {
36
+ ResizeEdge[ResizeEdge["Top"] = 0] = "Top";
37
+ ResizeEdge[ResizeEdge["Bottom"] = 1] = "Bottom";
38
+ ResizeEdge[ResizeEdge["Left"] = 2] = "Left";
39
+ ResizeEdge[ResizeEdge["Right"] = 3] = "Right";
40
+ ResizeEdge[ResizeEdge["TopLeft"] = 4] = "TopLeft";
41
+ ResizeEdge[ResizeEdge["TopRight"] = 5] = "TopRight";
42
+ ResizeEdge[ResizeEdge["BottomLeft"] = 6] = "BottomLeft";
43
+ ResizeEdge[ResizeEdge["BottomRight"] = 7] = "BottomRight";
44
+ })(ResizeEdge || (ResizeEdge = {}));
29
45
  /**
30
46
  * What a client asked of window `appId`. The compositor grants nothing; the
31
47
  * shell does with `setWindowStates`.
@@ -46,6 +62,20 @@ export const WindowRequest = {
46
62
  appId,
47
63
  kind: WindowRequestKind.Minimize,
48
64
  }),
65
+ /**
66
+ * The button is still down and the client no longer sees the pointer, so
67
+ * the shell drags the window until it comes up, or the press is lost.
68
+ */
69
+ Move: (appId) => ({
70
+ appId,
71
+ kind: WindowRequestKind.Move,
72
+ }),
73
+ /** As `Move`, resizing from `edges`. */
74
+ Resize: (appId, edges) => ({
75
+ appId,
76
+ edges,
77
+ kind: WindowRequestKind.Resize,
78
+ }),
49
79
  Unfullscreen: (appId) => ({
50
80
  appId,
51
81
  kind: WindowRequestKind.Unfullscreen,
package/package.json CHANGED
@@ -245,7 +245,7 @@
245
245
  "test:unit": "bun test"
246
246
  },
247
247
  "type": "module",
248
- "version": "0.0.0-alpha-e2b4bc54df6c",
248
+ "version": "0.0.0-alpha-e821d1f6e4b2",
249
249
  "repository": {
250
250
  "type": "git",
251
251
  "url": "git+https://github.com/cprussin/domicile.git",