Skip to content
Draft
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
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@ src-tauri/gen/schemas

# Excalidraw fonts (copied from node_modules at install time)
static/excalidraw-assets/fonts/

.direnv/
5 changes: 3 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,9 @@ A `flake.nix` is provided. Enter the dev shell before running any build commands
nix develop # sets up cargo, pnpm, webkitgtk, GStreamer, pkg-config, etc.
```

The shell hook also exports `GDK_BACKEND=x11` and `WEBKIT_DISABLE_DMABUF_RENDERER=1`
so the dev server renders correctly under Wayland.
The shell hook exports `XDG_DATA_DIRS` so GTK can find gsettings schemas and
report the correct display scale under Wayland (without this, the WebView
allocates at the wrong size).

To install the binary into your Nix profile (wraps it with the required env vars):

Expand Down
23 changes: 18 additions & 5 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@
"${pkgs.gst_all_1.gst-plugins-bad}/lib/gstreamer-1.0"
]
);

# Path suitable for XDG_DATA_DIRS so GTK can find gsettings schemas
# (needed for Wayland display-scale reporting). Mirrors what
# nixpkgs' gsettingsSchemaSetupHook sets up automatically as
# GSETTINGS_SCHEMAS_PATH from buildInputs in the dev shell.
gsettingsSchemasPath = pkgs.lib.optionalString isLinux (
"${pkgs.gtk3}/share/gsettings-schemas/${pkgs.gtk3.name}"
);
in
{
# Formatter (nixfmt)
Expand All @@ -49,11 +57,14 @@
makeWrapper ${./src-tauri/target/release/annot} $out/bin/annot
''
else
# XDG_DATA_DIRS prefixed (not set) so any existing
# desktop-environment entries are preserved. With this in
# place, the installed binary runs on Wayland correctly;
# no GDK_BACKEND override needed.
''
mkdir -p $out/bin
makeWrapper ${./src-tauri/target/release/annot} $out/bin/annot \
--set GDK_BACKEND x11 \
--set WEBKIT_DISABLE_DMABUF_RENDERER 1 \
--prefix XDG_DATA_DIRS : "${gsettingsSchemasPath}" \
--set GST_PLUGIN_SYSTEM_PATH "${gstPluginPath}" \
--set GIO_MODULE_DIR "${pkgs.glib-networking}/lib/gio/modules"
''
Expand Down Expand Up @@ -113,9 +124,11 @@
# GStreamer plugin discovery
export GST_PLUGIN_SYSTEM_PATH="${gstPluginPath}"

# Force X11 (WebKit2GTK Wayland/DMABuf is broken on NixOS)
export GDK_BACKEND=x11
export WEBKIT_DISABLE_DMABUF_RENDERER=1
# Wayland needs gsettings schemas discoverable via XDG_DATA_DIRS
# so GTK can report the correct display scale; otherwise the
# WebView surface allocates at the wrong size.
# (wiki.nixos.org/wiki/Tauri)
export XDG_DATA_DIRS="$GSETTINGS_SCHEMAS_PATH''${XDG_DATA_DIRS:+:$XDG_DATA_DIRS}"

# GIO modules for TLS support
export GIO_MODULE_DIR="${pkgs.glib-networking}/lib/gio/modules"
Expand Down
1 change: 1 addition & 0 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ ignore = "0.4"
sublime_fuzzy = "0.7"
similar = { version = "3", features = ["inline"] }

[target.'cfg(target_os = "linux")'.dependencies]
# Used only to flip the underlying WebKitGTK Settings (e.g. disable
# enable-smooth-scrolling) via window.with_webview. Match wry's version
# to avoid pulling in a second copy.
webkit2gtk = "2.0"

[dev-dependencies]
insta = "1.45"
tempfile = "3.23.0"
Expand Down
17 changes: 17 additions & 0 deletions src-tauri/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,22 @@ macro_rules! all_commands {
use review::{ActiveReview, Review};
use state::AppState;

/// Apply Linux-specific WebKitGTK settings to a window's webview after
/// creation. Currently: disable `enable-smooth-scrolling` so wheel events
/// scroll instantly instead of with momentum. No-op on non-Linux.
#[cfg(target_os = "linux")]
pub fn configure_linux_webview<R: tauri::Runtime>(window: &tauri::WebviewWindow<R>) {
use webkit2gtk::{SettingsExt, WebViewExt};
let _ = window.with_webview(|wv| {
if let Some(settings) = wv.inner().settings() {
settings.set_enable_smooth_scrolling(false);
}
});
}

#[cfg(not(target_os = "linux"))]
pub fn configure_linux_webview<R: tauri::Runtime>(_window: &tauri::WebviewWindow<R>) {}

/// Shared flag to prevent app exit in MCP mode.
pub type ShouldExit = Arc<AtomicBool>;

Expand Down Expand Up @@ -154,6 +170,7 @@ pub fn run(state: AppState, context: tauri::Context, json_output: bool) {
};

let window = builder.build()?;
configure_linux_webview(&window);

// Restore saved window position/size (or keep defaults)
window_state::restore_window_state(&window, window_state::WindowType::Main);
Expand Down
1 change: 1 addition & 0 deletions src-tauri/src/mcp/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ fn run_session_with_state(
let window = app_handle
.get_webview_window(&built_label)
.ok_or_else(|| format!("Window {} not found after build", built_label))?;
crate::configure_linux_webview(&window);

// Restore the review window onto the monitor it was last used on. The MCP
// window shares the "main" slot — it is the main review window, just
Expand Down
8 changes: 2 additions & 6 deletions src/styles/components/code-viewer.css
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ header.header {
padding: 2.4px 12px 0 90px;
flex-shrink: 0;
border-bottom: 1px solid rgba(0, 0, 0, 0.06);
background: color-mix(in srgb, var(--bg-panel) 85%, transparent);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
Comment on lines -26 to -28

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should improve performance a bit

background: var(--bg-panel);
-webkit-app-region: drag;
/* Soft shadow for depth */
box-shadow:
Expand Down Expand Up @@ -68,9 +66,7 @@ header.header {
/* Session slot for global comment editor */
.session-slot {
padding: 0 12px 12px 12px;
background: color-mix(in srgb, var(--bg-panel) 85%, transparent);
backdrop-filter: blur(20px) saturate(180%);
-webkit-backdrop-filter: blur(20px) saturate(180%);
background: var(--bg-panel);
}

/* Override annotation-editor styles when in session slot */
Expand Down
2 changes: 0 additions & 2 deletions src/styles/components/command-palette.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
position: fixed;
inset: 0;
background: var(--backdrop-light);
backdrop-filter: blur(2px);
-webkit-backdrop-filter: blur(2px);
z-index: 1000;
}

Expand Down
2 changes: 0 additions & 2 deletions src/styles/components/status-bar.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
gap: 24px;
padding: 6px 16px;
background: color-mix(in srgb, var(--mode-color, var(--bg-main)) 15%, var(--bg-main));
backdrop-filter: blur(16px) saturate(150%);
-webkit-backdrop-filter: blur(16px) saturate(150%);
border-top: 1px solid color-mix(in srgb, var(--mode-color, transparent) 20%, rgba(0, 0, 0, 0.06));
font-size: 12px;
z-index: 10;
Expand Down