fix(electrobun): no double dialog on cancel, browser closes on select + max-height
- pickDirectory: removed Electrobun fallback on zenity cancel (was causing second dialog to appear). Cancel = return null, no fallback. - PathBrowser: handleBrowserSelect closes browser after selection - PathBrowser container: max-height 16rem with overflow scroll + border
This commit is contained in:
parent
d444e8aecd
commit
0d163f77e8
2 changed files with 6 additions and 14 deletions
|
|
@ -133,24 +133,15 @@ const rpc = BrowserView.defineRPC<PtyRPCSchema>({
|
|||
try {
|
||||
const { execSync } = await import("child_process");
|
||||
const start = startingFolder?.replace(/^~/, process.env.HOME || "/home") || process.env.HOME || "/home";
|
||||
// zenity --file-selection --directory gives a proper "Select Folder" dialog
|
||||
// with dark theme support, dirs sorted first, and correct title
|
||||
const result = execSync(
|
||||
`zenity --file-selection --directory --title="Select Project Folder" --filename="${start}/"`,
|
||||
{ encoding: "utf-8", timeout: 120_000 }
|
||||
).trim();
|
||||
return { path: result || null };
|
||||
} catch {
|
||||
// User cancelled or zenity not found — try Electrobun fallback
|
||||
try {
|
||||
const paths = await Utils.openFileDialog({
|
||||
startingFolder: startingFolder || "~/",
|
||||
canChooseFiles: false,
|
||||
canChooseDirectory: true,
|
||||
allowsMultipleSelection: false,
|
||||
});
|
||||
return { path: paths?.[0] ?? null };
|
||||
} catch { return { path: null }; }
|
||||
} catch (e: any) {
|
||||
// zenity exits with code 1 on cancel, code 5 if not found
|
||||
// Do NOT fall back to Electrobun dialog — just return null
|
||||
return { path: null };
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue