Open script service URLs in-app or external
Adds a Service URLs setting (ask / in-Paseo / external browser) that controls where URLs from running scripts open on desktop. First click prompts with a "don't ask again" checkbox; in-Paseo opens a workspace browser tab. Closing a browser tab now clears its session partition.
This commit is contained in:
@@ -7,6 +7,11 @@ interface AskOptions {
|
||||
kind?: "info" | "warning" | "error";
|
||||
}
|
||||
|
||||
interface AskWithCheckboxOptions extends AskOptions {
|
||||
checkboxLabel: string;
|
||||
checkboxChecked?: boolean;
|
||||
}
|
||||
|
||||
interface OpenOptions {
|
||||
title?: string;
|
||||
defaultPath?: string;
|
||||
@@ -35,6 +40,27 @@ export function registerDialogHandlers(): void {
|
||||
return result.response === 1;
|
||||
});
|
||||
|
||||
ipcMain.handle(
|
||||
"paseo:dialog:askWithCheckbox",
|
||||
async (event, message: string, options: AskWithCheckboxOptions) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
const result = await dialog.showMessageBox(win ?? BrowserWindow.getFocusedWindow()!, {
|
||||
type: resolveDialogType(options.kind),
|
||||
title: options.title ?? "Confirm",
|
||||
message,
|
||||
buttons: [options.cancelLabel ?? "Cancel", options.okLabel ?? "OK"],
|
||||
defaultId: 1,
|
||||
cancelId: 0,
|
||||
checkboxLabel: options.checkboxLabel,
|
||||
checkboxChecked: options.checkboxChecked ?? false,
|
||||
});
|
||||
return {
|
||||
confirmed: result.response === 1,
|
||||
dontAskAgain: result.checkboxChecked,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
ipcMain.handle("paseo:dialog:open", async (event, options?: OpenOptions) => {
|
||||
const win = BrowserWindow.fromWebContents(event.sender);
|
||||
const properties: Electron.OpenDialogOptions["properties"] = [];
|
||||
|
||||
Reference in New Issue
Block a user