Add ⌘P hotkey to select the Project tab

This commit is contained in:
Ian Gulliver
2026-10-15 11:49:18 -07:00
parent d3d9c804e9
commit f5e5dd30e3
4 changed files with 19 additions and 6 deletions
+8 -2
View File
@@ -1,7 +1,7 @@
import { post } from "./api.js";
import { errorText, h, replace, showAlert } from "./dom.js";
import { openSettings } from "./settings.js";
import { activeTasks, currentSession, findTask, focusedProject, focusProject, focusTask, lastVisits, onEach, state } from "./state.js";
import { activeTasks, currentSession, findTask, focusedProject, focusProject, focusTab, focusTask, lastVisits, onEach, state } from "./state.js";
import { openStatus } from "./status.js";
export function mountNavbar(root: HTMLElement): void {
@@ -34,9 +34,15 @@ export function mountNavbar(root: HTMLElement): void {
render();
addEventListener("keydown", (e) => {
if (e.key === "k" && (e.metaKey || e.ctrlKey) && !document.querySelector("dialog[open]")) {
if (!(e.metaKey || e.ctrlKey) || document.querySelector("dialog[open]")) {
return;
}
if (e.key === "k") {
e.preventDefault();
openSwitcher();
} else if (e.key === "p") {
e.preventDefault();
focusTab("project");
}
});
}