Skip to content

Commit 3c23959

Browse files
nesquenaclaude
andauthored
v0.4.1 — macOS window drag (#22): grant start_dragging permission (the real fix) (#25)
The v0.4.0 fix used `-webkit-app-region: drag`, a Chromium/Electron feature that macOS WKWebView ignores — a no-op, so the window still couldn't be dragged with a single tab. Real root cause: dragging is driven by Tauri's `data-tauri-drag-region` → `invoke('plugin:window|start_dragging')`, but the remote-content capability granted only `core:event:default`, so the command was denied and the handler silently did nothing. (With 2+ tabs the native tab bar supplied its own drag region — why the bug only showed with one tab.) Fix: - capabilities/content.json: grant `core:window:allow-start-dragging` (narrow — window drag only; documented exception to the "events-only for remote content" stance, invariant #7). - bridge.rs: set `data-tauri-drag-region="deep"` so the whole titlebar drags (drag.js auto-exempts buttons/links/inputs); drop the no-op CSS. Verified in the generated ACL (start_dragging now permitted for main-*/tab-*), and confirmed working live on macOS by the maintainer (single-tab window drags from the title bar). fmt/clippy(-D warnings)/test(12) green. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent cb89afa commit 3c23959

7 files changed

Lines changed: 42 additions & 25 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Changelog
22

3+
## [v0.4.1] — 2026-06-17
4+
5+
### Fixed
6+
7+
- **macOS: dragging the window by the title bar with a single tab open now
8+
actually works** (issue #22). The v0.4.0 attempt used the CSS
9+
`-webkit-app-region: drag`, which is a Chromium/Electron feature that macOS's
10+
WebKit webview ignores — so it was a no-op and the window still couldn't be
11+
moved. The real cause: the window-drag was driven by Tauri's
12+
`data-tauri-drag-region`, but the command it invokes (`start_dragging`) was
13+
never permitted for the remote page, so it silently did nothing. The
14+
permission is now granted (narrowly — only window dragging, nothing else), and
15+
the whole title bar is a drag region (its buttons/links still click). With two
16+
or more tabs the native tab bar already provided dragging, which is why the
17+
bug only appeared with a single tab.
18+
319
## [v0.4.0] — 2026-06-17
420

521
A tabs & sessions release across macOS, Windows, and Linux.

‎package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hermes-webui-desktop",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"private": true,
55
"scripts": {
66
"tauri": "tauri"

‎src-tauri/Cargo.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src-tauri/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hermes-webui-desktop"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
description = "Hermes WebUI Desktop — cross-platform shell for hermes-webui"
55
edition = "2021"
66
license = "MIT"

‎src-tauri/capabilities/content.json‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "../gen/schemas/desktop-schema.json",
33
"identifier": "content-windows",
4-
"description": "Minimal IPC for remote hermes-webui content webviews: injected bridge scripts may only emit events",
4+
"description": "Minimal IPC for remote hermes-webui content webviews: injected bridge scripts may emit events, plus window-drag so the page titlebar can move the window (issue #22)",
55
"windows": ["main-*"],
66
"webviews": ["main-*", "tab-*"],
77
"remote": {
@@ -17,6 +17,7 @@
1717
]
1818
},
1919
"permissions": [
20-
"core:event:default"
20+
"core:event:default",
21+
"core:window:allow-start-dragging"
2122
]
2223
}

‎src-tauri/src/bridge.rs‎

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -59,40 +59,40 @@ const PASTE_SUPPRESS: &str = r##"
5959

6060
/// S7/S8/S9 — macOS overlay-titlebar integration: traffic-light clearance,
6161
/// hide the page logo (collides with traffic lights), CSS rule for hiding the
62-
/// page titlebar when the native tab bar shows, and a NATIVE drag region on
63-
/// `.app-titlebar`.
62+
/// page titlebar when the native tab bar shows, and the window drag region.
6463
///
65-
/// Window dragging uses WKWebView's built-in `-webkit-app-region: drag` (the
66-
/// same mechanism AppKit/Electron use for frameless drag) rather than Tauri's
67-
/// `data-tauri-drag-region`. The Tauri attribute drives dragging through a
68-
/// JS→native IPC that is unreliable in remote-origin webviews — the same
69-
/// remote-IPC fragility that broke titles (#15) and external links (#12) — so
70-
/// with a single tab (no native tab bar to drag) the window couldn't be moved
71-
/// at all (issue #22). `-webkit-app-region` is honored natively by WKWebView,
72-
/// independent of IPC/CSP/capability scope, and works regardless of tab count.
73-
/// Interactive children are marked `no-drag` so the titlebar's buttons/inputs
74-
/// still receive clicks. The `data-tauri-drag-region` attribute is kept as a
75-
/// belt-and-suspenders fallback (harmless when the CSS already handles it).
64+
/// Window dragging uses Tauri's `data-tauri-drag-region` (Tauri's injected
65+
/// `drag.js` listens for a mousedown in the region and invokes
66+
/// `plugin:window|start_dragging`). NOTE: macOS WKWebView does NOT support
67+
/// Chromium's `-webkit-app-region: drag` despite the prefix — that's an
68+
/// Electron/Chromium feature, so an earlier attempt using it was a silent
69+
/// no-op. The Tauri attribute was already present but couldn't move the window
70+
/// because the remote-content capability granted only `core:event:default`, so
71+
/// the `start_dragging` command was denied; granting
72+
/// `core:window:allow-start-dragging` (capabilities/content.json) is what
73+
/// actually fixes single-tab dragging (issue #22). With 2+ tabs the native tab
74+
/// bar provided its own drag region, which is why the bug only showed with one.
75+
///
76+
/// `deep` makes the entire titlebar a drag region; `drag.js` automatically
77+
/// exempts interactive descendants (button/a/input/select/[role]/contenteditable
78+
/// /tabindex), so the titlebar's controls still receive their clicks.
7679
const MACOS_TITLEBAR: &str = r##"
7780
try { document.documentElement.style.setProperty('--traffic-light-width', '80px'); } catch (e) {}
7881
(function () {
7982
try {
8083
var s = document.createElement('style');
8184
s.textContent =
8285
'.app-titlebar-icon { visibility: hidden !important; } ' +
83-
'body.hermes-mac-tabbed .app-titlebar { display: none !important; } ' +
84-
'.app-titlebar { -webkit-app-region: drag; } ' +
85-
'.app-titlebar button, .app-titlebar a, .app-titlebar input, .app-titlebar select, ' +
86-
'.app-titlebar textarea, .app-titlebar [role="button"], .app-titlebar [contenteditable], ' +
87-
'.app-titlebar [data-no-drag] { -webkit-app-region: no-drag; }';
86+
'body.hermes-mac-tabbed .app-titlebar { display: none !important; }';
8887
(document.head || document.documentElement).appendChild(s);
8988
} catch (e) {}
9089
})();
9190
(function () {
9291
var attach = function () {
9392
try {
9493
var tb = document.querySelector('.app-titlebar');
95-
if (tb && !tb.hasAttribute('data-tauri-drag-region')) tb.setAttribute('data-tauri-drag-region', '');
94+
if (tb && tb.getAttribute('data-tauri-drag-region') !== 'deep')
95+
tb.setAttribute('data-tauri-drag-region', 'deep');
9696
} catch (e) {}
9797
};
9898
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', attach);

‎src-tauri/tauri.conf.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"$schema": "https://schema.tauri.app/config/2",
33
"productName": "Hermes WebUI Desktop",
4-
"version": "0.4.0",
4+
"version": "0.4.1",
55
"identifier": "ai.get-hermes.HermesWebUIDesktop",
66
"build": {
77
"frontendDist": "../src"

0 commit comments

Comments
 (0)