akanjs 3.4.0-rc.1 → 3.4.0-rc.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.
- package/index.ts +6 -1
- package/package.json +1 -1
- package/types/index.d.ts +6 -1
- package/types/vendor/@akanjs/native/packages/cli/src/config.d.ts +6 -2
- package/types/vendor/@akanjs/native/packages/cli/src/lib/permissions.d.ts +1 -1
- package/types/vendor/@akanjs/native/packages/cli/src/platforms/desktop.d.ts +2 -0
- package/types/vendor/@akanjs/native/packages/cli/src/platforms/macos.d.ts +6 -1
- package/types/vendor/@akanjs/native/packages/cli/src/platforms/macosLaunch.d.ts +7 -0
- package/types/vendor/@akanjs/native/packages/desktop/src/dispatcher.d.ts +5 -0
- package/types/vendor/@akanjs/native/packages/desktop/src/ffi.d.ts +9 -0
- package/types/vendor/@akanjs/native/packages/desktop/src/paths.d.ts +2 -1
- package/types/vendor/@akanjs/native/packages/desktop/src/plugin.d.ts +7 -0
- package/types/vendor/@akanjs/native/plugins/dock/src/index.d.ts +2 -1
- package/types/vendor/@akanjs/native/plugins/menu/src/index.d.ts +3 -3
- package/types/vendor/@akanjs/native/plugins/single-instance/src/socket.d.ts +3 -2
- package/types/vendor/@akanjs/native/plugins/tray/src/desktop.d.ts +2 -0
- package/types/vendor/@akanjs/native/plugins/window/src/desktop.d.ts +1 -0
- package/types/vendor/@akanjs/native/plugins/window/src/index.d.ts +5 -4
- package/ui/System/CSR.tsx +2 -0
- package/vendor/@akanjs/native/native/desktop/build.rs +2 -0
- package/vendor/@akanjs/native/native/desktop/src/launch_urls.rs +53 -0
- package/vendor/@akanjs/native/native/desktop/src/lib.rs +26 -3
- package/vendor/@akanjs/native/native/desktop/src/win/dock.rs +3 -2
- package/vendor/@akanjs/native/native/desktop/src/win/menu.rs +80 -20
- package/vendor/@akanjs/native/native/desktop/src/win/mod.rs +16 -2
- package/vendor/@akanjs/native/packages/cli/src/config.ts +11 -3
- package/vendor/@akanjs/native/packages/cli/src/lib/configkeys.ts +2 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/permissions.ts +11 -2
- package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +1 -0
- package/vendor/@akanjs/native/packages/cli/src/platforms/desktop.ts +23 -2
- package/vendor/@akanjs/native/packages/cli/src/platforms/macos.ts +41 -10
- package/vendor/@akanjs/native/packages/cli/src/platforms/macosLaunch.ts +100 -0
- package/vendor/@akanjs/native/packages/desktop/src/commands.ts +11 -5
- package/vendor/@akanjs/native/packages/desktop/src/dispatcher.ts +31 -21
- package/vendor/@akanjs/native/packages/desktop/src/ffi.ts +9 -0
- package/vendor/@akanjs/native/packages/desktop/src/host.ts +27 -6
- package/vendor/@akanjs/native/packages/desktop/src/main.ts +5 -1
- package/vendor/@akanjs/native/packages/desktop/src/paths.ts +3 -2
- package/vendor/@akanjs/native/packages/desktop/src/plugin.ts +4 -0
- package/vendor/@akanjs/native/plugins/dock/src/index.ts +2 -1
- package/vendor/@akanjs/native/plugins/menu/src/index.ts +3 -3
- package/vendor/@akanjs/native/plugins/single-instance/src/desktop.ts +4 -1
- package/vendor/@akanjs/native/plugins/single-instance/src/socket.ts +10 -5
- package/vendor/@akanjs/native/plugins/tray/src/desktop.ts +35 -5
- package/vendor/@akanjs/native/plugins/window/src/desktop.ts +13 -1
- package/vendor/@akanjs/native/plugins/window/src/index.ts +5 -4
package/index.ts
CHANGED
|
@@ -135,7 +135,7 @@ export type LibAssetsConfig = Pick<AkanAssetsConfig, "keepFonts">;
|
|
|
135
135
|
|
|
136
136
|
export type DatabaseMode = "single" | "multiple" | "cluster";
|
|
137
137
|
export type NativeEnv = "local" | "debug" | "develop" | "main";
|
|
138
|
-
export type NativePermission = "camera" | "contacts" | "location" | "push" | "speech";
|
|
138
|
+
export type NativePermission = "camera" | "contacts" | "location" | "microphone" | "push" | "speech";
|
|
139
139
|
|
|
140
140
|
export type AkanNativeValue = string | number | boolean | AkanNativeValue[] | { [key: string]: AkanNativeValue };
|
|
141
141
|
|
|
@@ -307,6 +307,11 @@ export interface AkanNativeDesktopConfig {
|
|
|
307
307
|
* for a native addon signed by another team. Read when the app is signed with a team (a Developer ID).
|
|
308
308
|
*/
|
|
309
309
|
entitlements?: Record<string, AkanNativeValue>;
|
|
310
|
+
/**
|
|
311
|
+
* macOS: Info.plist entries of the app, merged over the usage texts the permissions put there — e.g. the camera's and
|
|
312
|
+
* microphone's texts in the app's own language. The bundle id, executable, name and versions cannot be set.
|
|
313
|
+
*/
|
|
314
|
+
infoPlist?: Record<string, AkanNativeValue>;
|
|
310
315
|
/**
|
|
311
316
|
* macOS: the Finder window `build-desktop --installer` opens its dmg in — no toolbar or sidebar, the app's and the
|
|
312
317
|
* Applications link's icons on a background, the app's icon on the mounted disk. Without it the window is 660×400 pt
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ export interface AkanAssetsConfig {
|
|
|
120
120
|
export type LibAssetsConfig = Pick<AkanAssetsConfig, "keepFonts">;
|
|
121
121
|
export type DatabaseMode = "single" | "multiple" | "cluster";
|
|
122
122
|
export type NativeEnv = "local" | "debug" | "develop" | "main";
|
|
123
|
-
export type NativePermission = "camera" | "contacts" | "location" | "push" | "speech";
|
|
123
|
+
export type NativePermission = "camera" | "contacts" | "location" | "microphone" | "push" | "speech";
|
|
124
124
|
export type AkanNativeValue = string | number | boolean | AkanNativeValue[] | {
|
|
125
125
|
[key: string]: AkanNativeValue;
|
|
126
126
|
};
|
|
@@ -300,6 +300,11 @@ export interface AkanNativeDesktopConfig {
|
|
|
300
300
|
* for a native addon signed by another team. Read when the app is signed with a team (a Developer ID).
|
|
301
301
|
*/
|
|
302
302
|
entitlements?: Record<string, AkanNativeValue>;
|
|
303
|
+
/**
|
|
304
|
+
* macOS: Info.plist entries of the app, merged over the usage texts the permissions put there — e.g. the camera's and
|
|
305
|
+
* microphone's texts in the app's own language. The bundle id, executable, name and versions cannot be set.
|
|
306
|
+
*/
|
|
307
|
+
infoPlist?: Record<string, AkanNativeValue>;
|
|
303
308
|
/**
|
|
304
309
|
* macOS: the Finder window `build-desktop --installer` opens its dmg in — no toolbar or sidebar, the app's and the
|
|
305
310
|
* Applications link's icons on a background, the app's icon on the mounted disk. Without it the window is 660×400 pt
|
|
@@ -104,13 +104,15 @@ export interface AkanNativeConfig {
|
|
|
104
104
|
};
|
|
105
105
|
/**
|
|
106
106
|
* Permissions for web APIs used without a plugin (plugins.md C8): getUserMedia needs camera or
|
|
107
|
-
* microphone, navigator.geolocation needs location. `true` or
|
|
108
|
-
* e.g. { microphone: "Record voice notes." }. Adds the Info.plist texts and Android
|
|
107
|
+
* microphone, navigator.geolocation needs location, webkitSpeechRecognition needs speech and microphone. `true` or
|
|
108
|
+
* the usage text iOS/macOS show, e.g. { microphone: "Record voice notes." }. Adds the Info.plist texts and Android
|
|
109
|
+
* permissions.
|
|
109
110
|
*/
|
|
110
111
|
permissions?: {
|
|
111
112
|
camera?: string | true;
|
|
112
113
|
microphone?: string | true;
|
|
113
114
|
location?: string | true;
|
|
115
|
+
speech?: string | true;
|
|
114
116
|
};
|
|
115
117
|
/**
|
|
116
118
|
* Over-the-air updates (UP-2 web bundles on iOS / Android, UP-1 app updates on macOS), used by
|
|
@@ -190,6 +192,8 @@ export interface AkanNativeConfig {
|
|
|
190
192
|
* and those the usage texts ask for (the camera's, the microphone's). Read when the app is signed with a team.
|
|
191
193
|
*/
|
|
192
194
|
entitlements?: Record<string, NativeValue>;
|
|
195
|
+
/** Info.plist entries, such as usage texts in the app's language. Keys akan-native owns cannot be set. */
|
|
196
|
+
infoPlist?: Record<string, NativeValue>;
|
|
193
197
|
};
|
|
194
198
|
android?: {
|
|
195
199
|
/** XML at the <manifest> level (uses-permission, queries, …). ${applicationId} is replaced. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const PERMISSION_NAMES: readonly ["camera", "microphone", "location"];
|
|
1
|
+
export declare const PERMISSION_NAMES: readonly ["camera", "microphone", "location", "speech"];
|
|
2
2
|
export type PermissionName = (typeof PERMISSION_NAMES)[number];
|
|
3
3
|
/** `true` uses a generic usage text; a string is the text iOS and macOS show. */
|
|
4
4
|
export type PermissionsConfig = Partial<Record<PermissionName, string | true>>;
|
|
@@ -17,6 +17,8 @@ export declare function resourcesOf(os: DesktopOs, artifact: string): string;
|
|
|
17
17
|
* carry along, and a read-only install could not hold).
|
|
18
18
|
*/
|
|
19
19
|
export declare function cargoTargetDir(): string;
|
|
20
|
+
/** The paths and contents of the shell's sources. */
|
|
21
|
+
export declare function shellSourceDigest(dir?: string): string;
|
|
20
22
|
/** Builds (incrementally) the Rust cdylib and returns its path. */
|
|
21
23
|
export declare function buildNativeLibrary(os: DesktopOs, release: boolean, arch?: DesktopArch): Promise<string>;
|
|
22
24
|
/**
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { ParsedArgs } from "../lib/args.ts";
|
|
2
|
-
import type
|
|
2
|
+
import { type Launched, type LaunchOptions } from "../lib/launch.ts";
|
|
3
|
+
import { type PlistValue } from "../lib/plist.ts";
|
|
3
4
|
import type { BuildContext } from "../lib/prepare.ts";
|
|
5
|
+
import type { Project } from "../lib/project.ts";
|
|
4
6
|
export declare const MACOS_MIN = "26.0";
|
|
5
7
|
export declare function buildMacos(ctx: BuildContext): Promise<string>;
|
|
8
|
+
/** shell.json `signing`: secure-storage keeps its items in-process only under a team's signature. */
|
|
9
|
+
/** The usage texts of the plugins and app permissions, with usageDescriptions' texts, then native.macos.infoPlist. */
|
|
10
|
+
export declare function macosInfoPlistEntries({ config, plugins, }: Pick<Project, "config" | "plugins">): Record<string, PlistValue>;
|
|
6
11
|
/**
|
|
7
12
|
* Mach-O files the app carries in its server and its `bin`, whatever their names (native addons, executables, a
|
|
8
13
|
* package's own executable): nested code the bundle's signature does not sign.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type Launched, type LaunchOptions } from "../lib/launch.ts";
|
|
2
|
+
export declare function finderEnv(extra: Record<string, string>, from?: NodeJS.ProcessEnv): Record<string, string>;
|
|
3
|
+
export declare function pidsOf(psOutput: string, exe: string): number[];
|
|
4
|
+
export declare function tailLines(path: string, onLine: (line: string) => void, intervalMs?: number): {
|
|
5
|
+
stop(): void;
|
|
6
|
+
};
|
|
7
|
+
export declare function launchThroughLaunchServices(appPath: string, exe: string, opts: LaunchOptions): Launched;
|
|
@@ -18,6 +18,10 @@ export declare const SETUP_WAIT_MS = 5000;
|
|
|
18
18
|
export interface HostServices {
|
|
19
19
|
app: AppInfo;
|
|
20
20
|
dev?: boolean;
|
|
21
|
+
devServer?: {
|
|
22
|
+
url: string;
|
|
23
|
+
startPath: string;
|
|
24
|
+
} | null;
|
|
21
25
|
appDataDir: string;
|
|
22
26
|
/** paths.ts appLocalDataDir; appDataDir when not given. */
|
|
23
27
|
appLocalDataDir?: string;
|
|
@@ -45,6 +49,7 @@ export interface HostServices {
|
|
|
45
49
|
/** security.shell.externalSchemes from shell.json (L0). */
|
|
46
50
|
externalSchemes?: readonly string[];
|
|
47
51
|
openLinks?(args: readonly string[]): void;
|
|
52
|
+
openedUrls?(): Promise<string[]>;
|
|
48
53
|
quit?(code: number): void;
|
|
49
54
|
/** Quit and close sequence (lifecycle.ts). Without it, quit() ends the app at once and nothing can veto. */
|
|
50
55
|
lifecycle?: Lifecycle;
|
|
@@ -74,6 +74,10 @@ export declare const SYMBOLS: {
|
|
|
74
74
|
readonly args: readonly ["u64", "ptr"];
|
|
75
75
|
readonly returns: "void";
|
|
76
76
|
};
|
|
77
|
+
readonly akan_native_launch_urls: {
|
|
78
|
+
readonly args: readonly ["u32", "ptr", "u64"];
|
|
79
|
+
readonly returns: "u64";
|
|
80
|
+
};
|
|
77
81
|
};
|
|
78
82
|
export declare function openNative(libPath: string): import("bun:ffi").Library<{
|
|
79
83
|
readonly akan_native_abi: {
|
|
@@ -132,9 +136,14 @@ export declare function openNative(libPath: string): import("bun:ffi").Library<{
|
|
|
132
136
|
readonly args: readonly ["u64", "ptr"];
|
|
133
137
|
readonly returns: "void";
|
|
134
138
|
};
|
|
139
|
+
readonly akan_native_launch_urls: {
|
|
140
|
+
readonly args: readonly ["u32", "ptr", "u64"];
|
|
141
|
+
readonly returns: "u64";
|
|
142
|
+
};
|
|
135
143
|
}>;
|
|
136
144
|
/** The native library's last error (akan_native_last_error), or "". */
|
|
137
145
|
export declare function lastError(lib: NativeLib): string;
|
|
146
|
+
export declare function launchUrls(lib: NativeLib, timeoutMs: number): string[];
|
|
138
147
|
export type NativeLib = ReturnType<typeof openNative>;
|
|
139
148
|
/** NUL-terminated UTF-8. Native code copies it during the call, so it may be collected afterwards. */
|
|
140
149
|
export declare const cstr: (text: string) => Uint8Array<ArrayBuffer>;
|
|
@@ -34,7 +34,8 @@ export declare function serverDataDir(id: string, dev: boolean, platform?: NodeJ
|
|
|
34
34
|
/**
|
|
35
35
|
* Folders whose files no FileRef may serve (L4): the shell's and the plugins' own storage
|
|
36
36
|
* (preferences, secure storage, databases, update bundles, window state, the webview's data, the server's). Only
|
|
37
|
-
* the filesystem plugin's `data`
|
|
37
|
+
* the filesystem plugin's bases are servable inside them: `data` (<app data>/files) and, on Windows, `cache`
|
|
38
|
+
* (<local app data>/files).
|
|
38
39
|
*/
|
|
39
40
|
export declare function reservedDirs(id: string, platform?: NodeJS.Platform, env?: Env, home?: string): {
|
|
40
41
|
root: string;
|
|
@@ -19,6 +19,11 @@ export interface DesktopContext {
|
|
|
19
19
|
* start). It has the release app's id, so what it keeps apart goes in folders of its own.
|
|
20
20
|
*/
|
|
21
21
|
readonly dev: boolean;
|
|
22
|
+
/** A dev build's bundle holds only index.html: pages and public/ files come from this server, asked with startPath's query. */
|
|
23
|
+
readonly devServer: {
|
|
24
|
+
url: string;
|
|
25
|
+
startPath: string;
|
|
26
|
+
} | null;
|
|
22
27
|
/**
|
|
23
28
|
* The window whose page made this call (SH-6; 1 = the window the app opened). Only in method
|
|
24
29
|
* calls; undefined in setup and event sources.
|
|
@@ -144,6 +149,8 @@ export interface DesktopContext {
|
|
|
144
149
|
* time quits the app instead, since its window exists by then.
|
|
145
150
|
*/
|
|
146
151
|
exit(code?: number): void;
|
|
152
|
+
/** macOS delivers a launch's links as events, never arguments, so a launch that exits before its window waits for them. */
|
|
153
|
+
openedUrls(): Promise<string[]>;
|
|
147
154
|
};
|
|
148
155
|
}
|
|
149
156
|
/**
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
* - Windows: every window's taskbar button. setBadge draws the label on a red disc as the overlay
|
|
13
13
|
* icon (counts over 99 as "99+", other labels longer than 2 characters as a plain disc),
|
|
14
14
|
* setProgress is the button's progress bar in the same three colors, setVisible(false) takes
|
|
15
|
-
* the buttons away (policy "accessory"; the windows stay in Alt+Tab)
|
|
15
|
+
* the buttons away (policy "accessory"; the windows stay in Alt+Tab), and setVisible(true)
|
|
16
|
+
* gives none to a window created with skipTaskbar.
|
|
16
17
|
* - Linux: the launcher entry of the desktop file "<app id>.desktop" (the Unity LauncherEntry
|
|
17
18
|
* API, which Ubuntu's dock, Dash to Dock and KDE Plasma show): setBadge takes whole numbers
|
|
18
19
|
* only (other labels reject UNSUPPORTED), setProgress draws paused and error like normal, and
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* with the app's name). Until setAppMenu is called the app has the default menu: App, Edit and
|
|
6
6
|
* Window (D1). Keep an Edit menu (role "editMenu" or its items): without it Cmd+C/V/X/A do
|
|
7
7
|
* nothing in the page.
|
|
8
|
-
* - Windows and Linux: a menu bar in every window
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* - Windows and Linux: a menu bar in every window but an auxiliary one, from the same item
|
|
9
|
+
* tree (the bar holds only submenus there too, so one tree fits every OS). No menu bar until
|
|
10
|
+
* setAppMenu, and getAppMenu() is [] then: the webview handles Ctrl+C/V itself.
|
|
11
11
|
* CmdOrCtrl is Ctrl; Cmd is the Windows (Super) key, which Windows menus show but cannot fire.
|
|
12
12
|
* Roles: appMenu is a "File" menu with About and Exit (Windows) or Quit (Linux); editMenu,
|
|
13
13
|
* windowMenu (Minimize, Maximize, Full Screen, Close) and helpMenu (only with items) are the
|
|
@@ -53,13 +53,14 @@ type Lock = {
|
|
|
53
53
|
* and every later launch would hand its message to nobody and exit.
|
|
54
54
|
*/
|
|
55
55
|
export declare function lockFile(path: string): Lock;
|
|
56
|
+
export type Handover = SecondInstance | (() => Promise<SecondInstance>);
|
|
56
57
|
/**
|
|
57
58
|
* Becomes the running instance, or hands `message` to the one that is.
|
|
58
59
|
* A running instance that does not acknowledge within `timeoutMs` (hung) still counts:
|
|
59
60
|
* starting a second window next to it is what the plugin exists to prevent.
|
|
60
61
|
*/
|
|
61
|
-
export declare function claim(path: string, message:
|
|
62
|
-
export declare function claimPipe(path: string, message:
|
|
62
|
+
export declare function claim(path: string, message: Handover, onMessage: (m: SecondInstance) => void, timeoutMs?: number): Promise<Claim>;
|
|
63
|
+
export declare function claimPipe(path: string, message: Handover, onMessage: (m: SecondInstance) => void, timeoutMs: number, hold?: (path: string) => HeldPipe | null, account?: () => string | null): Promise<Claim>;
|
|
63
64
|
/** The lock and socket need a folder of this user's alone: another user's could block the app or read its arguments. */
|
|
64
65
|
export declare function privateFolder(dir: string, uid?: number): string | Error;
|
|
65
66
|
export {};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { type DesktopContext } from "../../../packages/desktop/src/plugin.ts";
|
|
1
2
|
import type { TrayApi, TrayEvents } from "./index.ts";
|
|
3
|
+
export declare function devIcon(icon: unknown, ctx: Pick<DesktopContext, "devServer" | "registerFile" | "onQuit">): Promise<unknown>;
|
|
2
4
|
declare const _default: import("../../../packages/desktop/src/plugin.ts").DesktopPlugin<TrayApi, TrayEvents>;
|
|
3
5
|
export default _default;
|
|
@@ -5,5 +5,6 @@ import type { DragDropEvent, PlaceOnDisplayOptions, WindowApi, WindowEvents } fr
|
|
|
5
5
|
export declare function droppedFiles(ctx: Pick<DesktopContext, "registerFile">, paths: string[]): NonNullable<DragDropEvent["files"]>;
|
|
6
6
|
export declare function displayOf(displays: Display[], args: PlaceOnDisplayOptions | undefined): Display;
|
|
7
7
|
export declare function placement(display: Display, args: PlaceOnDisplayOptions | undefined): Record<string, unknown>;
|
|
8
|
+
export declare function devPath(path: string, devServer: DesktopContext["devServer"]): string;
|
|
8
9
|
declare const _default: import("../../../packages/desktop/src/plugin.ts").DesktopPlugin<WindowApi, WindowEvents>;
|
|
9
10
|
export default _default;
|
|
@@ -51,15 +51,16 @@ export interface CreateWindowOptions {
|
|
|
51
51
|
shadow?: boolean;
|
|
52
52
|
alwaysOnTop?: boolean;
|
|
53
53
|
/**
|
|
54
|
-
* No taskbar button. Windows
|
|
55
|
-
* about Alt+Tab too. macOS has no taskbar.
|
|
54
|
+
* No taskbar button. On Windows it is a tool window, so it is not in Alt+Tab either and a title bar is the thinner
|
|
55
|
+
* tool-window one; on Linux it is a hint, and the window manager decides about Alt+Tab too. macOS has no taskbar.
|
|
56
56
|
*/
|
|
57
57
|
skipTaskbar?: boolean;
|
|
58
58
|
/** False: the window stays hidden after its page has loaded, until `show()`, so the page can place it first. */
|
|
59
59
|
visible?: boolean;
|
|
60
60
|
/**
|
|
61
61
|
* False: a click does not make it the window that takes the keyboard. On macOS a click may still bring the app
|
|
62
|
-
* forward, since the window is not a non-activating panel.
|
|
62
|
+
* forward, since the window is not a non-activating panel. On Windows only opening and showing it leave the keyboard
|
|
63
|
+
* where it was: a click into its page takes it, since WebView2 activates the window it is in.
|
|
63
64
|
*/
|
|
64
65
|
focusable?: boolean;
|
|
65
66
|
/** On every Space or virtual desktop (macOS, Linux). Windows has no such window, so there it is left out. */
|
|
@@ -67,7 +68,7 @@ export interface CreateWindowOptions {
|
|
|
67
68
|
/**
|
|
68
69
|
* A companion to the app's windows rather than one of them: closing the last other window quits or hides as if this
|
|
69
70
|
* one were not there, the Dock and a second launch bring forward another window, macOS leaves it out of the Window
|
|
70
|
-
* menu, and Linux
|
|
71
|
+
* menu, and Windows and Linux give it no app menu bar.
|
|
71
72
|
*/
|
|
72
73
|
auxiliary?: boolean;
|
|
73
74
|
}
|
package/ui/System/CSR.tsx
CHANGED
|
@@ -35,6 +35,7 @@ import { RenderLayer } from "../../webkit/RenderLayer";
|
|
|
35
35
|
import { animated } from "../animated";
|
|
36
36
|
|
|
37
37
|
import { FontFace } from "../FontFace";
|
|
38
|
+
import { frameSlotStyles } from "../Layout/frameSlot";
|
|
38
39
|
import LoadPage from "../Load/Page";
|
|
39
40
|
import { Client, ClientPathWrapper } from "./Client";
|
|
40
41
|
import { getFrameCssVars, ManifestLink, type ProviderProps } from "./Common";
|
|
@@ -385,6 +386,7 @@ const CSRFrameSlotTargets = ({ slot }: { slot: FrameSlotTarget }) => {
|
|
|
385
386
|
style={
|
|
386
387
|
{
|
|
387
388
|
...getFrameCssVars(location.pathRoute.pageState, { cssResolved: false }),
|
|
389
|
+
...(slot === "keyboardInset" ? {} : { visibility: frameSlotStyles[slot].visibility }),
|
|
388
390
|
...(ownBar ? { top: 0, height: topHeight } : {}),
|
|
389
391
|
...(style ?? {}),
|
|
390
392
|
zIndex: pageType === "pending" ? -1 : zIndex,
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
fn main() {
|
|
9
9
|
println!("cargo:rerun-if-changed=build.rs");
|
|
10
|
+
//? The cfg the CLI passes with `cargo rustc` (desktop.ts buildNativeLibrary), declared so rustc does not warn about it.
|
|
11
|
+
println!("cargo:rustc-check-cfg=cfg(akan_native_shell, values(any()))");
|
|
10
12
|
let windows = std::env::var("CARGO_CFG_TARGET_OS").as_deref() == Ok("windows");
|
|
11
13
|
let msvc = std::env::var("CARGO_CFG_TARGET_ENV").as_deref() == Ok("msvc");
|
|
12
14
|
if windows && msvc {
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
//! The links a launch was opened with on macOS, for a second instance that hands them to the running one and exits.
|
|
2
|
+
//! LaunchServices delivers a link as an open-URL event once the event loop runs, never as an argument, and a second
|
|
3
|
+
//! instance exits before akan_native_run (single-instance's gate phase), so it runs a windowless loop of its own here.
|
|
4
|
+
|
|
5
|
+
use std::sync::OnceLock;
|
|
6
|
+
use std::time::Duration;
|
|
7
|
+
|
|
8
|
+
static URLS: OnceLock<String> = OnceLock::new();
|
|
9
|
+
|
|
10
|
+
/// A JSON array of the links, collected once: a process builds a single event loop, so a later call answers the same.
|
|
11
|
+
pub fn collect(timeout: Duration) -> &'static str {
|
|
12
|
+
URLS.get_or_init(|| {
|
|
13
|
+
let urls = run(timeout);
|
|
14
|
+
let list: Vec<String> = urls.iter().map(|u| crate::json::quote(u)).collect();
|
|
15
|
+
format!("[{}]", list.join(","))
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[cfg(target_os = "macos")]
|
|
20
|
+
fn run(timeout: Duration) -> Vec<String> {
|
|
21
|
+
use std::time::Instant;
|
|
22
|
+
use tao::{
|
|
23
|
+
event::{Event, StartCause},
|
|
24
|
+
event_loop::{ControlFlow, EventLoopBuilder},
|
|
25
|
+
platform::{
|
|
26
|
+
macos::{ActivationPolicy, EventLoopExtMacOS},
|
|
27
|
+
run_return::EventLoopExtRunReturn,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
let mut event_loop = EventLoopBuilder::new().build();
|
|
31
|
+
//? No Dock icon and no activation: the instance shows nothing before it leaves.
|
|
32
|
+
event_loop.set_activation_policy(ActivationPolicy::Prohibited);
|
|
33
|
+
event_loop.set_activate_ignoring_other_apps(false);
|
|
34
|
+
let deadline = Instant::now() + timeout;
|
|
35
|
+
let mut urls = Vec::new();
|
|
36
|
+
event_loop.run_return(|event, _, control_flow| {
|
|
37
|
+
*control_flow = ControlFlow::WaitUntil(deadline);
|
|
38
|
+
match event {
|
|
39
|
+
Event::Opened { urls: opened } => {
|
|
40
|
+
urls.extend(opened.iter().map(|u| u.to_string()));
|
|
41
|
+
*control_flow = ControlFlow::Exit;
|
|
42
|
+
}
|
|
43
|
+
Event::NewEvents(StartCause::ResumeTimeReached { .. }) => *control_flow = ControlFlow::Exit,
|
|
44
|
+
_ => {}
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
urls
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[cfg(not(target_os = "macos"))]
|
|
51
|
+
fn run(_timeout: Duration) -> Vec<String> {
|
|
52
|
+
Vec::new()
|
|
53
|
+
}
|
|
@@ -18,6 +18,7 @@ mod contract;
|
|
|
18
18
|
mod devproxy;
|
|
19
19
|
mod external;
|
|
20
20
|
mod json;
|
|
21
|
+
mod launch_urls;
|
|
21
22
|
mod navigation;
|
|
22
23
|
mod page_menu;
|
|
23
24
|
mod placement;
|
|
@@ -512,6 +513,21 @@ pub unsafe extern "C" fn akan_native_unregister_file(id: *const c_char) -> u8 {
|
|
|
512
513
|
u8::from(FILES.lock().unwrap().remove(&id).is_some())
|
|
513
514
|
}
|
|
514
515
|
|
|
516
|
+
/// The links this launch was opened with, as a JSON array (UTF-8, not NUL-terminated) copied into `buf`; returns its full
|
|
517
|
+
/// length. macOS runs a windowless event loop for up to `timeout_ms` the first time; elsewhere a link is an argument.
|
|
518
|
+
/// Only for a launch that exits without akan_native_run, which could not build its event loop after this one.
|
|
519
|
+
///
|
|
520
|
+
/// # Safety
|
|
521
|
+
/// `buf` must hold `cap` writable bytes (or be null with `cap` 0).
|
|
522
|
+
#[no_mangle]
|
|
523
|
+
pub unsafe extern "C" fn akan_native_launch_urls(timeout_ms: u32, buf: *mut u8, cap: usize) -> usize {
|
|
524
|
+
let text = launch_urls::collect(Duration::from_millis(u64::from(timeout_ms)));
|
|
525
|
+
if !buf.is_null() {
|
|
526
|
+
std::ptr::copy_nonoverlapping(text.as_ptr(), buf, text.len().min(cap));
|
|
527
|
+
}
|
|
528
|
+
text.len()
|
|
529
|
+
}
|
|
530
|
+
|
|
515
531
|
/// Ends the app. Also the host's "yes" to a quit request (quitRequested).
|
|
516
532
|
#[no_mangle]
|
|
517
533
|
pub extern "C" fn akan_native_quit(code: i32) {
|
|
@@ -523,7 +539,7 @@ pub extern "C" fn akan_native_quit(code: i32) {
|
|
|
523
539
|
/// shutdown. For other quit requests the shell already said no to AppKit, so this does nothing.
|
|
524
540
|
/// The C ABI version (docs/architecture.md §9): major << 16 | minor. main.ts refuses a library of
|
|
525
541
|
/// another major version right after loading it.
|
|
526
|
-
pub const ABI: u32 =
|
|
542
|
+
pub const ABI: u32 = 3; // 0.3: akan_native_launch_urls
|
|
527
543
|
|
|
528
544
|
#[no_mangle]
|
|
529
545
|
pub extern "C" fn akan_native_abi() -> u32 {
|
|
@@ -1487,6 +1503,7 @@ fn open_window(target: &EventLoopWindowTarget<UserEvent>, shell: &Shell, context
|
|
|
1487
1503
|
.with_decorations(!opts.frameless)
|
|
1488
1504
|
.with_always_on_top(opts.always_on_top)
|
|
1489
1505
|
.with_focusable(!opts.unfocusable)
|
|
1506
|
+
.with_focused(!opts.unfocusable)
|
|
1490
1507
|
.with_visible_on_all_workspaces(opts.all_workspaces)
|
|
1491
1508
|
.with_window_icon(shell.icon.clone());
|
|
1492
1509
|
builder = if opts.transparent { builder.with_transparent(true) } else { builder.with_background_color(background) };
|
|
@@ -1534,6 +1551,11 @@ fn open_window(target: &EventLoopWindowTarget<UserEvent>, shell: &Shell, context
|
|
|
1534
1551
|
builder = builder.with_skip_taskbar(true);
|
|
1535
1552
|
}
|
|
1536
1553
|
let window = builder.build(target).map_err(|e| format!("window: {e}"))?;
|
|
1554
|
+
#[cfg(target_os = "windows")]
|
|
1555
|
+
if !opts.fullscreen {
|
|
1556
|
+
let (w, h) = placed.map_or((width, height), |r| (r.width, r.height));
|
|
1557
|
+
win::refit(&window, w, h);
|
|
1558
|
+
}
|
|
1537
1559
|
// Windows and Linux: the system theme is known once a window exists (tao reads it then).
|
|
1538
1560
|
#[cfg(not(target_os = "macos"))]
|
|
1539
1561
|
if !opts.transparent && window_theme(&window) == tao::window::Theme::Dark && background != shell.colors.dark {
|
|
@@ -1565,7 +1587,8 @@ fn open_window(target: &EventLoopWindowTarget<UserEvent>, shell: &Shell, context
|
|
|
1565
1587
|
// Linux: the scheme belongs to the shared context, so the first window registers it for all;
|
|
1566
1588
|
// the handler tells windows apart by the webview id it is given (Windows::web_context).
|
|
1567
1589
|
let register_scheme = !context.is_custom_protocol_registered("app");
|
|
1568
|
-
|
|
1590
|
+
//? wry moves the focus into a new webview, which activates its window whatever WS_EX_NOACTIVATE says.
|
|
1591
|
+
let mut builder = WebViewBuilder::new_with_web_context(context).with_focused(!opts.unfocusable);
|
|
1569
1592
|
// `akan-native test` (dev builds only): WebKit suspends a page whose window is covered by other apps
|
|
1570
1593
|
// (visibilityState "hidden"), which stalled the self-test at the first sheet whenever the test
|
|
1571
1594
|
// window opened behind the user's work. WRY sets WKPreferences.inactiveSchedulingPolicy (macOS 14+).
|
|
@@ -1718,7 +1741,7 @@ fn open_window(target: &EventLoopWindowTarget<UserEvent>, shell: &Shell, context
|
|
|
1718
1741
|
#[cfg(target_os = "linux")]
|
|
1719
1742
|
linux::window_opened(id, &window, &opts);
|
|
1720
1743
|
#[cfg(target_os = "windows")]
|
|
1721
|
-
win::window_opened(id, &window, &webview);
|
|
1744
|
+
win::window_opened(id, &window, &webview, &opts);
|
|
1722
1745
|
// Show the window even if the page never finishes loading.
|
|
1723
1746
|
std::thread::spawn(move || {
|
|
1724
1747
|
std::thread::sleep(Duration::from_millis(3000));
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
//! numbers over 99 as "99+", longer text as a plain disc
|
|
5
5
|
//! dock.setProgress → the button's progress bar (SetProgressState/SetProgressValue): normal
|
|
6
6
|
//! green, paused yellow, error red, as on macOS
|
|
7
|
-
//! dock.setVisible → the windows' taskbar buttons (ITaskbarList::DeleteTab/AddTab)
|
|
7
|
+
//! dock.setVisible → the windows' taskbar buttons (ITaskbarList::DeleteTab/AddTab), but for
|
|
8
|
+
//! windows created with skipTaskbar, which never have one
|
|
8
9
|
//! dock.getState
|
|
9
10
|
//!
|
|
10
11
|
//! Every window has a button of its own, so the state is applied to each, and again when a button
|
|
@@ -210,7 +211,7 @@ pub fn shell_op(op: &str, cmd: &V) -> Option<Result<String, String>> {
|
|
|
210
211
|
let state = STATE.with(|s| s.borrow().clone());
|
|
211
212
|
if let Some(shown) = changed {
|
|
212
213
|
let list = taskbar();
|
|
213
|
-
for hwnd in super::menu::
|
|
214
|
+
for hwnd in super::menu::taskbar_hwnds() {
|
|
214
215
|
if let (true, Some(list)) = (shown, &list) {
|
|
215
216
|
unsafe {
|
|
216
217
|
let _ = list.AddTab(hwnd);
|