@raycast/api 1.77.2 → 1.78.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types/index.d.ts +127 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raycast/api",
3
- "version": "1.77.2",
3
+ "version": "1.78.0",
4
4
  "description": "Build extensions for Raycast with React and Node.js.",
5
5
  "author": "Raycast Technologies Ltd.",
6
6
  "homepage": "https://developers.raycast.com",
package/types/index.d.ts CHANGED
@@ -2381,6 +2381,10 @@ export declare interface Environment {
2381
2381
  * The version of the main Raycast app
2382
2382
  */
2383
2383
  raycastVersion: string;
2384
+ /**
2385
+ * The name of the extension owner (if any) or author, as specified in package.json
2386
+ */
2387
+ ownerOrAuthorName: string;
2384
2388
  /**
2385
2389
  * The name of the extension, as specified in package.json
2386
2390
  */
@@ -7217,7 +7221,7 @@ declare interface LabelProps {
7217
7221
  * Called when the user scrolls to the bottom of the view and there are more items to load.
7218
7222
  * When this is called, the command should update the list of items to include the next page.
7219
7223
  */
7220
- onLoadMore: (page: number) => void;
7224
+ onLoadMore: () => void;
7221
7225
  };
7222
7226
  }
7223
7227
 
@@ -8554,4 +8558,126 @@ declare interface LabelProps {
8554
8558
  /** @deprecated Use `useAI` from `@raycast/utils` */
8555
8559
  export declare const useUnstableAI: () => any;
8556
8560
 
8561
+ export declare namespace WindowManagement {
8562
+ /**
8563
+ * The type of a {@link Desktop}.
8564
+ */
8565
+ export enum DesktopType {
8566
+ /** The default Desktop type. It can contain any number of {@link Window} */
8567
+ User = "User",
8568
+ /** A Desktop made of a single fullscreen window */
8569
+ FullScreen = "FullScreen"
8570
+ }
8571
+ /**
8572
+ * A Window from an {@link Application} on a {@link Desktop}.
8573
+ */
8574
+ export type Window = {
8575
+ id: string;
8576
+ application?: Application;
8577
+ bounds: {
8578
+ position: {
8579
+ x: number;
8580
+ y: number;
8581
+ };
8582
+ size: {
8583
+ width: number;
8584
+ height: number;
8585
+ };
8586
+ } | "fullscreen";
8587
+ desktopId: string;
8588
+ fullScreenSettable: boolean;
8589
+ resizable: boolean;
8590
+ positionable: boolean;
8591
+ active: boolean;
8592
+ };
8593
+ /**
8594
+ * A Desktop represents a virtual desktop on a Screen.
8595
+ */
8596
+ export type Desktop = {
8597
+ size: {
8598
+ width: number;
8599
+ height: number;
8600
+ };
8601
+ id: string;
8602
+ screenId: string;
8603
+ active: boolean;
8604
+ type: DesktopType;
8605
+ };
8606
+ /**
8607
+ * Gets the list of {@link Desktop}s available across all screens.
8608
+ *
8609
+ * @returns A Promise that resolves with the desktops.
8610
+ *
8611
+ * @example
8612
+ * ```typescript
8613
+ * import { getDesktops, showToast } from "@raycast/api";
8614
+ *
8615
+ * export default async function Command() {
8616
+ * const desktops = await getDesktops();
8617
+ * const screens = Set(desktops.map((desktop) => desktop.screenId));
8618
+ * showToast({title: `Found ${desktops.length} desktops on ${screens.size} screens.`});
8619
+ * }
8620
+ * ```
8621
+ */
8622
+ export function getDesktops(): Promise<Desktop[]>;
8623
+
8624
+ /**
8625
+ * Gets the list of {@link Window}s on the active {@link Desktop}.
8626
+ *
8627
+ * @returns A Promise that resolves with an array of Windows.
8628
+ *
8629
+ * @example
8630
+ * ```typescript
8631
+ * import { getWindowsOnActiveDesktop, setWindowBounds, showToast } from "@raycast/api";
8632
+ *
8633
+ * export default async function Command() {
8634
+ * const windows = await getWindowsOnActiveDesktop();
8635
+ * const chrome = windows.find((x) => x.application?.bundleId === "com.google.Chrome");
8636
+ * if (!chrome) {
8637
+ * showToast({ title: "Couldn't find chrome", style: Toast.Style.Failure });
8638
+ * return;
8639
+ * }
8640
+ * setWindowBounds({ id: chrome.id, bounds: { position: { x: 100 } } })
8641
+ * }
8642
+ * ```
8643
+ */
8644
+ export function getWindowsOnActiveDesktop(): Promise<Window[]>;
8645
+ /**
8646
+ * Move a {@link Window} or make it fullscreen.
8647
+ *
8648
+ * @returns A Promise that resolves with the window was moved. If the move isn't possible (for example trying to make a window fullscreen that doesn't support it), the promise will be rejected.
8649
+ *
8650
+ * @example
8651
+ * ```typescript
8652
+ * import { getActiveWindow, setWindowBounds, showToast } from "@raycast/api";
8653
+ *
8654
+ * export default async function Command() {
8655
+ * try {
8656
+ * const window = await getActiveWindow();
8657
+ * setWindowBounds({ id: window.id, bounds: { position: { x: 100 } } })
8658
+ * } catch (error) {
8659
+ * showToast({ title: "Could not move window", message: error.message, style: Toast.Style.Failure });
8660
+ * }
8661
+ * }
8662
+ * ```
8663
+ */
8664
+ export function setWindowBounds(options: {
8665
+ id: string;
8666
+ } & ({
8667
+ bounds: {
8668
+ position?: {
8669
+ x?: number;
8670
+ y?: number;
8671
+ };
8672
+ size?: {
8673
+ width?: number;
8674
+ height?: number;
8675
+ };
8676
+ };
8677
+ desktopId?: string;
8678
+ } | {
8679
+ bounds: "fullscreen";
8680
+ })): Promise<void>;
8681
+ }
8682
+
8557
8683
  export { }