Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions src/renderer/components/CommandPalette.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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
Expand Down Expand Up @@ -178,6 +223,12 @@ export function CommandPalette() {
openSettings,
openAddInstance,
reloadActiveInstance,
reloadInstance,
hibernateInstance,
wakeInstance,
activeInstanceId,
hibernatedInstances,
hibernateEnabled,
setTheme,
close,
]);
Expand Down