Compare commits

..
Author SHA1 Message Date
Claude eda45eaa6f docs: Queue overview with batch widget pointer and Ctrl actions; mention Move to Outputs in README 2026-11-22 19:20:13 +00:00
Claude 8310c95f95 docs: add Gallery controls overview image to the README 2026-11-22 15:16:09 +00:00
Claude 43cd6660ae docs: refresh Queue controls overview (new header buttons, accurate pointers) 2026-11-22 15:06:37 +00:00
m0rtus59 99f1dcf2e4 Merge pull request #17 from m0rtus59/fix/gallery-toggle-register-unregister
Fix 'Enable Output Gallery Sidebar' toggle
2026-11-22 18:52:20 +05:00
Claude 22b2fdc748 Fix 'Enable Output Gallery Sidebar' toggle: register/unregister the tab instead of hiding its button
The setting hid the tab button by scanning the sidebar DOM for the first button
whose data-tab-id, title or icon looked like the gallery, once, and (on startup)
after a fixed 50ms. The sidebar renders asynchronously and re-renders on its own,
so the button reappeared after reload, and the loose match could hide a different
tab's button. Now the tab is registered only while the setting is on and
unregistered when it is turned off, so state no longer depends on DOM timing.
A disabled gallery also no longer builds its view at startup.
2026-11-22 09:54:00 +00:00
m0rtus59 398c8c4adc Merge pull request #16 from m0rtus59/feature/about-version-badge
Show ComfySidebar build version in About panel
2026-11-19 22:07:51 +05:00
m0rtus59 2b265aaf40 Fix version string parsing 2026-11-19 21:56:36 +05:00
m0rtus59 9567209ce4 Fix pyproject version parsing 2026-11-19 21:56:29 +05:00
m0rtus59 a83c0f82ea Show build version in ComfyUI About panel 2026-11-19 21:56:15 +05:00
m0rtus59 a13030b96b Expose extension version and commit metadata 2026-11-19 21:56:13 +05:00
5 changed files with 113 additions and 42 deletions
+3 -1
View File
@@ -10,7 +10,7 @@ A compact and powerful layout overhaul for ComfyUI that makes generation results
* **Left or right side:** Choose which side the sidebar appears on in ComfyUI settings.
* **Simplified mouse-friendly workflow** with drag-and-drop support and convenient actions for moving results back into the workflow, opening files, and managing outputs. Hold `Ctrl` for extra actions such as opening an image's location or deleting it directly from your device.
* **Simplified mouse-friendly workflow** with drag-and-drop support and convenient actions for moving results back into the workflow, opening files, and managing outputs. Hold `Ctrl` for extra actions such as opening an image's location, deleting it directly from your device, or moving a temporary image to your Outputs folder.
<img src="assets/controls.png" alt="ComfySidebar controls overview">
@@ -20,6 +20,8 @@ A compact and powerful layout overhaul for ComfyUI that makes generation results
* **Output Gallery sidebar:** Browse files and subfolders directly from your ComfyUI `output` directory without leaving the interface. Features dedicated cards for images, videos, audio, and 3D assets (`.glb`/`.gltf`), breadcrumb navigation, filename and prompt metadata search across subfolders, and persistent sorting.
<img src="assets/gallery.png" alt="ComfySidebar Gallery controls overview">
* **Hotkeys on any keyboard layout:** Shortcuts such as `Q`, `Ctrl+Q` and `Alt+R` keep working while a non-Latin layout (for example Russian) is active. Non-Latin keys are treated as the Latin key in the same physical position, and typing in text fields is not affected. Can be turned off with **Fix non-ASCII keybinds** in the settings.
* **Runtime preview mode** combined with workflow overview makes ComfyUI practical for running and monitoring workflows in a more streamlined, queue-oriented way.
+41
View File
@@ -2,6 +2,7 @@ import asyncio
import filecmp
import os
import platform
import re
import shutil
import subprocess
import sys
@@ -290,6 +291,46 @@ _LOCALES_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "locale
_ALLOWED_LOCALE_FILES = {"main.json", "settings.json"}
def _get_extension_build_info():
"""Read the package version and the checked-out Git commit for the About panel."""
version = "unknown"
commit = "unknown"
try:
pyproject_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "pyproject.toml")
with open(pyproject_path, "r", encoding="utf-8") as f:
pyproject = f.read()
project_match = re.search(r"(?ms)^\[project\]\s*(.*?)(?=^\[|\Z)", pyproject)
if project_match:
version_match = re.search(r'(?m)^\s*version\s*=\s*"([^"]+)"', project_match.group(1))
if version_match:
version = version_match.group(1)
except (OSError, UnicodeError):
pass
try:
result = subprocess.run(
["git", "rev-parse", "--short=7", "HEAD"],
cwd=os.path.dirname(os.path.realpath(__file__)),
capture_output=True,
text=True,
check=True,
timeout=2
)
candidate = result.stdout.strip()
if re.fullmatch(r"[0-9a-fA-F]{7,40}", candidate):
commit = candidate[:7]
except (OSError, subprocess.SubprocessError):
pass
return {"version": version, "commit": commit}
@PromptServer.instance.routes.get("/comfy-sidebar/version")
async def version_handler(request):
return web.json_response(_get_extension_build_info())
@PromptServer.instance.routes.get("/comfy-sidebar/locales/{lang}/{filename}")
async def locale_file_handler(request):
lang = request.match_info.get("lang", "").strip()
Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 KiB

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

