refactor: bind Q through extension keybindings instead of a global keydown handler

Makes the shortcut visible and rebindable in the Keybinding panel. Ctrl+Q and Alt+R keep using the keydown handler for now.
This commit is contained in:
Claude
2026-11-09 08:51:43 +00:00
parent 0733d001f3
commit 4001848e37
+9 -13
View File
@@ -3,7 +3,7 @@ import { SettingIds } from "./core/constants.js";
import { injectStyles } from "./utils/styles.js";
import { setupDragAndDrop } from "./utils/dragdrop.js";
import { renumberNodesTopologically, setManualNodeId } from "./utils/nodeRenumber.js";
import { findOurSidebarButton, applySidebarOverride } from "./comfy/adapter.js";
import { applySidebarOverride } from "./comfy/adapter.js";
import { syncAllNodeBadges, setupVueNodeObserver, toggleIgnoreActiveNode } from "./comfy/nodes.js";
import { applyClassicLayout, setupPropertiesPanelToggleFix, syncClassicLayout, syncStockHistoryAndProgressSettings, destroyLayoutFix } from "./comfy/layout.js";
import { initSessionAndHistory, syncQueue } from "./queue/queueService.js";
@@ -30,18 +30,6 @@ function setupKeydownShortcuts() {
activeEl.tagName === "SELECT"
)) return;
// Q: Toggle Queue Sidebar
if (e.key.toLowerCase() === "q" && !e.ctrlKey && !e.metaKey && !e.shiftKey) {
e.preventDefault();
e.stopPropagation();
if (app.extensionManager?.command?.hasCommand?.("Workspace.ToggleSidebarTab.classic-comfy-sidebar")) {
app.extensionManager.command.execute("Workspace.ToggleSidebarTab.classic-comfy-sidebar");
} else {
const ourBtn = findOurSidebarButton();
if (ourBtn) ourBtn.click();
}
}
// Ctrl+Q / Cmd+Q: Toggle Ignore Selected Node
if (e.key.toLowerCase() === "q" && (e.ctrlKey || e.metaKey) && !e.shiftKey) {
e.preventDefault();
@@ -293,6 +281,14 @@ app.registerExtension({
registerSettings();
},
// Plain Q toggles the Queue tab through the frontend keybinding system (rebindable in Settings > Keybinding).
keybindings: [
{
combo: { key: "q" },
commandId: "Workspace.ToggleSidebarTab.classic-comfy-sidebar"
}
],
commands: [
{
id: "ComfySidebar.ToggleIgnoreNode",