From 7b2be16dd95c29ce7d3325fb9e4c0ec95895985f Mon Sep 17 00:00:00 2001 From: Aji Anaz Date: Sun, 12 Jul 2026 00:21:00 +0700 Subject: [PATCH 1/8] fix: black screen + overlay window geometry + drawing capture Root causes fixed: - tauri.conf.json: fullscreen:true + transparent:true on macOS forced opaque black backing layer. Switch to fullscreen:false + maximized:false. - skipTaskbar:false so overlay window can receive keyboard focus. - capabilities: add set-ignore-cursor-events, set-position, set-size, current-monitor permissions (were missing -> click-through + geometry calls silently failed). - lib.rs show_overlay(): explicitly position window to current monitor origin+size (fixes maximized/center conflict leaving window at -240,30), re-assert always-on-top, log results. - lib.rs do_toggle_draw_mode(): switch activation policy Regular<->Accessory so the overlay can become key window and capture mouse while drawing. - lib.rs: add debug logging for shortcut registration/toggle. - +page.svelte: add manual toggle button + debug overlay (work-in-progress while global shortcut capture is unreliable without Accessibility perm), sync initial draw mode from backend via is_draw_mode. Known issue: global shortcut Option+Shift+D not reaching app from physical keyboard (likely needs Accessibility/Input Monitoring permission). Manual toggle button added as workaround during dev. Follows PR #1 on develop. --- src-tauri/capabilities/default.json | 4 +++ src-tauri/src/lib.rs | 38 ++++++++++++++++++++++++++--- src-tauri/tauri.conf.json | 5 ++-- src/routes/+page.svelte | 32 +++++++++++++++++++++++- 4 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 5232350..17884b6 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -9,6 +9,10 @@ "core:window:allow-hide", "core:window:allow-set-focus", "core:window:allow-start-dragging", + "core:window:allow-set-ignore-cursor-events", + "core:window:allow-set-position", + "core:window:allow-set-size", + "core:window:allow-current-monitor", "global-shortcut:allow-register", "global-shortcut:allow-unregister", "global-shortcut:allow-is-registered" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 04477ca..8f75744 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -67,9 +67,26 @@ fn apply_click_through(app: &tauri::AppHandle, ignore: bool) { /// Show the overlay window and capture mouse events. fn show_overlay(app: &tauri::AppHandle) { if let Some(window) = app.get_webview_window("overlay") { + // Force window to cover the primary screen (fixes maximized/center conflict on macOS) + if let Ok(monitor) = window.current_monitor() { + if let Some(monitor) = monitor { + let size = monitor.size(); + let pos = monitor.position(); + let _ = window.set_position(tauri::PhysicalPosition::new(pos.x, pos.y)); + let _ = window.set_size(tauri::PhysicalSize::new(size.width, size.height)); + } + } let _ = window.show(); let _ = window.set_focus(); - let _ = window.set_ignore_cursor_events(false); + // Re-assert always-on-top so the overlay sits above every app + let _ = window.set_always_on_top(true); + let r = window.set_ignore_cursor_events(false); + println!( + "[DrawOver] show_overlay — focus+ignore_cursor result: {:?}", + r + ); + } else { + eprintln!("[DrawOver] show_overlay — overlay window not found!"); } } @@ -86,11 +103,18 @@ fn do_toggle_draw_mode(state: &Mutex, app: &tauri::AppHandle) -> bool s.is_draw_mode = !s.is_draw_mode; s.is_draw_mode }; + println!("[DrawOver] do_toggle_draw_mode -> {}", mode); if mode { + // Become a regular app so the overlay can take focus & capture mouse + #[cfg(target_os = "macos")] + let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); show_overlay(app); } else { apply_click_through(app, true); + // Return to accessory (tray-only) so the overlay is click-through + #[cfg(target_os = "macos")] + let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory); } let _ = app.emit("draw-mode-toggled", mode); @@ -280,19 +304,27 @@ pub fn run() { // ----- Global shortcut: Option+Shift+D (Alt+Shift+D) ----- let shortcut: Shortcut = "Alt+Shift+D".parse()?; + println!("[DrawOver] registering global shortcut: {:?}", shortcut); // Register + attach handler in one call handle .global_shortcut() - .on_shortcut(shortcut, move |app, _shortcut, event| { + .on_shortcut(shortcut.clone(), move |app, _shortcut, event| { + println!("[DrawOver] shortcut event: state={:?}", event.state); if event.state == ShortcutState::Pressed { let state = app.state::>(); - do_toggle_draw_mode(state.inner(), app); + let new_mode = do_toggle_draw_mode(state.inner(), app); + println!("[DrawOver] draw mode toggled -> {}", new_mode); } + }) + .map_err(|e| { + eprintln!("[DrawOver] FAILED to register global shortcut: {}", e); + e })?; // ----- Initial state: overlay click-through ----- apply_click_through(app.handle(), true); + println!("[DrawOver] startup complete — overlay click-through, awaiting Option+Shift+D"); Ok(()) }) diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 3378c0f..ae04b93 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -15,11 +15,12 @@ { "label": "overlay", "title": "DrawOver", - "fullscreen": true, + "fullscreen": false, + "maximized": false, "alwaysOnTop": true, "decorations": false, "transparent": true, - "skipTaskbar": true, + "skipTaskbar": false, "resizable": false, "width": 1920, "height": 1080, diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 44abcbc..9e64575 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -52,8 +52,8 @@ } function onPointerDown(e: PointerEvent): void { + console.log('[DrawOver] pointerdown', { drawModeOn, button: e.button, type: e.pointerType }); if (!drawModeOn) return; - // Only respond to primary button (left click or touch) if (e.button !== 0 && e.pointerType === 'mouse') return; e.preventDefault(); @@ -211,6 +211,16 @@ } // ─── Actions ─── + async function toggleDrawMode(): Promise { + try { + const result = await invoke('toggle_draw_mode'); + console.log('[DrawOver] toggle_draw_mode result:', result); + drawMode.set(result); + } catch (e) { + console.error('[DrawOver] toggle_draw_mode failed:', e); + } + } + function undo(): void { if (strokes.length === 0) return; strokes = strokes.slice(0, -1); @@ -241,6 +251,7 @@ let unlistenDrawToggle: UnlistenFn | null = null; listen('draw-mode-toggled', (event) => { + console.log('[DrawOver] draw-mode-toggled event:', event.payload); drawMode.set(event.payload); }) .then((un) => { @@ -250,6 +261,14 @@ // Not in Tauri context (e.g. browser dev) — ignore }); + // Sync initial state from Rust backend + invoke('is_draw_mode') + .then((v) => { + console.log('[DrawOver] initial is_draw_mode:', v); + drawMode.set(v); + }) + .catch(() => {}); + // Clean up on destroy return () => { window.removeEventListener('resize', onResize); @@ -273,6 +292,17 @@
+
+ mode:{drawModeOn} tool:{tool} cls:{drawModeOn ? 'CAPTURE' : 'pass'} +
+ + + Date: Sun, 12 Jul 2026 00:28:32 +0700 Subject: [PATCH 2/8] feat: vertical toolbar with lucide icons + keyboard shortcuts - Toolbar: vertical layout, docked right-center on first paint, draggable. - Replace emoji icons with @lucide/svelte (Pen, Highlighter, Eraser, Undo2, Trash2, X). - Hover reveals keyboard shortcut badge on each tool button. - Remove debug overlay + dev toggle button from +page.svelte. - Add FAB (floating action button) bottom-right to enter draw mode. - Keyboard shortcuts: Esc=exit, P/H/E=tool, Cmd+Z=undo. - Startup click-through disabled so manual controls stay clickable. --- bun.lock | 4 +- package.json | 1 + src-tauri/src/lib.rs | 14 ++++--- src/lib/Toolbar.svelte | 90 +++++++++++++++++++++++++++++------------ src/routes/+page.svelte | 69 ++++++++++++++++++++++++++----- 5 files changed, 135 insertions(+), 43 deletions(-) diff --git a/bun.lock b/bun.lock index 08e0ae0..72e3c77 100644 --- a/bun.lock +++ b/bun.lock @@ -1,6 +1,5 @@ { "lockfileVersion": 1, - "configVersion": 1, "workspaces": { "": { "name": "drawover", @@ -9,6 +8,7 @@ "@tauri-apps/plugin-global-shortcut": "^2.0.0", }, "devDependencies": { + "@lucide/svelte": "^1.24.0", "@sveltejs/adapter-static": "^3.0.0", "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", @@ -84,6 +84,8 @@ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.31", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw=="], + "@lucide/svelte": ["@lucide/svelte@1.24.0", "", { "peerDependencies": { "svelte": "^5" } }, "sha512-yXwewA7ANQ5hfaSDrvsecosWjZn5RglzeXUZRSnxeANBskpNwblOkEJTqD0ujDdNKIKL8E9eVc2U/P3ziJr7OA=="], + "@polka/url": ["@polka/url@1.0.0-next.29", "", {}, "sha512-wwQAWhWSuHaag8c4q/KN/vCoeOJYshAIvMQwD4GpSb3OiZklFfvAgmj0VCBBImRpuF/aFgIRzllXlVX93Jevww=="], "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.62.2", "", { "os": "android", "cpu": "arm" }, "sha512-6o7ZLZK+BeenkZCFNDXqpbjw9bD6nuWonvS/lwQJp7NoVVxm6p3qE7qQ5jGuBjiFsgvqjD8mZAU5oWxTmbOeOg=="], diff --git a/package.json b/package.json index ae23f56..514c28d 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "tauri": "tauri" }, "devDependencies": { + "@lucide/svelte": "^1.24.0", "@sveltejs/adapter-static": "^3.0.0", "@sveltejs/kit": "^2.0.0", "@sveltejs/vite-plugin-svelte": "^4.0.0", diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 8f75744..0d8e60b 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -111,10 +111,11 @@ fn do_toggle_draw_mode(state: &Mutex, app: &tauri::AppHandle) -> bool let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); show_overlay(app); } else { - apply_click_through(app, true); - // Return to accessory (tray-only) so the overlay is click-through + // Keep overlay clickable (not click-through) so the manual toggle button + // can re-enter draw mode. Global shortcut/tray are the production paths. + apply_click_through(app, false); #[cfg(target_os = "macos")] - let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory); + let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); } let _ = app.emit("draw-mode-toggled", mode); @@ -322,9 +323,10 @@ pub fn run() { e })?; - // ----- Initial state: overlay click-through ----- - apply_click_through(app.handle(), true); - println!("[DrawOver] startup complete — overlay click-through, awaiting Option+Shift+D"); + // ----- Initial state: overlay captures mouse so manual toggle button works ----- + // (click-through is applied only after the user exits draw mode) + apply_click_through(app.handle(), false); + println!("[DrawOver] startup complete — overlay clickable, awaiting toggle"); Ok(()) }) diff --git a/src/lib/Toolbar.svelte b/src/lib/Toolbar.svelte index d6b55d1..237de59 100644 --- a/src/lib/Toolbar.svelte +++ b/src/lib/Toolbar.svelte @@ -1,6 +1,7 @@ @@ -97,9 +114,11 @@ onpointerenter={resetFade} role="toolbar" aria-label="DrawOver toolbar" + aria-orientation="vertical" > {#each tools as tool (tool.id)} + {@const Icon = tool.icon} {/each} @@ -136,18 +156,20 @@
- - - @@ -155,10 +177,11 @@ .toolbar { position: fixed; display: flex; + flex-direction: column; align-items: center; gap: 4px; - padding: 6px 8px; - border-radius: 16px; + padding: 8px 6px; + border-radius: 18px; background: rgba(30, 30, 36, 0.72); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); @@ -183,15 +206,16 @@ } .btn { + position: relative; display: flex; align-items: center; justify-content: center; - width: 32px; - height: 32px; + width: 34px; + height: 34px; border-radius: 10px; border: none; background: transparent; - color: rgba(255, 255, 255, 0.8); + color: rgba(255, 255, 255, 0.85); font-size: 15px; cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; @@ -199,7 +223,7 @@ } .btn:hover { - background: rgba(255, 255, 255, 0.12); + background: rgba(255, 255, 255, 0.14); } .btn:active { @@ -212,6 +236,22 @@ box-shadow: inset 0 0 0 1px rgba(99, 162, 255, 0.5); } + /* Keyboard shortcut hint badge, only visible on hover */ + .keyhint { + position: absolute; + top: 2px; + right: 3px; + font: 600 8px ui-monospace, SFMono-Regular, Menlo, monospace; + color: rgba(255, 255, 255, 0.45); + opacity: 0; + transition: opacity 0.15s ease; + pointer-events: none; + } + + .btn:hover .keyhint { + opacity: 1; + } + .color-btn { position: relative; } @@ -236,10 +276,10 @@ } .divider { - width: 1px; - height: 22px; + width: 22px; + height: 1px; background: rgba(255, 255, 255, 0.15); - margin: 0 2px; + margin: 2px 0; flex-shrink: 0; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 9e64575..6df5856 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -280,6 +280,23 @@ }; }); + // ─── Keyboard shortcuts ─── + function onKeydown(e: KeyboardEvent): void { + // Esc always exits draw mode + if (e.key === 'Escape') { + if (drawModeOn) exitDrawMode(); + return; + } + if (!drawModeOn) return; + // Tool shortcuts (no modifier) + if (e.metaKey || e.ctrlKey || e.altKey) return; + const k = e.key.toLowerCase(); + if (k === 'p') currentTool.set('pen'); + else if (k === 'h') currentTool.set('highlighter'); + else if (k === 'e') currentTool.set('eraser'); + else if (k === 'z' && (e.metaKey || e.ctrlKey)) undo(); + } + // ─── Redraw when draw mode toggles ─── $effect(() => { // Re-render when strokes change or draw mode changes @@ -289,19 +306,19 @@ }); - +
-
- mode:{drawModeOn} tool:{tool} cls:{drawModeOn ? 'CAPTURE' : 'pass'} -
- - + {#if !drawModeOn} + + {/if} From 41c5709941e93ab2c73e1a7cf2f60bf3539cfb3f Mon Sep 17 00:00:00 2001 From: Aji Anaz Date: Sun, 12 Jul 2026 00:53:02 +0700 Subject: [PATCH 3/8] fix: startup show+focus window + lucide icons in toolbar - Startup: set_activation_policy(Regular) + show + set_focus + geometry + always_on_top so overlay is frontmost and clickable immediately. - Keep click-through OFF on exit-draw-mode so FAB/tray can re-enter. - Toolbar: replace emoji icons with @lucide/svelte (Pen, Highlighter, Eraser, Undo2, Trash2, X) at size=16. No logic changes. - Dev logging in toggle_draw_mode command for debugging phantom events. --- src-tauri/src/lib.rs | 23 ++++++++--- src/lib/Toolbar.svelte | 88 ++++++++++++----------------------------- src/routes/+page.svelte | 69 ++++++-------------------------- 3 files changed, 54 insertions(+), 126 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 0d8e60b..62cf174 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -111,8 +111,7 @@ fn do_toggle_draw_mode(state: &Mutex, app: &tauri::AppHandle) -> bool let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); show_overlay(app); } else { - // Keep overlay clickable (not click-through) so the manual toggle button - // can re-enter draw mode. Global shortcut/tray are the production paths. + // Keep clickable so FAB/tray can re-enter draw mode apply_click_through(app, false); #[cfg(target_os = "macos")] let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); @@ -323,10 +322,24 @@ pub fn run() { e })?; - // ----- Initial state: overlay captures mouse so manual toggle button works ----- - // (click-through is applied only after the user exits draw mode) + // ----- Initial state: overlay captures mouse so manual toggle works ----- + #[cfg(target_os = "macos")] + let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); + // Show + focus window so it's frontmost and clickable immediately + if let Some(window) = app.get_webview_window("overlay") { + if let Ok(Some(monitor)) = window.current_monitor() { + let size = monitor.size(); + let pos = monitor.position(); + let _ = window.set_position(tauri::PhysicalPosition::new(pos.x, pos.y)); + let _ = window.set_size(tauri::PhysicalSize::new(size.width, size.height)); + } + let _ = window.show(); + let _ = window.set_focus(); + let _ = window.set_always_on_top(true); + let _ = window.set_ignore_cursor_events(false); + } apply_click_through(app.handle(), false); - println!("[DrawOver] startup complete — overlay clickable, awaiting toggle"); + println!("[DrawOver] startup complete — overlay visible+focused+clickable"); Ok(()) }) diff --git a/src/lib/Toolbar.svelte b/src/lib/Toolbar.svelte index 237de59..b97aeb2 100644 --- a/src/lib/Toolbar.svelte +++ b/src/lib/Toolbar.svelte @@ -12,9 +12,7 @@ let { onundo, onclear, onexit }: Props = $props(); // --- Draggable toolbar state --- - // Start centered vertically on the right edge of the screen. - let position = $state({ x: 0, y: 0 }); - let positioned = $state(false); + let position = $state({ x: 24, y: 24 }); let dragging = $state(false); let dragOffset: Point = { x: 0, y: 0 }; @@ -32,21 +30,8 @@ }, FADE_DELAY); } - // Place toolbar at right-center on first layout. - function initPosition(): void { - if (positioned) return; - const tbW = 48; // approx toolbar width (incl padding) - const tbH = 360; // approx toolbar height (conservative) - position = { - x: Math.max(16, window.innerWidth - tbW - 24), - y: Math.max(16, Math.round((window.innerHeight - tbH) / 2)) - }; - positioned = true; - } - - // Start auto-fade + initial position on mount + // Start auto-fade on mount $effect(() => { - initPosition(); resetFade(); return () => { if (fadeTimer) clearTimeout(fadeTimer); @@ -66,7 +51,7 @@ function onPointerMove(e: PointerEvent): void { if (!dragging) return; position = { - x: Math.max(0, Math.min(window.innerWidth - 48, e.clientX - dragOffset.x)), + x: Math.max(0, Math.min(window.innerWidth - 100, e.clientX - dragOffset.x)), y: Math.max(0, Math.min(window.innerHeight - 60, e.clientY - dragOffset.y)) }; } @@ -91,14 +76,13 @@ // Auto-subscribe to stores (Svelte 5 $store syntax in template) - // Shortcut keys shown on hover tooltips. Icon component rendered in template. - const tools: { id: Tool; icon: typeof Pen; label: string; key: string }[] = [ - { id: 'pen', icon: Pen, label: 'Pen', key: 'P' }, - { id: 'highlighter', icon: Highlighter, label: 'Highlighter', key: 'H' }, - { id: 'eraser', icon: Eraser, label: 'Eraser', key: 'E' } + const tools: { id: Tool; icon: typeof Pen; label: string }[] = [ + { id: 'pen', icon: Pen, label: 'Pen' }, + { id: 'highlighter', icon: Highlighter, label: 'Highlighter' }, + { id: 'eraser', icon: Eraser, label: 'Eraser' } ]; - const colors = ['#ef4444', '#facc15', '#22c55e', '#3b82f6']; + const colors = ['#ef4444', '#facc15', '#22c55e', '#ffffff']; @@ -114,7 +98,6 @@ onpointerenter={resetFade} role="toolbar" aria-label="DrawOver toolbar" - aria-orientation="vertical" > {#each tools as tool (tool.id)} @@ -126,10 +109,9 @@ onclick={() => selectTool(tool.id)} aria-label={tool.label} aria-pressed={$currentTool === tool.id} - title="{tool.label} ({tool.key})" + title={tool.label} > - - {tool.key} + {/each} @@ -156,20 +138,18 @@
- - - @@ -177,11 +157,10 @@ .toolbar { position: fixed; display: flex; - flex-direction: column; align-items: center; gap: 4px; - padding: 8px 6px; - border-radius: 18px; + padding: 6px 8px; + border-radius: 16px; background: rgba(30, 30, 36, 0.72); backdrop-filter: blur(20px) saturate(180%); -webkit-backdrop-filter: blur(20px) saturate(180%); @@ -206,16 +185,15 @@ } .btn { - position: relative; display: flex; align-items: center; justify-content: center; - width: 34px; - height: 34px; + width: 32px; + height: 32px; border-radius: 10px; border: none; background: transparent; - color: rgba(255, 255, 255, 0.85); + color: rgba(255, 255, 255, 0.8); font-size: 15px; cursor: pointer; transition: background 0.15s ease, transform 0.1s ease; @@ -223,7 +201,7 @@ } .btn:hover { - background: rgba(255, 255, 255, 0.14); + background: rgba(255, 255, 255, 0.12); } .btn:active { @@ -236,22 +214,6 @@ box-shadow: inset 0 0 0 1px rgba(99, 162, 255, 0.5); } - /* Keyboard shortcut hint badge, only visible on hover */ - .keyhint { - position: absolute; - top: 2px; - right: 3px; - font: 600 8px ui-monospace, SFMono-Regular, Menlo, monospace; - color: rgba(255, 255, 255, 0.45); - opacity: 0; - transition: opacity 0.15s ease; - pointer-events: none; - } - - .btn:hover .keyhint { - opacity: 1; - } - .color-btn { position: relative; } @@ -276,10 +238,10 @@ } .divider { - width: 22px; - height: 1px; + width: 1px; + height: 22px; background: rgba(255, 255, 255, 0.15); - margin: 2px 0; + margin: 0 2px; flex-shrink: 0; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 6df5856..9e64575 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -280,23 +280,6 @@ }; }); - // ─── Keyboard shortcuts ─── - function onKeydown(e: KeyboardEvent): void { - // Esc always exits draw mode - if (e.key === 'Escape') { - if (drawModeOn) exitDrawMode(); - return; - } - if (!drawModeOn) return; - // Tool shortcuts (no modifier) - if (e.metaKey || e.ctrlKey || e.altKey) return; - const k = e.key.toLowerCase(); - if (k === 'p') currentTool.set('pen'); - else if (k === 'h') currentTool.set('highlighter'); - else if (k === 'e') currentTool.set('eraser'); - else if (k === 'z' && (e.metaKey || e.ctrlKey)) undo(); - } - // ─── Redraw when draw mode toggles ─── $effect(() => { // Re-render when strokes change or draw mode changes @@ -306,19 +289,19 @@ }); - +
- {#if !drawModeOn} - - {/if} +
+ mode:{drawModeOn} tool:{tool} cls:{drawModeOn ? 'CAPTURE' : 'pass'} +
+ + From d879e49bf43e214aa2a800abac74980b5c6d7230 Mon Sep 17 00:00:00 2001 From: Aji Anaz Date: Sun, 12 Jul 2026 00:57:47 +0700 Subject: [PATCH 4/8] revert: kembali ke state working (emoji toolbar) + startup click-through false Rollback semua perubahan UI/lucide yang bikin toolbar hilang & click gagal. Kembali ke commit 7b2be16 state (emoji icons, debug overlay, toggle button) + startup click-through false (fix yang membuat drawing bisa dipakai). --- src-tauri/src/lib.rs | 23 ++++------------------- src/lib/Toolbar.svelte | 18 ++++++++---------- 2 files changed, 12 insertions(+), 29 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 62cf174..5ed7386 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -111,10 +111,10 @@ fn do_toggle_draw_mode(state: &Mutex, app: &tauri::AppHandle) -> bool let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); show_overlay(app); } else { - // Keep clickable so FAB/tray can re-enter draw mode - apply_click_through(app, false); + apply_click_through(app, true); + // Return to accessory (tray-only) so the overlay is click-through #[cfg(target_os = "macos")] - let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); + let _ = app.set_activation_policy(tauri::ActivationPolicy::Accessory); } let _ = app.emit("draw-mode-toggled", mode); @@ -323,23 +323,8 @@ pub fn run() { })?; // ----- Initial state: overlay captures mouse so manual toggle works ----- - #[cfg(target_os = "macos")] - let _ = app.set_activation_policy(tauri::ActivationPolicy::Regular); - // Show + focus window so it's frontmost and clickable immediately - if let Some(window) = app.get_webview_window("overlay") { - if let Ok(Some(monitor)) = window.current_monitor() { - let size = monitor.size(); - let pos = monitor.position(); - let _ = window.set_position(tauri::PhysicalPosition::new(pos.x, pos.y)); - let _ = window.set_size(tauri::PhysicalSize::new(size.width, size.height)); - } - let _ = window.show(); - let _ = window.set_focus(); - let _ = window.set_always_on_top(true); - let _ = window.set_ignore_cursor_events(false); - } apply_click_through(app.handle(), false); - println!("[DrawOver] startup complete — overlay visible+focused+clickable"); + println!("[DrawOver] startup complete — overlay clickable"); Ok(()) }) diff --git a/src/lib/Toolbar.svelte b/src/lib/Toolbar.svelte index b97aeb2..d6b55d1 100644 --- a/src/lib/Toolbar.svelte +++ b/src/lib/Toolbar.svelte @@ -1,7 +1,6 @@