Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .changeset/native-feel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### Changes

#### Look and feel
- **Desktop density** - Text, icons and bars are smaller and tighter, closer to native desktop apps. The base text size is 14px instead of 16px, icons render at their real 12, 14 and 16px sizes, corners are tighter, and the macOS title bar is 38px (36px on Windows and Linux).
- **Quieter motion** - Buttons no longer shrink when pressed, dialogs fade in instead of zooming, tooltips lose the arrow and bounce, and the sidebar loader is a spinner.
- **System font and scrolling by default** - Unless changed in Settings, Stroke uses the system UI font with the OS's own text smoothing, and native scrolling on every platform. Trackpads always scroll natively, even with eased mouse-wheel scrolling turned on.

#### Window
- **Window size and position are remembered** - Stroke reopens where it was, at the same size, instead of opening maximized every time.
- **Native window chrome** - Windows 11 keeps its window shadow and rounded corners, uses Mica for the glass effect, and gets Fluent caption buttons. Linux gets round GTK-style window buttons and a 1px border on unmaximized windows. On macOS the glass dims with the window when another app has focus, like Finder.
- **Unfocused window** - The title bar and sidebar dim slightly when Stroke isn't the active window.
- **Menu mnemonics** - On Windows and Linux, Alt+F, E, V, T and H open the menus, and holding Alt underlines their letters.
- **Linux GPU rendering** - Stroke now uses GPU compositing on Linux, and falls back to software rendering only after a launch that failed to draw or when `WEBKIT_DISABLE_DMABUF_RENDERER=1` is set.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
if (parsed?.zoom != null) zoom = Number(parsed.zoom)
else if (parsed?.fontSize != null) zoom = Number(parsed.fontSize) / 14
if (Number.isFinite(zoom) && zoom > 0) {
const fontPx = Math.round(13 * zoom)
const fontPx = Math.round(14 * zoom)
const root = document.documentElement
root.style.setProperty('--app-zoom', String(zoom))
root.style.setProperty('--app-font-size', fontPx + 'px')
Expand Down
1 change: 1 addition & 0 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"core:window:allow-toggle-maximize",
"core:window:allow-start-dragging",
"core:window:allow-is-maximized",
"core:window:allow-is-focused",
"dialog:default",
"dialog:allow-save",
"autostart:default"
Expand Down
29 changes: 20 additions & 9 deletions src-tauri/src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ pub async fn open_dashboard_window(app: tauri::AppHandle, dashboard_id: String,
}
#[cfg(not(target_os = "macos"))]
{
builder = builder.decorations(false);
builder = builder.decorations(false).shadow(true);
}
let window = builder.build().map_err(|e| e.to_string())?;
let surface = crate::surface_for_theme(window.theme().unwrap_or(tauri::Theme::Dark));
Expand Down Expand Up @@ -367,7 +367,7 @@ pub async fn open_new_window(app: tauri::AppHandle) -> Result<(), String> {
}
#[cfg(not(target_os = "macos"))]
{
builder = builder.decorations(false);
builder = builder.decorations(false).shadow(true);
}

let window = builder.build().map_err(|e| e.to_string())?;
Expand Down Expand Up @@ -2572,12 +2572,9 @@ pub fn set_window_glass(window: tauri::WebviewWindow, enabled: bool, dark: bool)
.set_effects(
EffectsBuilder::new()
.effect(Effect::Sidebar)
// Always frosted. Following the window's active state
// turned the glass into flat grey whenever another app
// had focus - which read as the theme not working, most
// of all in light, where the inactive material is a
// plain pale grey.
.state(EffectState::Active)
// Follow native macOS active/inactive material dimming
// just like Finder and system windows.
.state(EffectState::FollowsWindowActiveState)
.build(),
)
.map_err(|e| e.to_string())?;
Expand All @@ -2589,7 +2586,21 @@ pub fn set_window_glass(window: tauri::WebviewWindow, enabled: bool, dark: bool)
window.set_background_color(Some(surface)).map_err(|e| e.to_string())?;
}
}
#[cfg(not(target_os = "macos"))]
#[cfg(target_os = "windows")]
{
use tauri::window::{Effect, EffectsBuilder};
let theme = if dark { tauri::Theme::Dark } else { tauri::Theme::Light };
if enabled {
let _ = window.set_theme(Some(theme));
let _ = window.set_effects(EffectsBuilder::new().effect(Effect::Mica).build());
} else {
let _ = window.set_effects(None);
let _ = window.set_theme(None);
let surface = crate::surface_for_theme(theme);
let _ = window.set_background_color(Some(surface));
}
}
#[cfg(not(any(target_os = "macos", target_os = "windows")))]
let _ = (window, enabled, dark);
Ok(())
}
Expand Down
13 changes: 12 additions & 1 deletion src-tauri/src/display_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ mod imp {
});
}

