From cc42a9086dcfd5b218a2c73ab8c084f3bf31872c Mon Sep 17 00:00:00 2001 From: Andy Dixon Date: Sun, 11 Oct 2026 17:42:40 +0100 Subject: [PATCH] rust: --connect startup flag; palette launcher hint fits narrow windows --- rust/app/src/app.rs | 8 ++++++++ rust/app/src/chrome.rs | 13 +++++-------- rust/app/src/main.rs | 3 ++- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/rust/app/src/app.rs b/rust/app/src/app.rs index c650ac5..ae15f0f 100644 --- a/rust/app/src/app.rs +++ b/rust/app/src/app.rs @@ -23,6 +23,8 @@ pub struct Options { /// Open a window at startup: editor, quick, settings[:tab], keys, snippets, triggers, /// recordings, palette, export, import (screenshot checks). pub open: Option, + /// Connect a saved profile (by name or id) at startup. + pub connect: Option, } /// Errors from worker threads, drained into toasts each frame. @@ -158,6 +160,12 @@ impl App { run_local: opts.run_local.map(|c| (c, None)), resize_sidebar: false, }; + if let Some(c) = opts.connect.as_deref() { + match app.s.profiles.iter().find(|p| p.id == c || p.display_name == c).map(|p| p.id.clone()) { + Some(id) => app.connect_profile(&id, true), + None => eprintln!("--connect: no profile named {c:?}"), + } + } if let Some(w) = opts.open.as_deref() { app.open_window(w); } diff --git a/rust/app/src/chrome.rs b/rust/app/src/chrome.rs index ee5deef..8de6f81 100644 --- a/rust/app/src/chrome.rs +++ b/rust/app/src/chrome.rs @@ -194,14 +194,11 @@ pub fn title_bar(app: &mut App, ui: &mut Ui) { let resp = ui.interact(r, ui.id().with("palette-launch"), Sense::click()); ui.painter().rect(r, 6.0, if resp.hovered() { t.hover } else { t.field }, Stroke::new(1.0, t.field_border), egui::StrokeKind::Inside); ui.painter().text(r.left_center() + vec2(9.0, 0.0), Align2::LEFT_CENTER, icon::MAGNIFYING_GLASS, egui::FontId::proportional(13.0), t.text_faint); - ui.painter().with_clip_rect(r.shrink(2.0)).text( - r.left_center() + vec2(28.0, 0.0), - Align2::LEFT_CENTER, - "Search connections and commands", - egui::FontId::proportional(12.0), - t.text_faint, - ); - if w > 250.0 { + let show_keys = w > 250.0; + let clip = Rect::from_min_max(r.min, pos2(r.right() - if show_keys { 52.0 } else { 4.0 }, r.bottom())); + let hint = if w > 290.0 { "Search connections and commands" } else { "Search" }; + ui.painter().with_clip_rect(clip).text(r.left_center() + vec2(28.0, 0.0), Align2::LEFT_CENTER, hint, egui::FontId::proportional(12.0), t.text_faint); + if show_keys { ui.painter().text(r.right_center() - vec2(8.0, 0.0), Align2::RIGHT_CENTER, keys("Mod+K").replace('+', " "), theme::semibold(10.5), t.text_faint); } if resp.clicked() { diff --git a/rust/app/src/main.rs b/rust/app/src/main.rs index 4519310..0062485 100644 --- a/rust/app/src/main.rs +++ b/rust/app/src/main.rs @@ -33,7 +33,7 @@ use nexus_core::service::Service; use std::sync::Arc; fn main() -> eframe::Result { - let mut opts = app::Options { screenshot: None, theme: None, run_local: None, open: None }; + let mut opts = app::Options { screenshot: None, theme: None, run_local: None, open: None, connect: None }; let mut size = [1360.0, 860.0]; let mut data_dir = None; let mut args = std::env::args().skip(1); @@ -42,6 +42,7 @@ fn main() -> eframe::Result { "--theme" => opts.theme = args.next(), "--run-local" => opts.run_local = args.next(), "--open" => opts.open = args.next(), + "--connect" => opts.connect = args.next(), "--screenshot" => opts.screenshot = args.next().map(Into::into), // Use another data directory (testing, screenshots, portable installs). "--data-dir" => data_dir = args.next(),