|
|
@@ -936,6 +936,26 @@ export default function Layout(props: ParentProps) {
|
|
|
navigateToSession(session)
|
|
|
}
|
|
|
|
|
|
+ function navigateProjectByOffset(offset: number) {
|
|
|
+ const projects = layout.projects.list()
|
|
|
+ if (projects.length === 0) return
|
|
|
+
|
|
|
+ const current = currentProject()?.worktree
|
|
|
+ const fallback = currentDir() ? projectRoot(currentDir()) : undefined
|
|
|
+ const active = current ?? fallback
|
|
|
+ const index = active ? projects.findIndex((project) => project.worktree === active) : -1
|
|
|
+
|
|
|
+ const target =
|
|
|
+ index === -1
|
|
|
+ ? offset > 0
|
|
|
+ ? projects[0]
|
|
|
+ : projects[projects.length - 1]
|
|
|
+ : projects[(index + offset + projects.length) % projects.length]
|
|
|
+ if (!target) return
|
|
|
+
|
|
|
+ openProject(target.worktree)
|
|
|
+ }
|
|
|
+
|
|
|
function navigateSessionByUnseen(offset: number) {
|
|
|
const sessions = currentSessions()
|
|
|
if (sessions.length === 0) return
|
|
|
@@ -1002,6 +1022,20 @@ export default function Layout(props: ParentProps) {
|
|
|
keybind: "mod+o",
|
|
|
onSelect: () => chooseProject(),
|
|
|
},
|
|
|
+ {
|
|
|
+ id: "project.previous",
|
|
|
+ title: language.t("command.project.previous"),
|
|
|
+ category: language.t("command.category.project"),
|
|
|
+ keybind: "mod+alt+arrowup",
|
|
|
+ onSelect: () => navigateProjectByOffset(-1),
|
|
|
+ },
|
|
|
+ {
|
|
|
+ id: "project.next",
|
|
|
+ title: language.t("command.project.next"),
|
|
|
+ category: language.t("command.category.project"),
|
|
|
+ keybind: "mod+alt+arrowdown",
|
|
|
+ onSelect: () => navigateProjectByOffset(1),
|
|
|
+ },
|
|
|
{
|
|
|
id: "provider.connect",
|
|
|
title: language.t("command.provider.connect"),
|