Edit photos by describing the change, on your own GPU. A free, open-source alternative to Nano Banana and ChatGPT image editing: photos stay on your computer, no daily limit. One installer for Windows, Mac and Linux sets up the best open model (Qwen-Image 2.1). MCP server for AI agents.
TypeScript ai-photo-editorcomfyui-alternativegenerative-fillimage-editingimage-generationinpaintinglinuxlocal-aimacosmcpmcp-servernano-banana-alternativeofflinephoto-editorprivacyqwen-imageqwen-image-2-1stable-diffusion-cppvulkanwindows
window: one surface with Kokon's own title bar; restyled scrollbars
Gabriele Lozupone2b85bf219ee7
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.jsonindex f96078c..6947408 100644--- a/src-tauri/capabilities/default.json+++ b/src-tauri/capabilities/default.json@@ -1,7 +1,7 @@{"$schema": "../gen/schemas/desktop-schema.json","identifier": "default",- "description": "Main window: dialogs, clipboard text, window events, full-screen image viewer.",+ "description": "Main window: dialogs, clipboard text, window events, full-screen image viewer, Kokon's own title bar (drag, minimize, maximize, close).","windows": ["main"],@@ -11,6 +11,12 @@"core:window:allow-set-fullscreen","core:window:allow-is-fullscreen","core:window:allow-set-theme",+ "core:window:allow-start-dragging",+ "core:window:allow-internal-toggle-maximize",+ "core:window:allow-minimize",+ "core:window:allow-toggle-maximize",+ "core:window:allow-is-maximized",+ "core:window:allow-close","dialog:allow-open","dialog:allow-save","dialog:allow-message",diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.jsonindex 3ed1ea8..9838c5e 100644--- a/src-tauri/tauri.conf.json+++ b/src-tauri/tauri.conf.json@@ -22,7 +22,8 @@"minHeight": 620,"center": true,"visible": false,- "dragDropEnabled": true+ "dragDropEnabled": true,+ "decorations": false}],"security": {diff --git a/src-tauri/tauri.macos.conf.json b/src-tauri/tauri.macos.conf.jsonindex ec41b06..c661bc9 100644--- a/src-tauri/tauri.macos.conf.json+++ b/src-tauri/tauri.macos.conf.json@@ -1,7 +1,40 @@{+ "app": {+ "windows": [+ {+ "label": "main",+ "title": "Kokon",+ "width": 1320,+ "height": 880,+ "minWidth": 880,+ "minHeight": 620,+ "center": true,+ "visible": false,+ "dragDropEnabled": true,+ "decorations": true,+ "titleBarStyle": "Overlay",+ "hiddenTitle": true,+ "trafficLightPosition": {+ "x": 18,+ "y": 20+ }+ }+ ]+ },"bundle": {- "targets": ["app", "dmg"],- "icon": ["icons/macos/32x32.png", "icons/macos/128x128.png", "icons/macos/[email protected]", "icons/macos/icon.icns"],- "macOS": { "minimumSystemVersion": "15.0", "signingIdentity": "-" }+ "targets": [+ "app",+ "dmg"+ ],+ "icon": [+ "icons/macos/32x32.png",+ "icons/macos/128x128.png",+ "icons/macos/[email protected]",+ "icons/macos/icon.icns"+ ],+ "macOS": {+ "minimumSystemVersion": "15.0",+ "signingIdentity": "-"+ }}}diff --git a/src/App.tsx b/src/App.tsxindex 7b65339..617cb42 100644--- a/src/App.tsx+++ b/src/App.tsx@@ -23,6 +23,7 @@ import { Shortcuts } from "./components/Shortcuts";import { WhatsNew, whatsNewDue } from "./components/WhatsNew";import { UpscalerCompare } from "./components/Upscalers";import { KokonMark, Welcome } from "./components/Welcome";+import { BareTitleBar, WindowControls } from "./components/TitleBar";import { autoCheckForUpdate, installUpdate } from "./lib/updates";const IMAGE_EXT = /\.(png|jpe?g|webp|bmp|gif|tiff?|heic|heif)$/i;@@ -350,6 +351,7 @@ export default function App() {if (boot !== "ok") {return (<div className="app" style={{ display: "grid", placeItems: "center" }}>+ <BareTitleBar />{boot === "connecting" ? (<BootSplash />) : (@@ -369,8 +371,8 @@ export default function App() {<div className="app">{sidebar && !needsSetup && <Sidebar />}<div className="workspace">- <div className="topbar">- <div className="brand">+ <div className="topbar" data-tauri-drag-region>+ <div className="brand" data-tauri-drag-region>{!sidebar && !needsSetup && (<><IconButton title="Show sidebar" onClick={() => setState({ sidebar: true })}>@@ -383,7 +385,7 @@ export default function App() {)}{overlay === "gallery" ? <span className="project-title">All images</span> : !needsSetup && <ProjectTitle />}</div>- <div className="toolbar">+ <div className="toolbar" data-tauri-drag-region>{!needsSetup && <HistoryButtons />}<UpdatePill />{!needsSetup && <PrivateToggle />}@@ -395,6 +397,7 @@ export default function App() {<Settings size={18} /></IconButton></div>+ <WindowControls /></div><div className="main">{needsSetup ? <Setup /> : <Stage />}diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsxindex e002266..0940b1d 100644--- a/src/components/Sidebar.tsx+++ b/src/components/Sidebar.tsx@@ -17,8 +17,8 @@ export function Sidebar() {return (<aside className="sidebar">- <div className="side-head">- <span className="wordmark">+ <div className="side-head" data-tauri-drag-region>+ <span className="wordmark" data-tauri-drag-region><KokonMark size={18} />Kokon</span>diff --git a/src/components/TitleBar.tsx b/src/components/TitleBar.tsxnew file mode 100644index 0000000..27562ec--- /dev/null+++ b/src/components/TitleBar.tsx@@ -0,0 +1,51 @@+// Kokon draws its own title bar: the window is one surface. On Windows and Linux the system+// bar is off (tauri.conf.json) and these are the window's buttons; on macOS the system keeps+// its traffic lights, drawn over Kokon's top bar (tauri.macos.conf.json), so there is nothing+// to draw here. The top bar and the sidebar's head are drag regions (data-tauri-drag-region).++import { Copy, Minus, Square, X } from "lucide-react";+import { useEffect, useState } from "react";+import { native } from "../lib/native";+import { isMac } from "../lib/platform";++// macOS: room for the traffic lights on the left of the top bar (styles.css).+if (isMac && typeof document !== "undefined") document.documentElement.dataset.platform = "mac";++export function WindowControls() {+ const [maximized, setMaximized] = useState(false);+ useEffect(() => {+ if (isMac) return;+ let un: (() => void) | undefined;+ let gone = false;+ const sync = () => native.isMaximized().then((m) => !gone && setMaximized(m), () => {});+ sync();+ native.onResized(sync).then((u) => (gone ? u() : (un = u)), () => {});+ return () => {+ gone = true;+ un?.();+ };+ }, []);+ if (isMac) return null;+ return (+ <div className="window-controls">+ <button className="win-btn" title="Minimize" aria-label="Minimize" onClick={() => native.minimize().catch(() => {})}>+ <Minus size={16} strokeWidth={1.6} />+ </button>+ <button className="win-btn" title={maximized ? "Restore" : "Maximize"} aria-label={maximized ? "Restore" : "Maximize"} onClick={() => native.toggleMaximize().catch(() => {})}>+ {maximized ? <Copy size={13} strokeWidth={1.6} style={{ transform: "scaleX(-1)" }} /> : <Square size={13} strokeWidth={1.6} />}+ </button>+ <button className="win-btn close" title="Close" aria-label="Close" onClick={() => native.close().catch(() => {})}>+ <X size={17} strokeWidth={1.6} />+ </button>+ </div>+ );+}++/** A bar to move the window by and its buttons, over screens without the top bar (startup). */+export function BareTitleBar() {+ return (+ <div className="bare-titlebar" data-tauri-drag-region>+ <WindowControls />+ </div>+ );+}diff --git a/src/lib/native.ts b/src/lib/native.tsindex 400932d..f12cf4d 100644--- a/src/lib/native.ts+++ b/src/lib/native.ts@@ -36,6 +36,12 @@ export const native = {isFullscreen: () => getCurrentWindow().isFullscreen(),setFullscreen: (on: boolean) => getCurrentWindow().setFullscreen(on),setTheme: async (theme: "light" | "dark" | null) => getCurrentWindow().setTheme(theme),+ // Kokon's own title bar (the system one is off on Windows and Linux).+ minimize: () => getCurrentWindow().minimize(),+ toggleMaximize: () => getCurrentWindow().toggleMaximize(),+ close: () => getCurrentWindow().close(),+ isMaximized: () => getCurrentWindow().isMaximized(),+ onResized: (f: () => void) => getCurrentWindow().onResized(f),saveAs: (defaultName: string) =>save({defaultPath: defaultName,diff --git a/src/styles.css b/src/styles.cssindex a949919..769b2d4 100644--- a/src/styles.css+++ b/src/styles.css@@ -3,6 +3,8 @@/* Neutral grey ground and white cards lifted by a soft shadow (monochrome like the mark);--surface* are grey tints for fills and hovers. */:root {+ --scroll: rgba(0, 0, 0, 0.2);+ --scroll-hi: rgba(0, 0, 0, 0.38);--ground: #f4f4f4;--bg: #ffffff;--surface: #ededed;@@ -35,6 +37,8 @@/* data-theme is set before the first paint by public/theme.js (OS setting or Settings → General). */:root[data-theme="dark"] {+ --scroll: rgba(255, 255, 255, 0.18);+ --scroll-hi: rgba(255, 255, 255, 0.34);--ground: #0a0a0a;--bg: #151515;--surface: #1c1c1c;@@ -91,7 +95,7 @@ svg { display: block; flex: none; }.side-item:hover { background: var(--surface); color: var(--text); }.side-item.on { background: var(--bg); color: var(--text); box-shadow: var(--lift); font-weight: 500; }.side-label { font-size: 11.5px; color: var(--text-3); padding: 12px 20px 6px; letter-spacing: 0.02em; }-.side-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin; }+.side-list { flex: 1; overflow-y: auto; padding: 2px 8px 12px; display: flex; flex-direction: column; gap: 2px; }.proj { display: flex; align-items: center; gap: 11px; padding: 7px; border-radius: 14px; cursor: pointer; position: relative; outline-offset: -2px; transition: background 0.15s, box-shadow 0.2s; }.proj:hover { background: var(--surface); }.proj.on { background: var(--bg); box-shadow: var(--lift); }@@ -106,6 +110,8 @@ svg { display: block; flex: none; }/* ---------- top bar ---------- */.topbar { height: 52px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 12px 0 16px; flex: none; }+.topbar:has(.window-controls) { padding-right: 0; }+.topbar .toolbar { margin-left: auto; }.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: -0.01em; }/* the status capsule: a card in the top bar; a small cocoon spins while images are made */.status { display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px 0 11px; border-radius: 999px; background: var(--bg); box-shadow: var(--lift); color: var(--text); font-size: 12.5px; font-weight: 400; }@@ -245,10 +251,11 @@ svg { display: block; flex: none; }/* version timeline: a line per image and the versions made from it; arcs join versions madefrom earlier ones or from several */-.timeline { flex: none; display: flex; max-width: 100%; overflow-x: auto; padding: 0 8px 4px; margin: 14px 0 10px; scrollbar-width: thin; scrollbar-color: transparent transparent; transition: scrollbar-color 0.2s; }+.timeline { flex: none; display: flex; max-width: 100%; overflow-x: auto; padding: 0 8px 4px; margin: 14px 0 10px; }/* A thin bar under a timeline wider than the stage, clearer on hover. */-.timeline.overflow { padding-bottom: 8px; margin-bottom: 6px; scrollbar-color: var(--surface-3) transparent; }-.timeline.overflow:hover { scrollbar-color: var(--text-3) transparent; }+.timeline.overflow { padding-bottom: 8px; margin-bottom: 6px; }+.timeline.overflow::-webkit-scrollbar-thumb { background-color: var(--scroll); }+.timeline.overflow:hover::-webkit-scrollbar-thumb { background-color: var(--scroll-hi); }.track { position: relative; display: flex; align-items: flex-start; width: max-content; }.arcs { position: absolute; left: 0; top: 0; width: 100%; overflow: visible; pointer-events: none; }.arcs path { fill: none; stroke: var(--text-3); stroke-opacity: 0.45; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transition: stroke-opacity 0.15s; }@@ -851,3 +858,26 @@ kbd { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px; display.overlay, .modal-scrim, .modal, .upscaler-compare, .toast, .star-prompt, .card { animation: none; }.card:hover { transform: none; }}++/* ---------- the window: Kokon's own title bar (components/TitleBar.tsx) ---------- */+.window-controls { display: flex; align-self: stretch; margin-left: 4px; position: relative; z-index: 55; }+.win-btn { width: 46px; height: 100%; display: grid; place-items: center; color: var(--text-2); transition: background 0.12s, color 0.12s; }+.win-btn:hover { background: var(--surface-2); color: var(--text); }+.win-btn:active { background: var(--surface-3); }+.win-btn.close:hover { background: #c42b1c; color: #fff; }+.win-btn.close:active { background: #b22a1b; color: #fff; }+.bare-titlebar { position: fixed; top: 0; left: 0; right: 0; height: 44px; display: flex; justify-content: flex-end; z-index: 5; }+/* the drag regions take the click, not the text inside them */+.wordmark *, .brand > span.project-title { pointer-events: none; }+/* macOS keeps its traffic lights over the top-left corner */+:root[data-platform="mac"] .side-head { padding-left: 86px; }+:root[data-platform="mac"] .app:not(:has(.sidebar)) .topbar { padding-left: 86px; }++/* ---------- scrollbars: a thin rounded thumb, no arrows, shown while the pointer is over the+ list (WebView2, WebKit); the track stays invisible ---------- */+::-webkit-scrollbar { width: 10px; height: 10px; background: transparent; }+::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }+::-webkit-scrollbar-button { display: none; width: 0; height: 0; }+::-webkit-scrollbar-thumb { background-color: transparent; border: 3px solid transparent; border-radius: 999px; background-clip: padding-box; min-height: 32px; }+:hover::-webkit-scrollbar-thumb { background-color: var(--scroll); }+::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--scroll-hi); }