@vicinae/api 0.16.1 → 0.16.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/api/bus.d.ts +5 -0
  2. package/dist/api/cache.js +5 -4
  3. package/dist/api/color.d.ts +2 -1
  4. package/dist/api/color.js +48 -3
  5. package/dist/api/components/action-pannel.d.ts +3 -3
  6. package/dist/api/components/action-pannel.js +4 -2
  7. package/dist/api/components/actions.d.ts +10 -1
  8. package/dist/api/components/actions.js +13 -1
  9. package/dist/api/components/dropdown.d.ts +1 -1
  10. package/dist/api/components/dropdown.js +3 -1
  11. package/dist/api/components/empty-view.js +4 -2
  12. package/dist/api/components/form.d.ts +16 -2
  13. package/dist/api/components/form.js +28 -4
  14. package/dist/api/components/grid.d.ts +8 -19
  15. package/dist/api/components/grid.js +32 -2
  16. package/dist/api/components/list.d.ts +22 -3
  17. package/dist/api/components/list.js +49 -2
  18. package/dist/api/components/metadata.d.ts +1 -1
  19. package/dist/api/components/metadata.js +5 -1
  20. package/dist/api/components/tag.d.ts +2 -2
  21. package/dist/api/components/tag.js +4 -3
  22. package/dist/api/context/navigation-provider.js +1 -4
  23. package/dist/api/environment.d.ts +4 -0
  24. package/dist/api/image.d.ts +7 -5
  25. package/dist/api/image.js +4 -0
  26. package/dist/api/oauth.d.ts +3 -8
  27. package/dist/api/oauth.js +51 -21
  28. package/dist/api/proto/application.d.ts +10 -0
  29. package/dist/api/proto/application.js +150 -3
  30. package/dist/api/proto/daemon.d.ts +4 -1
  31. package/dist/api/proto/daemon.js +71 -16
  32. package/dist/api/proto/manager.d.ts +2 -0
  33. package/dist/api/proto/manager.js +32 -0
  34. package/dist/api/proto/oauth.d.ts +42 -0
  35. package/dist/api/proto/oauth.js +620 -5
  36. package/dist/api/proto/ui.d.ts +12 -1
  37. package/dist/api/proto/ui.js +164 -9
  38. package/dist/api/proto/wm.d.ts +20 -0
  39. package/dist/api/proto/wm.js +291 -7
  40. package/dist/api/utils.d.ts +43 -0
  41. package/dist/api/utils.js +24 -1
  42. package/dist/api/window-management.d.ts +29 -0
  43. package/dist/api/window-management.js +17 -0
  44. package/dist/commands/build/index.js +5 -2
  45. package/dist/commands/develop/index.js +7 -2
  46. package/dist/schemas/manifest.d.ts +255 -5
  47. package/dist/schemas/manifest.js +202 -4
  48. package/dist/utils/extension-types.d.ts +14 -0
  49. package/dist/utils/extension-types.js +162 -0
  50. package/package.json +1 -1
  51. package/types/jsx.d.ts +54 -33
@@ -5,7 +5,7 @@
5
5
  // protoc v6.32.1
6
6
  // source: wm.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.Response = exports.Request = exports.SetWindowBoundsResponse = exports.SetWindowBoundsRequest = exports.GetWindowsResponse = exports.GetWindowsRequest = exports.GetActiveWorkspaceWindowsResponse = exports.GetActiveWorkspaceWindowsRequest = exports.GetActiveWorkspaceResponse = exports.GetActiveWorkspaceRequest = exports.GetWorkspacesResponse = exports.GetWorkspacesRequest = exports.GetActiveWindowResponse = exports.GetActiveWindowRequest = exports.PingResponse = exports.PingRequest = exports.Workspace = exports.Window = exports.protobufPackage = void 0;
8
+ exports.Response = exports.Request = exports.SetWindowBoundsResponse = exports.SetWindowBoundsRequest = exports.GetWindowsResponse = exports.GetWindowsRequest = exports.GetScreensResponse = exports.GetScreensRequest = exports.GetActiveWorkspaceWindowsResponse = exports.GetActiveWorkspaceWindowsRequest = exports.GetActiveWorkspaceResponse = exports.GetActiveWorkspaceRequest = exports.GetWorkspacesResponse = exports.GetWorkspacesRequest = exports.GetActiveWindowResponse = exports.GetActiveWindowRequest = exports.PingResponse = exports.PingRequest = exports.Workspace = exports.Screen = exports.Window = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  const application_1 = require("./application");
@@ -183,6 +183,164 @@ exports.Window = {
183
183
  return message;
184
184
  },
