@edgestation/sdk 0.5.0 → 0.7.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.
package/README.md CHANGED
@@ -33,12 +33,15 @@ my-widget/
33
33
  "name": "My widget",
34
34
  "minAppVersion": "0.1.0",
35
35
  "main": "dist/main.js",
36
- "size": { "w": 2, "h": 1 }
36
+ "size": { "w": 2, "h": 1 },
37
+ "permissions": ["system"]
37
38
  }
38
39
  ```
39
40
 
40
41
  `minAppVersion` is the oldest EdgeStation that can run the widget: set it to the version of this package you build with (they are released together), and older apps show an error card instead of a broken widget.
41
42
 
43
+ `permissions` lists the parts of the `api` the widget uses. The examples below call `api.system()`, so they need `system`.
44
+
42
45
  ### Plain JavaScript or TypeScript
43
46
 
44
47
  ```js
@@ -1,11 +1,14 @@
1
- /** The apps in the All apps list of the Start menu, which is the Apps folder of the shell. */
1
+ /**
2
+ * The apps in the All apps list of the Start menu, which is the Apps folder of the shell. On
3
+ * Linux, the apps that the app menu shows: their desktop entries.
4
+ */
2
5
  export interface AppsApi {
3
6
  /** All apps in name order. The host reads them when you call this function. */
4
7
  list(): Promise<AppInfo[]>;
5
8
  /**
6
- * Starts the app `id` as the Start menu does. It asks for the app window on the main screen,
7
- * not on the Edge. An app that keeps its last position can still open there. Rejects if the
8
- * app is gone.
9
+ * Starts the app `id` as the Start menu does. On Windows, it asks for the app window on the
10
+ * main screen, not on the Edge. An app that keeps its last position can still open there. On
11
+ * Linux, the window manager places the window. Rejects if the app is gone.
9
12
  */
10
13
  launch(id: string): Promise<void>;
11
14
  /**
@@ -20,9 +23,10 @@ export interface AppInfo {
20
23
  /**
21
24
  * The value that launches the app and draws its icon. It is the name of the app in the Apps
22
25
  * folder of the shell. This is the AppUserModelID of the app or, for a program without one,
23
- * a path to the program. It stays the same across restarts, so widgets can save it.
26
+ * a path to the program. On Linux, it is the id of the desktop entry, such as
27
+ * `firefox.desktop`. It stays the same across restarts, so widgets can save it.
24
28
  */
25
29
  id: string;
26
- /** The name that the Start menu shows. */
30
+ /** The name that the Start menu or the app menu shows. */
27
31
  name: string;
28
32
  }
@@ -1,6 +1,7 @@
1
1
  import type { Cleanup } from '../cleanup.js';
2
2
  /**
3
- * The sound of the machine, as the Windows volume mixer shows it. Nothing listens between
3
+ * The sound of the machine, as the Windows volume mixer shows it. On Linux, it comes from
4
+ * PulseAudio, which PipeWire also serves, as the sound settings show it. Nothing listens between
4
5
  * calls.
5
6
  */