+69 -41
View File
@@ -19,6 +19,28 @@ import { getScrollContainer } from "./utils/utils.js";
import { store } from "./core/store.js";
import { getSetting, setSetting } from "./core/settings.js";
// The About panel supports extension-provided badges. Resolve build metadata before
// registering the extension so the badge is part of its initial registration.
let aboutPageBadges = [];
try {
const response = await fetch("/comfy-sidebar/version", { cache: "no-store" });
if (response.ok) {
const { version, commit } = await response.json();
if (version && version !== "unknown") {
const hasCommit = typeof commit === "string" && /^[0-9a-f]{7}$/i.test(commit);
aboutPageBadges = [{
label: `Comfy Sidebar v${version}${hasCommit ? ` (${commit})` : ""}`,
url: hasCommit
? `https://github.com/m0rtus59/ComfyUI-ComfySidebar/commit/${commit}`
: "https://github.com/m0rtus59/ComfyUI-ComfySidebar",
icon: "icon-[lucide--github]"
}];
}
}
} catch (error) {
console.warn("[ComfySidebar] Could not load version information for the About panel:", error);
}
let isInitialized = false;
let activeKeydownHandler = null;
let cleanupFns = [];
@@ -51,21 +73,10 @@ function setupKeydownShortcuts() {
document.addEventListener("keydown", activeKeydownHandler, true);
}
function setGalleryButtonVisible(visible) {
try {
const buttons = document.querySelectorAll(".side-bar-button, [data-tab-id]");
for (const btn of buttons) {
if (btn.getAttribute("data-tab-id") === "classic-comfy-gallery" ||
btn.getAttribute("title")?.includes("Gallery") ||
btn.querySelector(".pi-folder")) {
btn.style.display = visible ? "" : "none";
break;
}
}
} catch (e) {
console.warn("[ComfySidebar] Error toggling gallery tab button:", e);
}
}
// Assigned in setup(): registers/unregisters the Gallery sidebar tab to match the
// "Enable Output Gallery Sidebar" setting. Null until setup() has run (the setting's
// initial onChange fires earlier, in init(), when there is nothing to toggle yet).
let syncGalleryTab = null;
function registerSettings() {
app.ui.settings.addSetting({
@@ -102,7 +113,7 @@ function registerSettings() {
type: "boolean",
defaultValue: true,
onChange: (val) => {
setGalleryButtonVisible(val ?? true);
syncGalleryTab?.(val ?? true);
}
});
@@ -301,6 +312,7 @@ function setupWorkflowTabsPositionWatcher() {
app.registerExtension({
name: "ComfySidebar.ClassicRestore",
aboutPageBadges,
async init() {
await initI18n();
@@ -445,32 +457,47 @@ app.registerExtension({
}
});
const galleryContainer = setupGalleryView();
app.extensionManager.registerSidebarTab({
id: "classic-comfy-gallery",
icon: "pi pi-folder",
title: t("Gallery"),
tooltip: t("Gallery (Outputs)"),
type: "custom",
render: (el) => {
document.querySelectorAll(".comfy-sidebar-scroll-top-btn").forEach(btn => { btn.style.display = "none"; });
const scrollParent = getScrollContainer(el);
if (activeSidebarTab === "queue" && scrollParent) {
queueScrollPos = scrollParent.scrollTop;
}
activeSidebarTab = "gallery";
el.replaceChildren(galleryContainer);
requestAnimationFrame(() => {
const sp = getScrollContainer(el);
if (sp) sp.scrollTop = galleryScrollPos;
});
}
});
// The Gallery tab is only registered while the setting is enabled. Hiding its
// button in the DOM was unreliable: the sidebar renders asynchronously and
// re-renders on its own, so the button came back (or the wrong one was hidden).
let galleryContainer = null;
let galleryTabRegistered = false;
const isGalleryEnabled = getSetting("Comfy Sidebar.Enable Gallery", true);
if (!isGalleryEnabled) {
setTimeout(() => setGalleryButtonVisible(false), 50);
}
const registerGalleryTab = () => {
if (galleryTabRegistered) return;
galleryContainer ||= setupGalleryView();
app.extensionManager.registerSidebarTab({
id: "classic-comfy-gallery",
icon: "pi pi-folder",
title: t("Gallery"),
tooltip: t("Gallery (Outputs)"),
type: "custom",
render: (el) => {
document.querySelectorAll(".comfy-sidebar-scroll-top-btn").forEach(btn => { btn.style.display = "none"; });
const scrollParent = getScrollContainer(el);
if (activeSidebarTab === "queue" && scrollParent) {
queueScrollPos = scrollParent.scrollTop;
}
activeSidebarTab = "gallery";
el.replaceChildren(galleryContainer);
requestAnimationFrame(() => {
const sp = getScrollContainer(el);
if (sp) sp.scrollTop = galleryScrollPos;
});
}
});
galleryTabRegistered = true;
};
const unregisterGalleryTab = () => {
if (!galleryTabRegistered) return;
if (activeSidebarTab === "gallery") activeSidebarTab = "queue";
app.extensionManager.unregisterSidebarTab?.("classic-comfy-gallery");
galleryTabRegistered = false;
};
syncGalleryTab = (enabled) => (enabled ? registerGalleryTab() : unregisterGalleryTab());
syncGalleryTab(getSetting("Comfy Sidebar.Enable Gallery", true));
requestAnimationFrame(() => {
applySidebarOverride();
@@ -478,6 +505,7 @@ app.registerExtension({
},
destroy() {
syncGalleryTab = null;
for (const fn of cleanupFns.splice(0)) {
try { if (typeof fn === "function") fn(); } catch (e) {}
}