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
+9 -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) {
const crumb = h("button", { class: "crumb", title: "Switch task (⌘K)" });
@@ -26,10 +26,17 @@ export function mountNavbar(root) {
replace(root, h("a", { href: "#/", class: "brand" }, "byre"), crumb, h("span", { class: "spacer" }), status, settings, connLabel, conn, me);
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");
}
});
}
function openSwitcher() {
+1 -1
View File
File diff suppressed because one or more lines are too long