185
185
  };
186
+ function createBaseScreen() {
187
+ return { name: "", model: "", make: "", serial: undefined, x: 0, y: 0, width: 0, height: 0 };
188
+ }
189
+ exports.Screen = {
190
+ encode(message, writer = new wire_1.BinaryWriter()) {
191
+ if (message.name !== "") {
192
+ writer.uint32(10).string(message.name);
193
+ }
194
+ if (message.model !== "") {
195
+ writer.uint32(18).string(message.model);
196
+ }
197
+ if (message.make !== "") {
198
+ writer.uint32(26).string(message.make);
199
+ }
200
+ if (message.serial !== undefined) {
201
+ writer.uint32(34).string(message.serial);
202
+ }
203
+ if (message.x !== 0) {
204
+ writer.uint32(40).int32(message.x);
205
+ }
206
+ if (message.y !== 0) {
207
+ writer.uint32(48).int32(message.y);
208
+ }
209
+ if (message.width !== 0) {
210
+ writer.uint32(56).int32(message.width);
211
+ }
212
+ if (message.height !== 0) {
213
+ writer.uint32(64).int32(message.height);
214
+ }
215
+ return writer;
216
+ },
217
+ decode(input, length) {
218
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
219
+ const end = length === undefined ? reader.len : reader.pos + length;
220
+ const message = createBaseScreen();
221
+ while (reader.pos < end) {
222
+ const tag = reader.uint32();
223
+ switch (tag >>> 3) {
224
+ case 1: {
225
+ if (tag !== 10) {
226
+ break;
227
+ }
228
+ message.name = reader.string();
229
+ continue;
230
+ }
231
+ case 2: {
232
+ if (tag !== 18) {
233
+ break;
234
+ }
235
+ message.model = reader.string();
236
+ continue;
237
+ }
238
+ case 3: {
239
+ if (tag !== 26) {
240
+ break;
241
+ }
242
+ message.make = reader.string();
243
+ continue;
244
+ }
245
+ case 4: {
246
+ if (tag !== 34) {
247
+ break;
248
+ }
249
+ message.serial = reader.string();
250
+ continue;
251
+ }
252
+ case 5: {
253
+ if (tag !== 40) {
254
+ break;
255
+ }
256
+ message.x = reader.int32();
257
+ continue;
258
+ }
259
+ case 6: {
260
+ if (tag !== 48) {
261
+ break;
262
+ }
263
+ message.y = reader.int32();
264
+ continue;
265
+ }
266
+ case 7: {
267
+ if (tag !== 56) {
268
+ break;
269
+ }
270
+ message.width = reader.int32();
271
+ continue;
272
+ }
273
+ case 8: {
274
+ if (tag !== 64) {
275
+ break;
276
+ }
277
+ message.height = reader.int32();
278
+ continue;
279
+ }
280
+ }
281
+ if ((tag & 7) === 4 || tag === 0) {
282
+ break;
283
+ }
284
+ reader.skip(tag & 7);
285
+ }
286
+ return message;
287
+ },
288
+ fromJSON(object) {
289
+ return {
290
+ name: isSet(object.name) ? globalThis.String(object.name) : "",
291
+ model: isSet(object.model) ? globalThis.String(object.model) : "",
292
+ make: isSet(object.make) ? globalThis.String(object.make) : "",
293
+ serial: isSet(object.serial) ? globalThis.String(object.serial) : undefined,
294
+ x: isSet(object.x) ? globalThis.Number(object.x) : 0,
295
+ y: isSet(object.y) ? globalThis.Number(object.y) : 0,
296
+ width: isSet(object.width) ? globalThis.Number(object.width) : 0,
297
+ height: isSet(object.height) ? globalThis.Number(object.height) : 0,
298
+ };
299
+ },
300
+ toJSON(message) {
301
+ const obj = {};
302
+ if (message.name !== "") {
303
+ obj.name = message.name;
304
+ }
305
+ if (message.model !== "") {
306
+ obj.model = message.model;
307
+ }
308
+ if (message.make !== "") {
309
+ obj.make = message.make;
310
+ }
311
+ if (message.serial !== undefined) {
312
+ obj.serial = message.serial;
313
+ }
314
+ if (message.x !== 0) {
315
+ obj.x = Math.round(message.x);
316
+ }
317
+ if (message.y !== 0) {
318
+ obj.y = Math.round(message.y);
319
+ }
320
+ if (message.width !== 0) {
321
+ obj.width = Math.round(message.width);
322
+ }
323
+ if (message.height !== 0) {
324
+ obj.height = Math.round(message.height);
325
+ }
326
+ return obj;
327
+ },
328
+ create(base) {
329
+ return exports.Screen.fromPartial(base ?? {});
330
+ },
331
+ fromPartial(object) {
332
+ const message = createBaseScreen();
333
+ message.name = object.name ?? "";
334
+ message.model = object.model ?? "";
335
+ message.make = object.make ?? "";
336
+ message.serial = object.serial ?? undefined;
337
+ message.x = object.x ?? 0;
338
+ message.y = object.y ?? 0;
339
+ message.width = object.width ?? 0;
340
+ message.height = object.height ?? 0;
341
+ return message;
342
+ },
343
+ };
186
344
  function createBaseWorkspace() {
187
345
  return { id: "", name: "", active: false, fullscreen: false, monitor: "" };
188
346
  }
