Compare commits
10
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eda45eaa6f | ||
|
|
8310c95f95 | ||
|
|
43cd6660ae | ||
|
|
99f1dcf2e4 | ||
|
|
22b2fdc748 | ||
|
|
398c8c4adc | ||
|
|
2b265aaf40 | ||
|
|
9567209ce4 | ||
|
|
a83c0f82ea | ||
|
|
a13030b96b |
@@ -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
@@ -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
@@ -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) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user