@domicile-desktop/sdk 0.0.0-alpha-e95270f0da70 → 0.0.0-alpha-51482e4eb22d

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.
@@ -61,6 +61,7 @@ const absentHost = () => ({
61
61
  displays: null,
62
62
  focusApp: () => undefined,
63
63
  focusChrome: () => undefined,
64
+ focusedWindow: null,
64
65
  grabShortcut: () => undefined,
65
66
  invokeNotificationAction: () => undefined,
66
67
  key: () => undefined,
@@ -86,4 +87,5 @@ const absentHost = () => ({
86
87
  unlock: () => undefined,
87
88
  warpPointer: () => undefined,
88
89
  watchAudioLevels: () => undefined,
90
+ windows: [],
89
91
  });
@@ -56,6 +56,32 @@ export type DomicileDisplay = {
56
56
  */
57
57
  readonly transform: string;
58
58
  };
59
+ /**
60
+ * One client window, as {@link DomicileHost.windows} lists it: what the
61
+ * compositor has said about it so far. Replaced, never edited — any change is
62
+ * a new `windows` array and a `windowschanged`.
63
+ */
64
+ export type DomicileWindow = {
65
+ readonly appId: string;
66
+ /** Empty until the client names itself. */
67
+ readonly title: string;
68
+ /** The size the client last committed, in CSS pixels; `null` until it has. */
69
+ readonly width: number | null;
70
+ readonly height: number | null;
71
+ /** The limits the client asked for; `null` where it asked for none. */
72
+ readonly minWidth: number | null;
73
+ readonly minHeight: number | null;
74
+ readonly maxWidth: number | null;
75
+ readonly maxHeight: number | null;
76
+ readonly cursor: CursorShape;
77
+ /** A popup's parent window; `null` for a toplevel. */
78
+ readonly parent: string | null;
79
+ /** A popup's place relative to its parent; `null` for a toplevel. */
80
+ readonly x: number | null;
81
+ readonly y: number | null;
82
+ /** Whether a popup grabbed the pointer; `false` for a toplevel. */
83
+ readonly grab: boolean;
84
+ };
59
85
  /**
60
86
  * A window event: appeared, resized, closed, focus changed, and similar.
61
87
  *
@@ -587,6 +613,19 @@ export type DomicileHostEventMap = {
587
613
  * {@link DomicileHost.browserWindows} for the new list.
588
614
  */
589
615
  browserwindowschanged: Event;
616
+ /**
617
+ * A window appeared, closed, or changed. Bare — read
618
+ * {@link DomicileHost.windows} for what they are now.
619
+ */
620
+ windowschanged: Event;
621
+ /**
622
+ * The compositor said where the keyboard is. Bare — read
623
+ * {@link DomicileHost.focusedWindow}. Every time, not only when it moves, and
624
+ * once after the windows already running are replayed to a page that has
625
+ * just connected: a window listed after the first of these is one opened
626
+ * now.
627
+ */
628
+ focusedwindowchanged: Event;
590
629
  };
591
630
  /**
592
631
  * The shell's control channel to the compositor.
@@ -773,6 +812,15 @@ export type DomicileHost = {
773
812
  * browser lists them, which it does as soon as something listens.
774
813
  */
775
814
  readonly browserWindows: readonly DomicileBrowserWindow[] | null;
815
+ /**
816
+ * Every client window, in the order they appeared. Reading it binds the
817
+ * channel, and the compositor announces the windows already running as it
818
+ * does, so a shell that reads late misses nothing: read, then listen for
819
+ * `windowschanged`. A different frozen array after every change.
820
+ */
821
+ readonly windows: readonly DomicileWindow[];
822
+ /** The window holding the keyboard, or `null` when the shell's page holds it. */
823
+ readonly focusedWindow: string | null;
776
824
  addEventListener<T extends keyof DomicileHostEventMap>(type: T, listener: (event: DomicileHostEventMap[T]) => void): void;
777
825
  };
778
826
  declare global {
package/package.json CHANGED
@@ -150,7 +150,7 @@
150
150
  "test:unit": "bun test"
151
151
  },
152
152
  "type": "module",
153
- "version": "0.0.0-alpha-e95270f0da70",
153
+ "version": "0.0.0-alpha-51482e4eb22d",
154
154
  "repository": {
155
155
  "type": "git",
156
156
  "url": "git+https://github.com/cprussin/domicile.git",