@@ -746,6 +904,96 @@ exports.GetActiveWorkspaceWindowsResponse = {
746
904
  return message;
747
905
  },
748
906
  };
907
+ function createBaseGetScreensRequest() {
908
+ return {};
909
+ }
910
+ exports.GetScreensRequest = {
911
+ encode(_, writer = new wire_1.BinaryWriter()) {
912
+ return writer;
913
+ },
914
+ decode(input, length) {
915
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
916
+ const end = length === undefined ? reader.len : reader.pos + length;
917
+ const message = createBaseGetScreensRequest();
918
+ while (reader.pos < end) {
919
+ const tag = reader.uint32();
920
+ switch (tag >>> 3) {
921
+ }
922
+ if ((tag & 7) === 4 || tag === 0) {
923
+ break;
924
+ }
925
+ reader.skip(tag & 7);
926
+ }
927
+ return message;
928
+ },
929
+ fromJSON(_) {
930
+ return {};
931
+ },
932
+ toJSON(_) {
933
+ const obj = {};
934
+ return obj;
935
+ },
936
+ create(base) {
937
+ return exports.GetScreensRequest.fromPartial(base ?? {});
938
+ },
939
+ fromPartial(_) {
940
+ const message = createBaseGetScreensRequest();
941
+ return message;
942
+ },
943
+ };
944
+ function createBaseGetScreensResponse() {
945
+ return { screens: [] };
946
+ }
947
+ exports.GetScreensResponse = {
948
+ encode(message, writer = new wire_1.BinaryWriter()) {
949
+ for (const v of message.screens) {
950
+ exports.Screen.encode(v, writer.uint32(10).fork()).join();
951
+ }
952
+ return writer;
953
+ },
954
+ decode(input, length) {
955
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
956
+ const end = length === undefined ? reader.len : reader.pos + length;
957
+ const message = createBaseGetScreensResponse();
958
+ while (reader.pos < end) {
959
+ const tag = reader.uint32();
960
+ switch (tag >>> 3) {
961
+ case 1: {
962
+ if (tag !== 10) {
963
+ break;
964
+ }
965
+ message.screens.push(exports.Screen.decode(reader, reader.uint32()));
966
+ continue;
967
+ }
968
+ }
969
+ if ((tag & 7) === 4 || tag === 0) {
970
+ break;
971
+ }
972
+ reader.skip(tag & 7);
973
+ }
974
+ return message;
975
+ },
976
+ fromJSON(object) {
977
+ return {
978
+ screens: globalThis.Array.isArray(object?.screens) ? object.screens.map((e) => exports.Screen.fromJSON(e)) : [],
979
+ };
980
+ },
981
+ toJSON(message) {
982
+ const obj = {};
983
+ if (message.screens?.length) {
984
+ obj.screens = message.screens.map((e) => exports.Screen.toJSON(e));
985
+ }
986
+ return obj;
987
+ },
988
+ create(base) {
989
+ return exports.GetScreensResponse.fromPartial(base ?? {});
990
+ },
991
+ fromPartial(object) {
992
+ const message = createBaseGetScreensResponse();
993
+ message.screens = object.screens?.map((e) => exports.Screen.fromPartial(e)) || [];
994
+ return message;
995
+ },
996
+ };
749
997
  function createBaseGetWindowsRequest() {
750
998
  return { workspaceId: undefined };
751
999
  }
