@vicinae/api 0.16.1 → 0.16.2

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.
@@ -12,6 +12,16 @@ export interface Window {
12
12
  height: number;
13
13
  app?: Application | undefined;
14
14
  }
15
+ export interface Screen {
16
+ name: string;
17
+ model: string;
18
+ make: string;
19
+ serial?: string | undefined;
20
+ x: number;
21
+ y: number;
22
+ width: number;
23
+ height: number;
24
+ }
15
25
  export interface Workspace {
16
26
  id: string;
17
27
  name: string;
@@ -44,6 +54,11 @@ export interface GetActiveWorkspaceWindowsRequest {
44
54
  export interface GetActiveWorkspaceWindowsResponse {
45
55
  windows: Window[];
46
56
  }
57
+ export interface GetScreensRequest {
58
+ }
59
+ export interface GetScreensResponse {
60
+ screens: Screen[];
61
+ }
47
62
  export interface GetWindowsRequest {
48
63
  workspaceId?: string | undefined;
49
64
  }
@@ -61,6 +76,7 @@ export interface Request {
61
76
  getActiveWindow?: GetActiveWindowRequest | undefined;
62
77
  getActiveWorkspace?: GetActiveWorkspaceRequest | undefined;
63
78
  getWindows?: GetWindowsRequest | undefined;
79
+ getScreens?: GetScreensRequest | undefined;
64
80
  getWorkspaces?: GetWorkspacesRequest | undefined;
65
81
  setWindowBounds?: SetWindowBoundsRequest | undefined;
66
82
  }
@@ -69,10 +85,12 @@ export interface Response {
69
85
  getActiveWindow?: GetActiveWindowResponse | undefined;
70
86
  getActiveWorkspace?: GetActiveWorkspaceResponse | undefined;
71
87
  getWindows?: GetWindowsResponse | undefined;
88
+ getScreens?: GetScreensResponse | undefined;
72
89
  getWorkspaces?: GetWorkspacesResponse | undefined;
73
90
  setWindowBounds?: SetWindowBoundsResponse | undefined;
74
91
  }
75
92
  export declare const Window: MessageFns<Window>;
93
+ export declare const Screen: MessageFns<Screen>;
76
94
  export declare const Workspace: MessageFns<Workspace>;
77
95
  export declare const PingRequest: MessageFns<PingRequest>;
78
96
  export declare const PingResponse: MessageFns<PingResponse>;
@@ -84,6 +102,8 @@ export declare const GetActiveWorkspaceRequest: MessageFns<GetActiveWorkspaceReq
84
102
  export declare const GetActiveWorkspaceResponse: MessageFns<GetActiveWorkspaceResponse>;
85
103
  export declare const GetActiveWorkspaceWindowsRequest: MessageFns<GetActiveWorkspaceWindowsRequest>;
86
104
  export declare const GetActiveWorkspaceWindowsResponse: MessageFns<GetActiveWorkspaceWindowsResponse>;
105
+ export declare const GetScreensRequest: MessageFns<GetScreensRequest>;
106
+ export declare const GetScreensResponse: MessageFns<GetScreensResponse>;
87
107
  export declare const GetWindowsRequest: MessageFns<GetWindowsRequest>;
88
108
  export declare const GetWindowsResponse: MessageFns<GetWindowsResponse>;
89
109
  export declare const SetWindowBoundsRequest: MessageFns<SetWindowBoundsRequest>;
@@ -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);
@@ -29,8 +29,8 @@ declare const _default: z.ZodObject<{
29
29
  icon: z.ZodOptional<z.ZodString>;
30
30
  mode: z.ZodEnum<{
31
31
  "menu-bar": "menu-bar";
32
- "no-view": "no-view";
33
32
  view: "view";
33
+ "no-view": "no-view";
34
34
  }>;
35
35
  name: z.ZodString;
36
36
  title: z.ZodString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vicinae/api",
3
- "version": "0.16.1",
3
+ "version": "0.16.2",
4
4
  "description": "TypeScript SDK to build Vicinae extensions",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",