/// True when an earlier GPU/Wayland launch failed to draw and we fell back
/// to the safe X11 path.
pub fn using_fallback() -> bool {
state_dir().map(|d| d.join(FALLBACK).exists()).unwrap_or(false)
}

/// The page drew: this backend works here.
pub fn drawn() {
if let Some(dir) = state_dir() {
Expand All @@ -109,7 +115,7 @@ mod imp {
}

#[cfg(target_os = "linux")]
pub use imp::{choose, drawn, watch};
pub use imp::{choose, drawn, using_fallback, watch};

#[cfg(not(target_os = "linux"))]
pub fn choose() {}
Expand All @@ -119,3 +125,8 @@ pub fn drawn() {}

#[cfg(not(target_os = "linux"))]
pub fn watch(_app: tauri::AppHandle) {}

#[cfg(not(target_os = "linux"))]
pub fn using_fallback() -> bool {
false
}
60 changes: 28 additions & 32 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ mod sync;
mod updates;
mod quit;
mod web_search;
mod window_state;

use db::{ActiveConnection, DbState, TunnelState};
use mcp::McpState;
Expand Down Expand Up @@ -437,29 +438,23 @@ pub fn run() {
// Wayland or X11, before GTK starts and before any thread (display_backend.rs).
display_backend::choose();

// Linux WebKitGTK rendering fix - set before any threads spawn.
// Linux WebKitGTK GPU compositing - set before any threads spawn.
#[cfg(target_os = "linux")]
// SAFETY: called before any threads are spawned.
unsafe {
// WEBKIT_DISABLE_DMABUF_RENDERER: WebKitGTK's DMA-buf renderer composites
// text as GPU textures that get bilinearly sampled at fractional pixel
// offsets during scroll/zoom, producing the characteristic blur on Linux.
// Disabling it falls back to a Cairo/FreeType software path that stays crisp.
// This is the only verified safe WebKitGTK rendering env var - others like
// WEBKIT_USE_LEGACY_TEXT_RENDERER are not real and can trigger SIGTRAP crashes.
//
// The cost is per-frame CPU. rAF still rides the GdkFrameClock, so the
// cadence the compositor offers is the cadence WebKit asks for - but
// rasterising in software is expensive enough that a busy frame can miss
// it, and the miss gets more likely the higher the panel's rate. Default
// to crisp, and let a high-refresh setup buy frames back with
// `WEBKIT_DISABLE_DMABUF_RENDERER=0`, which puts the webview on the GPU
// compositor. The "0" is unset rather than passed through, because WebKit
// tests some of these vars for presence and not for value.
// Keep hardware DMA-buf compositing enabled on healthy Linux GPU setups
// so scrolling, resizing and dialogs stay fluid (our type scale now
// lands on whole pixels, avoiding fractional texture resampling). Only
// fall back to Cairo software rendering if a previous launch failed to
// draw (display_backend::using_fallback()) or the user explicitly sets
// WEBKIT_DISABLE_DMABUF_RENDERER=1.
match std::env::var("WEBKIT_DISABLE_DMABUF_RENDERER").as_deref() {
Ok("0") | Ok("") => std::env::remove_var("WEBKIT_DISABLE_DMABUF_RENDERER"),
Ok(_) => {}
Err(_) => std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"),
Err(_) if display_backend::using_fallback() => {
std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1");
}
Err(_) => {}
}
// GDK_SCALE is intentionally NOT forced here - overriding it breaks HiDPI
// setups (2× displays) and can cause rendering panics on Wayland compositors.
Expand Down Expand Up @@ -536,7 +531,8 @@ pub fn run() {
// paths that need them without a State/AppHandle argument: the D1
// driver refreshing an expired Cloudflare token mid-session.
cloudflare::set_app_handle(app.handle().clone());
if let Ok(dir) = app.path().app_data_dir() {
let app_data_dir = app.path().app_data_dir().ok();
if let Some(dir) = app_data_dir.clone() {
crash::set_dir(dir.clone());
db::connection::set_data_dir(dir);
}
Expand All @@ -552,15 +548,10 @@ pub fn run() {
.inner_size(1280.0, 800.0)
.min_inner_size(960.0, 600.0)
.resizable(true)
.maximized(true)
// Hidden until the page has its first finished screen: revealApp()
// in src/lib/app-reveal.js shows it. A window visible from build()
// put every pre-paint layer on screen in turn - the host surface,
// the webview backdrop, the maximize resize - and on Windows that
// read as the window flickering between two blacks for half a second
// before the app appeared. tao keeps MAXIMIZED across the hide, and
// show() issues SW_SHOW then SW_MAXIMIZE, so the OS still records a
// real maximized state (minimize -> restore keeps working).
// in src/lib/app-reveal.js shows it. Window size, position, and
// maximized state are restored from window-state.json right after
// build() rather than forcing maximized on every launch.
.visible(false)
// Never let the default white surface show. The real theme is only
// known to the frontend (localStorage), so start on the dark base -
Expand All @@ -572,8 +563,8 @@ pub fn run() {
// OS-drawn traffic lights via the Overlay style - they just float over
// our content instead of sitting in a native title bar strip, so
// clicking/hovering/dragging them stays pixel-native with no code on
// our side. Windows/Linux get no decorations at all; TitleBar.svelte
// draws its own drag region and minimize/maximize/close buttons.
// our side. Windows/Linux use frameless windows with native shadows
// enabled so DWM shadows & rounded corners stay intact on Windows 11.
#[cfg(target_os = "macos")]
{
window_builder = window_builder
Expand All @@ -593,7 +584,7 @@ pub fn run() {
}
#[cfg(not(target_os = "macos"))]
{
window_builder = window_builder.decorations(false);
window_builder = window_builder.decorations(false).shadow(true);
}

let window = window_builder
Expand All @@ -614,6 +605,11 @@ pub fn run() {
.on_navigation(navigation_allowed)
.build()?;

window_state::restore(&window, app_data_dir.as_deref());
if let Some(dir) = app_data_dir {
window_state::attach(&window, dir);
}

// Match the surface to the OS appearance before the first frame. Both
// calls land inside `setup`, i.e. before the event loop starts, so
// nothing has been composited yet and there is no flash of the wrong
Expand Down Expand Up @@ -772,12 +768,12 @@ pub fn run() {
commands::cassandra_tables,
commands::cassandra_describe,
commands::cassandra_page,
commands::test_convex,
commands::connect_convex_db,
commands::cassandra_save,
commands::cassandra_delete,
commands::test_firestore,
commands::connect_firestore_db,
commands::test_convex,
commands::connect_convex_db,
commands::test_neo4j,
commands::connect_neo4j_db,
commands::neo4j_labels,
Expand All @@ -797,11 +793,11 @@ pub fn run() {
commands::test_odbc,
commands::connect_odbc_db,
commands::test_snowflake,
commands::convex_call,
commands::connect_snowflake_db,
commands::odbc_drivers,
commands::odbc_data_sources,
commands::firestore_request,
commands::convex_call,
commands::test_mongo,
commands::connect_mongo_db,
commands::doc_use_schema,
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/local_servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ pub async fn open_local_servers_window(app: AppHandle, from: String) -> Result<(
}
#[cfg(not(target_os = "macos"))]
{
builder = builder.decorations(false);
builder = builder.decorations(false).shadow(true);
}
let window = builder.build().map_err(|e| e.to_string())?;
let surface = crate::surface_for_theme(window.theme().unwrap_or(tauri::Theme::Dark));
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/src/mac_chrome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const ACCEL_EVENT: &str = "native-menu-accelerators";
/// them (19 and 17 left them high). Shared by the main window and
/// `open_new_window`.
pub(crate) fn traffic_light_position() -> LogicalPosition<f64> {
LogicalPosition::new(16.0, 28.0)
LogicalPosition::new(14.0, 21.0)
}

/// One app item: (action, label, accelerator, needs a connection).
Expand Down
Loading
Loading