Skip to content

Commit 55b7374

Browse files
nedtwiggclaude
andcommitted
Wire shell dropdown to detected profiles
AppBar now dispatches shell path and args in the new-terminal event. Pond stores pending shell options via setPendingShellOpts so the terminal registry uses them when the pane mounts. The standalone app calls get_available_shells to populate the dropdown on startup. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent cb8cc52 commit 55b7374

3 files changed

Lines changed: 14 additions & 5 deletions

File tree

lib/src/components/Pond.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import {
3232
toggleSessionTodo,
3333
destroyTerminal,
3434
swapTerminals,
35+
setPendingShellOpts,
3536
type SessionStatus,
3637
} from '../lib/terminal-registry';
3738
import { resolvePanelElement, findPanelInDirection, findRestoreNeighbor, type DetachDirection } from '../lib/spatial-nav';
@@ -1690,10 +1691,17 @@ export function Pond({
16901691

16911692
// Listen for external "new terminal" requests (e.g. from the standalone AppBar)
16921693
useEffect(() => {
1693-
const handler = () => {
1694+
const handler = (e: Event) => {
16941695
const api = apiRef.current;
16951696
if (!api) return;
1697+
const detail = (e as CustomEvent).detail;
16961698
const newId = generatePaneId();
1699+
1700+
// Store shell options so getOrCreateTerminal picks them up on mount
1701+
if (detail?.shell) {
1702+
setPendingShellOpts(newId, { shell: detail.shell, args: detail.args });
1703+
}
1704+
16971705
const active = api.activePanel;
16981706
let direction: 'right' | 'below' = 'right';
16991707
if (active) {

standalone/src/AppBar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CaretDownIcon, MinusIcon, CornersOutIcon, CornersInIcon, XIcon, Termina
55
export interface ShellEntry {
66
name: string;
77
path: string;
8+
args?: string[];
89
}
910

1011
interface AppBarProps {
@@ -95,7 +96,7 @@ function ShellDropdown({ shells }: { shells: ShellEntry[] }) {
9596

9697
const handleSelect = useCallback((shell: ShellEntry) => {
9798
setOpen(false);
98-
window.dispatchEvent(new CustomEvent('mouseterm:new-terminal', { detail: { shell: shell.path } }));
99+
window.dispatchEvent(new CustomEvent('mouseterm:new-terminal', { detail: { shell: shell.path, args: shell.args } }));
99100
}, []);
100101

101102
// Close on click outside

standalone/src/main.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ async function bootstrap() {
2929
startUpdateCheck();
3030

3131
// Fetch app bar data from Rust backend
32-
const [homeDir, defaultShell] = await Promise.all([
32+
const [homeDir, detectedShells] = await Promise.all([
3333
invoke<string>("get_project_dir"),
34-
invoke<ShellEntry>("get_default_shell"),
34+
invoke<ShellEntry[]>("get_available_shells"),
3535
]);
3636
const projectDir = homeDir; // For now, project dir defaults to home
37-
const shells: ShellEntry[] = [defaultShell];
37+
const shells: ShellEntry[] = detectedShells.length > 0 ? detectedShells : [{ name: 'shell', path: '' }];
3838

3939
createRoot(document.getElementById("root")!).render(
4040
<StrictMode>

0 commit comments

Comments
 (0)