6
7
  export interface AudioApi {
@@ -13,7 +14,7 @@ export interface AudioApi {
13
14
  levels(): Promise<AudioLevels>;
14
15
  /**
15
16
  * Calls `fn` when the mixer changes: a volume, a mute, the default device, or the sound of an
16
- * app when it opens, closes, starts or stops. Then read `mixer()`. Windows tells the app
17
+ * app when it opens, closes, starts or stops. Then read `mixer()`. The system tells the app
17
18
  * about changes, so nothing polls. While the page of the widget is off screen or the Edge is
18
19
  * frozen, it waits and calls `fn` once when the widget shows again. It stops on unmount, and
19
20
  * the returned function stops it earlier.
@@ -45,7 +46,7 @@ export interface AudioApi {
45
46
  * Makes the output `id` the default output, as "Set as default device" in Sound settings
46
47
  * does. Calls keep the device that the user selected for them. Resolves to `false` if the
47
48
  * device is not plugged in anymore. Windows has no public API for this, so it uses the API
48
- * of Sound settings.
49
+ * of Sound settings. On Linux, the apps that follow the default output move to it.
49
50
  */
50
51
  setOutput(id: string): Promise<boolean>;
51
52
  /**
@@ -69,7 +70,7 @@ export interface AudioMixer {
69
70
  }
70
71
  /** A sound device. */
71
72
  export interface AudioDevice {
72
- /** The Windows id of the device, as `outputs()` lists it. */
73
+ /** The Windows id of the device, or the PulseAudio name on Linux, as `outputs()` lists it. */
73
74
  id: string;
74
75
  /** The name that Sound settings shows, such as `Speakers (Realtek(R) Audio)`. */
75
76
  name: string;
@@ -77,7 +78,10 @@ export interface AudioDevice {
77
78
  volume: number;
78
79
  muted: boolean;
79
80
  }
80
- /** The sound of an app: all the sessions that the Windows volume mixer shows as one. */
81
+ /**
82
+ * The sound of an app: all the sessions that the Windows volume mixer shows as one. On Linux, all
83
+ * the streams of one executable on the default output.
84
+ */
81
85
  export interface AudioApp {
82
86
  /**
83
87
  * Identifies the sound of the app while it runs, for `setVolume` and `levels()`. It does not
@@ -86,10 +90,14 @@ export interface AudioApp {
86
90
  id: string;
87
91
  /**
88
92
  * The name that the app gives its sound. Else, the name that Task Manager shows, which is the
89
- * description of its executable. Else, the file name of its executable.
93
+ * description of its executable (on Linux, its name in the app menu). Else, the file name of
94
+ * its executable.
90
95
  */
91
96
  name: string;
92
- /** The path of its executable, for `icon()`. `null` for System sounds. */
97
+ /**
98
+ * The path of its executable, for `icon()`. `null` for System sounds, and on Linux for an app
99
+ * of another user.
100
+ */
93
101
  path: string | null;
94
102
  /**
95
103
  * The file name of its executable, such as `Discord.exe`. It identifies the app across
@@ -1,5 +1,9 @@
1
1
  export interface MediaApi {
2
- /** The session that Windows thinks is current, which the media keys control. `null` if none. */
2
+ /**
3
+ * The session that Windows thinks is current, which the media keys control. On Linux, the
4
+ * MPRIS player that plays, else the one that playerctld follows, else a paused one. `null` if
5
+ * none.
6
+ */
3
7
  current(): Promise<MediaInfo | null>;
4
8
  /** The album art of the track from the last `current()` call, as a data URL. `null` if none. */
5
9
  art(): Promise<string | null>;
@@ -8,11 +12,14 @@ export interface MediaApi {
8
12
  }
9
13
  export type MediaAction = 'play' | 'pause' | 'next' | 'previous';
10
14
  /**
11
- * A media session, as an app publishes it to Windows. The fields that the app does not set are
12
- * empty.
15
+ * A media session, as an app publishes it to Windows, or as an MPRIS player on Linux. The fields
16
+ * that the app does not set are empty.
13
17
  */
14
18
  export interface MediaInfo {
15
- /** The app that owns the session, as Windows names it (`Spotify.exe`, `MSEdge`, ...). */
19
+ /**
20
+ * The app that owns the session, as Windows names it (`Spotify.exe`, `MSEdge`, ...). On Linux,
21
+ * the desktop entry of the player (`spotify`, `firefox`, ...).
22
+ */
16
23
  app: string;
17
24
  title: string;
18
25
  artist: string;
@@ -10,7 +10,10 @@ export interface NetRate {
10
10
  */
11
11
  export interface SystemInfo {
12
12
  hostname: string;
13
- /** The name of the connected Wi-Fi network (its Windows profile name). `null` if none. */
13
+ /**
14
+ * The name of the connected Wi-Fi network: its Windows profile name, or the name of its
15
+ * NetworkManager connection on Linux. `null` if none.
16
+ */
14
17
  wifi: string | null;
15
18
  /** The load of all CPU cores, in percent. */
16
19
  cpu: {
@@ -36,7 +39,8 @@ export interface SystemInfo {
36
39
  export interface ProgramUsage {
37
40
  /**
38
41
  * The name that Task Manager shows. This is the description of its executable (`THE FINALS`,
39
- * `Google Chrome`), else the executable file name (`crashpad_handler.exe`).
42
+ * `Google Chrome`), else the executable file name (`crashpad_handler.exe`). On Linux, it is
43
+ * the name of its app in the app menu, else the executable file name.
40
44
  */
41
45
  name: string;
42
46
  /** The percent of all logical processors, as in Task Manager. */
@@ -38,6 +38,11 @@ export interface TextSetting extends SettingBase {
38
38
  default?: string;
39
39
  /** A hint that shows while the field is empty. */
40
40
  placeholder?: string;
41
+ /**
42
+ * Hides the value in the settings, as in a password field. Use it for a token or a key.
43
+ * EdgeStation saves the value as plain text in its settings file.
44
+ */
45
+ secret?: boolean;
41
46
  }
42
47
  /** The saved setting values of one placement, by key. */
43
48
  export type WidgetSettingValues = Record<string, string>;
@@ -111,6 +111,10 @@
111
111
  "type": { "const": "text" },
112
112
  "default": { "type": "string", "description": "Value until the user types one." },
113
113
  "placeholder": { "type": "string", "description": "Hint shown while the field is empty." },
114
+ "secret": {
115
+ "type": "boolean",
116
+ "description": "Hides the value in the settings, as in a password field. It is still saved as plain text."
117
+ },
114
118
  "when": { "$ref": "#/definitions/when" }
115
119
  }
116
120
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edgestation/sdk",
3
- "version": "0.5.0",
3
+ "version": "0.7.0",
4
4
  "description": "Types and build helpers to write widgets for EdgeStation, the secondary display dashboard made for the Corsair Xeneon Edge, in plain JavaScript, Svelte, React or Vue.",
5
5
  "keywords": [
6
6
  "edgestation",