@@ -961,6 +1209,7 @@ function createBaseRequest() {
961
1209
  getActiveWindow: undefined,
962
1210
  getActiveWorkspace: undefined,
963
1211
  getWindows: undefined,
1212
+ getScreens: undefined,
964
1213
  getWorkspaces: undefined,
965
1214
  setWindowBounds: undefined,
966
1215
  };
@@ -979,11 +1228,14 @@ exports.Request = {
979
1228
  if (message.getWindows !== undefined) {
980
1229
  exports.GetWindowsRequest.encode(message.getWindows, writer.uint32(34).fork()).join();
981
1230
  }
1231
+ if (message.getScreens !== undefined) {
1232
+ exports.GetScreensRequest.encode(message.getScreens, writer.uint32(42).fork()).join();
1233
+ }
982
1234
  if (message.getWorkspaces !== undefined) {
983
- exports.GetWorkspacesRequest.encode(message.getWorkspaces, writer.uint32(42).fork()).join();
1235
+ exports.GetWorkspacesRequest.encode(message.getWorkspaces, writer.uint32(50).fork()).join();
984
1236
  }
985
1237
  if (message.setWindowBounds !== undefined) {
986
- exports.SetWindowBoundsRequest.encode(message.setWindowBounds, writer.uint32(50).fork()).join();
1238
+ exports.SetWindowBoundsRequest.encode(message.setWindowBounds, writer.uint32(58).fork()).join();
987
1239
  }
988
1240
  return writer;
989
1241
  },
@@ -1026,13 +1278,20 @@ exports.Request = {
1026
1278
  if (tag !== 42) {
1027
1279
  break;
1028
1280
  }
1029
- message.getWorkspaces = exports.GetWorkspacesRequest.decode(reader, reader.uint32());
1281
+ message.getScreens = exports.GetScreensRequest.decode(reader, reader.uint32());
1030
1282
  continue;
1031
1283
  }
1032
1284
  case 6: {
1033
1285
  if (tag !== 50) {
1034
1286
  break;
1035
1287
  }
1288
+ message.getWorkspaces = exports.GetWorkspacesRequest.decode(reader, reader.uint32());
1289
+ continue;
1290
+ }
1291
+ case 7: {
1292
+ if (tag !== 58) {
1293
+ break;
1294
+ }
1036
1295
  message.setWindowBounds = exports.SetWindowBoundsRequest.decode(reader, reader.uint32());
1037
1296
  continue;
1038
1297
  }
