From 5a881c4e4609a0c8672af0dcd106dc84e28e05a2 Mon Sep 17 00:00:00 2001 From: plexscript <16825310+plexscript@users.noreply.github.com> Date: Mon, 19 Oct 2026 12:57:15 -0500 Subject: [PATCH 1/2] Editor: stop the window jiggling while it is moved or resized The Editor viewport builder was rebuilt every frame from settings.editor_window_rect, which is itself updated every frame from the window's current outer rect. egui turns any change in a viewport's builder into OuterPosition/InnerSize commands, so during a drag the window was repeatedly sent back to the position it had a frame earlier and visibly jiggled (seen on Windows). Compute the geometry once when the Editor viewport opens and keep the builder constant while it is shown. The remembered rect is still saved and used the next time the Editor opens. Co-Authored-By: Claude Opus 5.5 --- crates/linkshot-app/src/app.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/linkshot-app/src/app.rs b/crates/linkshot-app/src/app.rs index 5088368..a6f3907 100644 --- a/crates/linkshot-app/src/app.rs +++ b/crates/linkshot-app/src/app.rs @@ -81,6 +81,9 @@ pub struct App { pending: Option, pub capture_visible: bool, pub editor_visible: bool, + /// Editor geometry chosen when its viewport opened. egui turns any change in a viewport's builder + /// into a move/resize command, so feeding back the remembered rect every frame fights the user's drag. + editor_open_geometry: Option<(Option<[f32; 2]>, [f32; 2], [f32; 2])>, pub capture_toggled: bool, pub hotkeys: Hotkeys, pub tray: Tray, @@ -162,6 +165,7 @@ impl App { pending: None, capture_visible: !background, editor_visible: false, + editor_open_geometry: None, capture_toggled: false, hotkeys: if headless_dark.is_some() { Hotkeys::disabled() } else { let c = ctx.clone(); Hotkeys::new(move || crate::keepalive::wake(&c)) }, tray: if headless_dark.is_some() { Tray::disabled() } else { let c = ctx.clone(); Tray::new(move || crate::keepalive::wake(&c)) }, @@ -929,8 +933,11 @@ impl eframe::App for App { } // Editor viewport. + if !self.editor_visible { self.editor_open_geometry = None; } if self.editor_visible { - let (pos, size, min) = self.editor_window_geometry(); + let geometry = match self.editor_open_geometry { Some(g) => g, None => self.editor_window_geometry() }; + self.editor_open_geometry = Some(geometry); + let (pos, size, min) = geometry; let mut builder = egui::ViewportBuilder::default() .with_title("LinkShot Editor") .with_app_id("linkshot") From fe7d918a55d1e8021088b85a22018f76338aebb2 Mon Sep 17 00:00:00 2001 From: plexscript <16825310+plexscript@users.noreply.github.com> Date: Mon, 19 Oct 2026 12:57:15 -0500 Subject: [PATCH 2/2] Editor: resize from the window edges and corners The Editor is undecorated, so the window manager gives it no resize border (on Windows it could not be resized at all). Add thin strips along the edges and corners that show a resize cursor and hand a drag to the window manager with ViewportCommand::BeginResize. They are off while the window is maximized or fullscreen. Co-Authored-By: Claude Opus 5.5 --- crates/linkshot-app/src/editor/mod.rs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/crates/linkshot-app/src/editor/mod.rs b/crates/linkshot-app/src/editor/mod.rs index 7a67aea..a78f80a 100644 --- a/crates/linkshot-app/src/editor/mod.rs +++ b/crates/linkshot-app/src/editor/mod.rs @@ -518,6 +518,8 @@ pub fn editor_ui(app: &mut App, ctx: &egui::Context, actions: &mut Vec) ctx.request_repaint_after(std::time::Duration::from_millis(500)); } else { app.editor.status = None; } } + // Last, so the edge strips win the hit test over whatever is drawn underneath them. + resize_edges(ui, ctx, full); }); dialogs(app, ctx, actions); video_view::gif_dialog_ui(app, ctx); @@ -631,6 +633,31 @@ fn doc_details(app: &App) -> String { } } +/// The Editor has no system frame (`with_decorations(false)`), so it gets no resize border from the +/// window manager: thin strips along the edges and corners hand a drag to it as a native resize. +fn resize_edges(ui: &mut egui::Ui, ctx: &egui::Context, full: Rect) { + use egui::{CursorIcon as C, ResizeDirection as D}; + if ctx.input(|i| i.viewport().maximized.unwrap_or(false) || i.viewport().fullscreen.unwrap_or(false)) { return; } + const EDGE: f32 = 5.0; + const CORNER: f32 = 12.0; + let (l, r, t, b) = (full.left(), full.right(), full.top(), full.bottom()); + let zones = [ + (Rect::from_min_max(Pos2::new(l, t), Pos2::new(l + CORNER, t + CORNER)), D::NorthWest, C::ResizeNorthWest), + (Rect::from_min_max(Pos2::new(r - CORNER, t), Pos2::new(r, t + CORNER)), D::NorthEast, C::ResizeNorthEast), + (Rect::from_min_max(Pos2::new(l, b - CORNER), Pos2::new(l + CORNER, b)), D::SouthWest, C::ResizeSouthWest), + (Rect::from_min_max(Pos2::new(r - CORNER, b - CORNER), Pos2::new(r, b)), D::SouthEast, C::ResizeSouthEast), + (Rect::from_min_max(Pos2::new(l + CORNER, t), Pos2::new(r - CORNER, t + EDGE)), D::North, C::ResizeNorth), + (Rect::from_min_max(Pos2::new(l + CORNER, b - EDGE), Pos2::new(r - CORNER, b)), D::South, C::ResizeSouth), + (Rect::from_min_max(Pos2::new(l, t + CORNER), Pos2::new(l + EDGE, b - CORNER)), D::West, C::ResizeWest), + (Rect::from_min_max(Pos2::new(r - EDGE, t + CORNER), Pos2::new(r, b - CORNER)), D::East, C::ResizeEast), + ]; + for (i, (rect, dir, cursor)) in zones.into_iter().enumerate() { + let resp = ui.interact(rect, ui.id().with(("resize-edge", i)), Sense::drag()); + if resp.hovered() || resp.dragged() { ctx.set_cursor_icon(cursor); } + if resp.drag_started() { ctx.send_viewport_cmd(egui::ViewportCommand::BeginResize(dir)); } + } +} + fn caption_row(app: &mut App, ui: &mut egui::Ui, rect: Rect, ctx: &egui::Context, actions: &mut Vec) { let pal = app.pal; ui.painter().rect_filled(rect, 0.0, pal.main_panel);