diff --git a/src/renderer/components/CommandPalette.tsx b/src/renderer/components/CommandPalette.tsx index ec8afce..be249ca 100644 --- a/src/renderer/components/CommandPalette.tsx +++ b/src/renderer/components/CommandPalette.tsx @@ -58,8 +58,15 @@ export function CommandPalette() { const openAccountManager = useNexus((s) => s.openAccountManager); const setTheme = useNexus((s) => s.setTheme); const reloadActiveInstance = useNexus((s) => s.reloadActiveInstance); + const reloadInstance = useNexus((s) => s.reloadInstance); + const hibernateInstance = useNexus((s) => s.hibernateInstance); + const wakeInstance = useNexus((s) => s.wakeInstance); const setInstanceMuted = useNexus((s) => s.setInstanceMuted); const lockProfile = useNexus((s) => s.lockProfile); + const activeInstanceId = useNexus((s) => s.state.activeInstanceId); + const hibernatedInstances = useNexus((s) => s.hibernatedInstances); + const hibernateEnabled = + useNexus((s) => s.state.hibernateAfterMinutes) !== undefined; const [query, setQuery] = useState(''); const [selected, setSelected] = useState(0); @@ -75,6 +82,7 @@ export function CommandPalette() { // Instances — jump shortcuts for (const inst of instances) { const mod = modules.find((m) => m.manifest.id === inst.moduleId); + const isHibernated = hibernatedInstances[inst.id] === true; cmds.push({ id: `jump:${inst.id}`, title: inst.name, @@ -95,6 +103,43 @@ export function CommandPalette() { close(); }, }); + cmds.push({ + id: `reload:${inst.id}`, + title: `Reload ${inst.name}`, + hint: 'Refresh this instance without switching to it', + icon: '🔄', + run: () => { + reloadInstance(inst.id).catch(() => {}); + close(); + }, + }); + // Hibernate / Wake commands only appear when the feature is on, + // and they're mutually exclusive based on current state. + if (hibernateEnabled) { + if (isHibernated) { + cmds.push({ + id: `wake:${inst.id}`, + title: `Wake ${inst.name}`, + hint: 'Recreate the view in the background', + icon: '☀️', + run: () => { + wakeInstance(inst.id).catch(() => {}); + close(); + }, + }); + } else if (inst.id !== activeInstanceId) { + cmds.push({ + id: `hibernate:${inst.id}`, + title: `Hibernate ${inst.name}`, + hint: 'Free this instance’s memory now', + icon: '💤', + run: () => { + hibernateInstance(inst.id).catch(() => {}); + close(); + }, + }); + } + } } // Profiles @@ -178,6 +223,12 @@ export function CommandPalette() { openSettings, openAddInstance, reloadActiveInstance, + reloadInstance, + hibernateInstance, + wakeInstance, + activeInstanceId, + hibernatedInstances, + hibernateEnabled, setTheme, close, ]);