From 4001848e3727d90fdc006206ddfa8ba108b754aa Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 9 Nov 2026 08:51:43 +0000 Subject: [PATCH] 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. --- js/sidebar.js | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/js/sidebar.js b/js/sidebar.js index 4a660c1..c16ae16 100644 --- a/js/sidebar.js +++ b/js/sidebar.js @@ -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",