@@ -1054,6 +1313,7 @@ exports.Request = {
1054
1313
  ? exports.GetActiveWorkspaceRequest.fromJSON(object.getActiveWorkspace)
1055
1314
  : undefined,
1056
1315
  getWindows: isSet(object.getWindows) ? exports.GetWindowsRequest.fromJSON(object.getWindows) : undefined,
1316
+ getScreens: isSet(object.getScreens) ? exports.GetScreensRequest.fromJSON(object.getScreens) : undefined,
1057
1317
  getWorkspaces: isSet(object.getWorkspaces) ? exports.GetWorkspacesRequest.fromJSON(object.getWorkspaces) : undefined,
1058
1318
  setWindowBounds: isSet(object.setWindowBounds)
1059
1319
  ? exports.SetWindowBoundsRequest.fromJSON(object.setWindowBounds)
@@ -1074,6 +1334,9 @@ exports.Request = {
1074
1334
  if (message.getWindows !== undefined) {
1075
1335
  obj.getWindows = exports.GetWindowsRequest.toJSON(message.getWindows);
1076
1336
  }
1337
+ if (message.getScreens !== undefined) {
1338
+ obj.getScreens = exports.GetScreensRequest.toJSON(message.getScreens);
1339
+ }
1077
1340
  if (message.getWorkspaces !== undefined) {
1078
1341
  obj.getWorkspaces = exports.GetWorkspacesRequest.toJSON(message.getWorkspaces);
1079
1342
  }
@@ -1099,6 +1362,9 @@ exports.Request = {
1099
1362
  message.getWindows = (object.getWindows !== undefined && object.getWindows !== null)
1100
1363
  ? exports.GetWindowsRequest.fromPartial(object.getWindows)
1101
1364
  : undefined;
1365
+ message.getScreens = (object.getScreens !== undefined && object.getScreens !== null)
1366
+ ? exports.GetScreensRequest.fromPartial(object.getScreens)
1367
+ : undefined;
1102
1368
  message.getWorkspaces = (object.getWorkspaces !== undefined && object.getWorkspaces !== null)
1103
1369
  ? exports.GetWorkspacesRequest.fromPartial(object.getWorkspaces)
1104
1370
  : undefined;
@@ -1114,6 +1380,7 @@ function createBaseResponse() {
1114
1380
  getActiveWindow: undefined,
1115
1381
  getActiveWorkspace: undefined,
1116
1382
  getWindows: undefined,
1383
+ getScreens: undefined,
1117
1384
  getWorkspaces: undefined,
1118
1385
  setWindowBounds: undefined,
1119
1386
  };
@@ -1132,11 +1399,14 @@ exports.Response = {
1132
1399
  if (message.getWindows !== undefined) {
1133
1400
  exports.GetWindowsResponse.encode(message.getWindows, writer.uint32(34).fork()).join();
1134
1401
  }
1402
+ if (message.getScreens !== undefined) {
1403
+ exports.GetScreensResponse.encode(message.getScreens, writer.uint32(42).fork()).join();
1404
+ }
1135
1405
  if (message.getWorkspaces !== undefined) {
1136
- exports.GetWorkspacesResponse.encode(message.getWorkspaces, writer.uint32(42).fork()).join();
1406
+ exports.GetWorkspacesResponse.encode(message.getWorkspaces, writer.uint32(50).fork()).join();
1137
1407
  }
1138
1408
  if (message.setWindowBounds !== undefined) {
1139
- exports.SetWindowBoundsResponse.encode(message.setWindowBounds, writer.uint32(50).fork()).join();
1409
+ exports.SetWindowBoundsResponse.encode(message.setWindowBounds, writer.uint32(58).fork()).join();
1140
1410
  }
1141
1411
  return writer;
1142
1412
  },
@@ -1179,13 +1449,20 @@ exports.Response = {
1179
1449
  if (tag !== 42) {
1180
1450
  break;
1181
1451
  }
1182
- message.getWorkspaces = exports.GetWorkspacesResponse.decode(reader, reader.uint32());
1452
+ message.getScreens = exports.GetScreensResponse.decode(reader, reader.uint32());
1183
1453
  continue;
1184
1454
  }
1185
1455
  case 6: {
1186
1456
  if (tag !== 50) {
1187
1457
  break;
1188
1458
  }
1459
+ message.getWorkspaces = exports.GetWorkspacesResponse.decode(reader, reader.uint32());
1460
+ continue;
1461
+ }
1462
+ case 7: {
1463
+ if (tag !== 58) {
1464
+ break;
1465
+ }
1189
1466
  message.setWindowBounds = exports.SetWindowBoundsResponse.decode(reader, reader.uint32());
1190
1467
  continue;
1191
1468
  }
@@ -1207,6 +1484,7 @@ exports.Response = {
1207
1484
  ? exports.GetActiveWorkspaceResponse.fromJSON(object.getActiveWorkspace)
1208
1485
  : undefined,
1209
1486
  getWindows: isSet(object.getWindows) ? exports.GetWindowsResponse.fromJSON(object.getWindows) : undefined,
1487
+ getScreens: isSet(object.getScreens) ? exports.GetScreensResponse.fromJSON(object.getScreens) : undefined,
1210
1488
  getWorkspaces: isSet(object.getWorkspaces) ? exports.GetWorkspacesResponse.fromJSON(object.getWorkspaces) : undefined,
1211
1489
  setWindowBounds: isSet(object.setWindowBounds)
1212
1490
  ? exports.SetWindowBoundsResponse.fromJSON(object.setWindowBounds)
@@ -1227,6 +1505,9 @@ exports.Response = {
1227
1505
  if (message.getWindows !== undefined) {
1228
1506
  obj.getWindows = exports.GetWindowsResponse.toJSON(message.getWindows);
1229
1507
  }
1508
+ if (message.getScreens !== undefined) {
1509
+ obj.getScreens = exports.GetScreensResponse.toJSON(message.getScreens);
1510
+ }
1230
1511
  if (message.getWorkspaces !== undefined) {
1231
1512
  obj.getWorkspaces = exports.GetWorkspacesResponse.toJSON(message.getWorkspaces);
1232
1513
  }
@@ -1252,6 +1533,9 @@ exports.Response = {
1252
1533
  message.getWindows = (object.getWindows !== undefined && object.getWindows !== null)
1253
1534
  ? exports.GetWindowsResponse.fromPartial(object.getWindows)
1254
1535
  : undefined;
1536
+ message.getScreens = (object.getScreens !== undefined && object.getScreens !== null)
1537
+ ? exports.GetScreensResponse.fromPartial(object.getScreens)
1538
+ : undefined;
1255
1539
  message.getWorkspaces = (object.getWorkspaces !== undefined && object.getWorkspaces !== null)
1256
1540
  ? exports.GetWorkspacesResponse.fromPartial(object.getWorkspaces)
1257
1541
  : undefined;
@@ -1,6 +1,49 @@
1
1
  import { PathLike } from "fs";
2
2
  import { Application } from "./proto/application";
3
3
  export declare const trash: (path: PathLike | PathLike[]) => Promise<void>;
4
+ /**
5
+ * Additional options that can be passed in order to tweak the behavior of the terminal window.
6
+ * Note that most options are best-effort, which means that they may or may not work depending on
7
+ * the default terminal emulator that is available.
8
+ * On Linux, Vicinae honors the xdg-terminal-exec specification: https://gitlab.freedesktop.org/terminal-wg/specifications/-/merge_requests/3/diffs
9
+ */
10
+ export type RunInTerminalOptions = {
11
+ /**
12
+ * Ensure the terminal window is held open after the execution of the command completes.
13
+ * This option is provided as a hint to the default terminal emulator, and might not be honored.
14
+ */
15
+ hold?: boolean;
16
+ /**
17
+ * Overrides the application ID used for this specific terminal window.
18
+ * Can be useful if you want to target this window by its class with the window management API.
19
+ * This option is provided as a hint to the default terminal emulator, and might not be honored.
20
+ *
21
+ * @see WindowManagement
22
+ */
23
+ appId?: string;
24
+ /**
25
+ * Overrides the title used for this specific terminal window.
26
+ * Can be useful if you want to target this window by its title with the window management API.
27
+ * This option is provided as a hint to the default terminal emulator, and might not be honored.
28
+ *
29
+ * @see WindowManagement
30
+ */
31
+ title?: string;
32
+ };
33
+ /**
34
+ * Run a command in a new terminal emulator window.
35
+ *
36
+ * @param args - the command line to execute. This is *not* getting interpreted by a shell.
37
+ * @param options - list of options that can be passed in order to tweak the behavior of the terminal window.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * await runInTerminal(['journalctl', '--user', '-u', '-f', 'vicinae']);
42
+ * // or, inside a shell:
43
+ * await runInTerminal(['/bin/bash', 'echo "dis is my home: $HOME"'], { hold: true });
44
+ * ```
45
+ */
46
+ export declare const runInTerminal: (args: string[], options?: RunInTerminalOptions) => Promise<void>;
4
47
  export declare const open: (target: string, app?: Application | string) => Promise<void>;
5
48
  export declare const getFrontmostApplication: () => Promise<Application>;
6
49
  export declare const getApplications: (target?: string) => Promise<Application[]>;
package/dist/api/utils.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Application = exports.showInFileBrowser = exports.getDefaultApplication = exports.getApplications = exports.getFrontmostApplication = exports.open = exports.trash = void 0;
3
+ exports.Application = exports.showInFileBrowser = exports.getDefaultApplication = exports.getApplications = exports.getFrontmostApplication = exports.open = exports.runInTerminal = exports.trash = void 0;
4
4
  const promises_1 = require("fs/promises");
5
5
  const bus_1 = require("./bus");
6
6
  const window_management_1 = require("./window-management");
@@ -11,6 +11,29 @@ const trash = async (path) => {
11
11
  await Promise.all(promises);
12
12
  };
13
13
  exports.trash = trash;
14
+ /**
15
+ * Run a command in a new terminal emulator window.
16
+ *
17
+ * @param args - the command line to execute. This is *not* getting interpreted by a shell.
18
+ * @param options - list of options that can be passed in order to tweak the behavior of the terminal window.
19
+ *
20
+ * @example
21
+ * ```typescript
22
+ * await runInTerminal(['journalctl', '--user', '-u', '-f', 'vicinae']);
23
+ * // or, inside a shell:
24
+ * await runInTerminal(['/bin/bash', 'echo "dis is my home: $HOME"'], { hold: true });
25
+ * ```
26
+ */
27
+ const runInTerminal = async (args, options = {}) => {
28
+ const { hold = false, appId, title } = options;
29
+ await bus_1.bus.turboRequest("app.runInTerminal", {
30
+ cmdline: args,
31
+ hold,
32
+ appId,
33
+ title,
34
+ });
35
+ };
36
+ exports.runInTerminal = runInTerminal;
14
37
  const open = async (target, app) => {
15
38
  let appId;
16
39
  if (app) {
@@ -39,8 +39,37 @@ export declare namespace WindowManagement {
39
39
  monitorId: string;
40
40
  active: boolean;
41
41
  };
42
+ /**
43
+ * A screen, physical or virtual, attached to this computer.
44
+ */
45
+ type Screen = {
46
+ name: string;
47
+ /**
48
+ * Name of the screen's manufacturer.
49
+ */
50
+ make: string;
51
+ model: string;
52
+ /**
53
+ * The serial number of the screen, if available.
54
+ */
55
+ serial?: string;
56
+ bounds: {
57
+ position: {
58
+ x: number;
59
+ y: number;
60
+ };
61
+ size: {
62
+ width: number;
63
+ height: number;
64
+ };
65
+ };
66
+ };
42
67
  function ping(): Promise<boolean>;
43
68
  function getWindows(options?: wm.GetWindowsRequest): Promise<WindowManagement.Window[]>;
69
+ /**
70
+ * Return the list of screens (physical and virtual) currently attached to the computer.
71
+ */
72
+ function getScreens(): Promise<Screen[]>;
44
73
  function getActiveWorkspace(): Promise<WindowManagement.Workspace>;
45
74
  function getWorkspaces(): Promise<WindowManagement.Workspace[]>;
46
75
  function getWindowsOnActiveWorkspace(): Promise<WindowManagement.Window[]>;
@@ -50,6 +50,23 @@ var WindowManagement;
50
50
  return res.unwrap().windows.map(transformWindow);
51
51
  }
52
52
  WindowManagement.getWindows = getWindows;
53
+ /**
54
+ * Return the list of screens (physical and virtual) currently attached to the computer.
55
+ */
56
+ async function getScreens() {
57
+ const res = await bus_1.bus.turboRequest("wm.getScreens", {});
58
+ return res.unwrap().screens.map((sc) => ({
59
+ name: sc.name,
60
+ make: sc.make,
61
+ model: sc.model,
62
+ serial: sc.serial,
63
+ bounds: {
64
+ position: { x: sc.x, y: sc.y },
65
+ size: { width: sc.width, height: sc.height },
66
+ },
67
+ }));
68
+ }
69
+ WindowManagement.getScreens = getScreens;
53
70
  async function getActiveWorkspace() {
54
71
  const res = await bus_1.bus.turboRequest("wm.getActiveWorkspace", {});
55
72
  return transformWorkspace(res.unwrap().workspace);
@@ -43,6 +43,7 @@ const node_fs_1 = require("node:fs");
43
43
  const node_path_1 = require("node:path");
44
44
  const logger_js_1 = require("../../utils/logger.js");
45
45
  const utils_js_1 = require("../../utils/utils.js");
46
+ const extension_types_js_1 = require("../../utils/extension-types.js");
46
47
  const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
47
48
  class Build extends core_1.Command {
48
49
  static args = {};
@@ -91,11 +92,11 @@ class Build extends core_1.Command {
91
92
  const tsxSource = `${base}.tsx`;
92
93
  const tsSource = `${base}.ts`;
93
94
  let source = tsxSource;
94
- if (cmd.mode == "view" && !(0, node_fs_1.existsSync)(tsxSource)) {
95
+ if (cmd.mode === "view" && !(0, node_fs_1.existsSync)(tsxSource)) {
95
96
  throw new Error(`Unable to find view command ${cmd.name} at ${tsxSource}`);
96
97
  }
97
98
  // we allow .ts or .tsx for no-view
98
- if (cmd.mode == "no-view") {
99
+ if (cmd.mode === "no-view") {
99
100
  if (!(0, node_fs_1.existsSync)(tsxSource)) {
100
101
  source = tsSource;
101
102
  if (!(0, node_fs_1.existsSync)(tsSource)) {
@@ -125,6 +126,8 @@ class Build extends core_1.Command {
125
126
  }
126
127
  };
127
128
  process.chdir(src);
129
+ logger.logInfo("Generating extension types...");
130
+ (0, extension_types_js_1.updateExtensionTypes)(manifest, src);
128
131
  logger.logInfo("Checking types...");
129
132
  const typeCheck = (0, node_child_process_1.spawnSync)("npx", ["tsc", "--noEmit"]);
130
133
  if (typeCheck.error) {
@@ -45,6 +45,7 @@ const promises_1 = require("node:fs/promises");
45
45
  const node_path_1 = require("node:path");
46
46
  const logger_js_1 = require("../../utils/logger.js");
47
47
  const utils_js_1 = require("../../utils/utils.js");
48
+ const extension_types_js_1 = require("../../utils/extension-types.js");
48
49
  const vicinae_js_1 = require("../../utils/vicinae.js");
49
50
  const manifest_js_1 = __importDefault(require("../../schemas/manifest.js"));
50
51
  class Develop extends core_1.Command {
@@ -82,6 +83,8 @@ class Develop extends core_1.Command {
82
83
  };
83
84
  let manifest = parseManifest();
84
85
  const vicinae = new vicinae_js_1.VicinaeClient();
86
+ logger.logInfo("Generating extension types...");
87
+ (0, extension_types_js_1.updateExtensionTypes)(manifest, flags.target);
85
88
  const typeCheck = async () => {
86
89
  const spawned = (0, node_child_process_1.spawn)("npx", ["tsc", "--noEmit"]);
87
90
  let stderr = Buffer.from("");
@@ -112,11 +115,11 @@ class Develop extends core_1.Command {
112
115
  const tsxSource = `${base}.tsx`;
113
116
  const tsSource = `${base}.ts`;
114
117
  let source = tsxSource;
115
- if (cmd.mode == "view" && !(0, node_fs_1.existsSync)(tsxSource)) {
118
+ if (cmd.mode === "view" && !(0, node_fs_1.existsSync)(tsxSource)) {
116
119
  throw new Error(`could not find entrypoint src/${cmd.name}.tsx for command ${cmd.name}.`);
117
120
  }
118
121
  // we allow .ts or .tsx for no-view
119
- if (cmd.mode == "no-view") {
122
+ if (cmd.mode === "no-view") {
120
123
  if (!(0, node_fs_1.existsSync)(tsxSource)) {
121
124
  source = tsSource;
122
125
  if (!(0, node_fs_1.existsSync)(tsSource)) {
@@ -194,6 +197,8 @@ class Develop extends core_1.Command {
194
197
  .on("all", async (_, path) => {
195
198
  if (path.endsWith("package.json")) {
196
199
  manifest = parseManifest();
200
+ logger.logInfo("Generating extension types...");
201
+ (0, extension_types_js_1.updateExtensionTypes)(manifest, flags.target);
197
202
  }
198
203
  logger.logEvent(`changed file ${path}`);
199
204
  await safeBuild(extensionDir);