Add ⌘P hotkey to select the Project tab
This commit is contained in:
Vendored
+9
-2
@@ -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() {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user