Add ⌘P hotkey to select the Project tab
This commit is contained in:
+8
-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: 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");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user