37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { defineSettings } from "@getpaseo/plugin";
|
|
import { z } from "zod";
|
|
|
|
export const pickerSchema = z.object({
|
|
// Which program draws the folder picker on the host. "auto" tries the
|
|
// desktop's own picker first, then the XDG portal dialog.
|
|
picker: z
|
|
.enum(["auto", "kdialog", "zenity", "yad", "portal", "osascript", "powershell", "custom"])
|
|
.default("auto"),
|
|
// Used only when picker is "custom". The command runs in a shell on the
|
|
// host and must print the chosen folder to stdout. {dir} is replaced with
|
|
// the start folder.
|
|
customCommand: z.string().default(""),
|
|
// Folder the picker starts in. Empty means the home folder on the host.
|
|
startDir: z.string().default(""),
|
|
// Title shown by the file browser dialog.
|
|
prompt: z.string().default("Select project folder"),
|
|
});
|
|
|
|
export type PickerSettings = z.output<typeof pickerSchema>;
|
|
|
|
// Host scope: the picker runs on the machine running the daemon, so the
|
|
// choice belongs to that host, not to each connected client.
|
|
export const pickerSettings = defineSettings({
|
|
id: "picker",
|
|
scope: "host",
|
|
version: 1,
|
|
schema: pickerSchema,
|
|
});
|
|
|
|
export const defaultPickerSettings: PickerSettings = {
|
|
picker: "auto",
|
|
customCommand: "",
|
|
startDir: "",
|
|
prompt: "Select project folder",
|
|
};
|