From 0403adde489a40fc693540a2e4c03e11a50ab82b Mon Sep 17 00:00:00 2001 From: Matheus Quost Date: Sun, 29 Nov 2026 19:10:14 -0300 Subject: [PATCH 1/2] fix(screenshots): use the system picker on GNOME MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit GNOME 45 to 47 answer "Other" to a silent capture from a background app: the permission dialog is only shown to the app in front, so Menew saved nothing. Every GNOME capture now goes through the picker, which needs no permission; other desktops keep the silent capture and fall back to the picker. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- crates/menew/src/portal.rs | 46 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/crates/menew/src/portal.rs b/crates/menew/src/portal.rs index 25c5f5a..544a68c 100644 --- a/crates/menew/src/portal.rs +++ b/crates/menew/src/portal.rs @@ -2,10 +2,11 @@ //! With `interactive` the system shows its own picker for an area, a window or the whole screen; without it the //! whole screen is taken. Menew never reads the framebuffer or the X11 root window. +use menew_core::sys::Desktop; use std::path::PathBuf; +use tracing::info; -/// The file the system wrote, `None` when the user cancelled, or why it failed (no portal, refused...). -pub async fn screenshot(interactive: bool) -> Result, String> { +async fn request(interactive: bool) -> Result, String> { use ashpd::desktop::screenshot::Screenshot; let request = Screenshot::request().interactive(interactive).modal(true).send().await.map_err(|e| e.to_string())?; match request.response() { @@ -17,3 +18,44 @@ pub async fn screenshot(interactive: bool) -> Result, String> { Err(e) => Err(e.to_string()), } } + +/// The file the system wrote, `None` when the user cancelled, or why it failed (no portal, refused...). +/// +/// GNOME asks for a "screenshot" permission in a system dialog the first time and only shows that dialog to the +/// app in front. Menew is a background daemon (a shortcut, the tray, the palette that is closing), so GNOME answers +/// "Other" to a silent capture and nothing is ever saved. The system picker never asks for that permission, and it +/// is also how the Mac lets people choose between an area, a window and the whole screen; on GNOME every capture +/// goes through it. Elsewhere a silent capture is tried first and the picker is the fallback. +pub async fn screenshot(interactive: bool) -> Result, String> { + let interactive = wants_picker(interactive, Desktop::detect()); + match request(interactive).await { + Err(e) if !interactive => { + info!("Screenshot refused without the picker ({}); asking the system picker", e); + request(true).await + } + other => other, + } +} + +/// Whether the request must go through the system picker. +fn wants_picker(interactive: bool, desktop: Desktop) -> bool { + interactive || desktop == Desktop::Gnome +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn gnome_always_uses_the_picker() { + assert!(wants_picker(false, Desktop::Gnome)); + assert!(wants_picker(true, Desktop::Gnome)); + } + + #[test] + fn other_desktops_keep_a_silent_capture() { + assert!(!wants_picker(false, Desktop::Kde)); + assert!(!wants_picker(false, Desktop::Other)); + assert!(wants_picker(true, Desktop::Kde)); + } +} From 087bf8176ea6eae920e0377e592c99ecd6a24f19 Mon Sep 17 00:00:00 2001 From: Matheus Quost Date: Sun, 29 Nov 2026 19:10:25 -0300 Subject: [PATCH 2/2] feat(settings): a settings window over config.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `menew settings`, the palette and the tray open a libadwaita preferences window for the language (system or one of the five), start at login, the clipboard options, the update check and the tray metrics, so nobody edits JSON by hand. The README, parity, specs, desktop actions and the /linux page texts follow the new window. 🤖 Generated with Codebuff Co-Authored-By: Codebuff --- CHANGELOG.md | 5 + README.md | 6 +- crates/menew-core/src/config.rs | 23 +- crates/menew-core/src/i18n.rs | 3 + crates/menew-core/src/palette.rs | 6 + crates/menew-core/src/strings_r1.rs | 39 +++ crates/menew-tray/src/lib.rs | 12 + crates/menew-ui/Cargo.toml | 2 +- crates/menew-ui/src/lib.rs | 6 +- crates/menew-ui/src/notes_view.rs | 3 +- crates/menew-ui/src/settings.rs | 364 ++++++++++++++++++++++++++++ crates/menew/Cargo.toml | 2 +- crates/menew/src/main.rs | 56 ++++- crates/menew/src/updater.rs | 9 +- data/app.menew.Menew.desktop | 10 +- docs/monitor-spec.md | 2 +- docs/parity.md | 16 +- docs/updates-spec.md | 2 +- site/content.json | 10 +- 19 files changed, 548 insertions(+), 28 deletions(-) create mode 100644 crates/menew-ui/src/settings.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index d151711..7ccc674 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## Unreleased + +- **Screenshots work on GNOME again.** GNOME 45 to 47 refuse a silent capture from a background app (they want to ask for the "screenshot" permission in a dialog only the app in front can show), so Menew answered "the portal refused" and saved nothing. On GNOME every capture now goes through the system picker, which needs no permission; on KDE the silent capture is still tried first and the picker is the fallback. This fixes the screenshot, "copy text from the screen" and the QR scan there. +- **Settings window** (`menew settings`, the palette and the tray): interface language (system or one of the five), start at login, welcome and update check, the clipboard options (paste mode, entries kept, auto delete, OCR, ignored apps) and the tray metrics, instead of editing `config.json` by hand. The language, the clipboard options and the tray metrics are read at startup, so they apply the next time Menew starts. + ## 0.1.0-alpha.3 **Early preview for testers.** Menew now sets itself up: install the .deb, open Menew from the app grid and a welcome window shows what it did. Quick actions and window snapping join the palette. If you have 0.1.0-alpha.1 or alpha.2, Menew offers this update by itself. diff --git a/README.md b/README.md index 2c1da94..e30165d 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,11 @@ Capture an area, a window or the whole screen (Menew asks the screenshot portal, CPU with a graph of the last 2 minutes, each core, the GPU where the driver reports it (AMD), **memory** split into apps, system and compressed with swap and a pressure badge, disk space, network speed with graphs, the battery with the time left and the **top processes by CPU and by memory**. Quit one with a click (SIGTERM); if it ignores that, a separate **Force Quit** button appears. Only your own processes are listed: the system and other users' are never offered. It opens from the tray, the palette ("system monitor") and `menew monitor`, and it reads the machine only while the window is open. -To show metrics in the tray (CPU, memory, network, disk, battery, a CPU graph), put them in `~/.config/menew/config.json` until the settings window arrives: `{"monitor_tray_items": ["cpu", "ram", "net"]}`. KDE Plasma shows them as text in the panel; GNOME's AppIndicator shows only the icon, so there they are in the tooltip. History, temperatures, battery health and alerts are not here yet. +To show metrics in the tray (CPU, memory, network, disk, battery, a CPU graph), turn them on in `menew settings` (or put them in `~/.config/menew/config.json`: `{"monitor_tray_items": ["cpu", "ram", "net"]}`). KDE Plasma shows them as text in the panel; GNOME's AppIndicator shows only the icon, so there they are in the tooltip. History, temperatures, battery health and alerts are not here yet. + +### ⚙️ Settings: `menew settings` + +One window for what used to mean editing `config.json`: the interface language (follow the system, or English, Portuguese, German, Spanish or Chinese), start at login, what happens after picking a clipboard entry (copy and paste, or only copy), how many entries are kept and for how long, reading the text inside copied images, apps that are never saved, the automatic update check and the metrics in the tray. Everything is saved as you change it; the language, the clipboard options and the tray metrics are read when Menew starts, so they apply at the next start. It also opens from the palette ("settings") and the tray menu. ## Everything else diff --git a/crates/menew-core/src/config.rs b/crates/menew-core/src/config.rs index 43144a5..2fe9a51 100644 --- a/crates/menew-core/src/config.rs +++ b/crates/menew-core/src/config.rs @@ -40,10 +40,13 @@ pub struct Config { pub clipboard_ocr: bool, /// Check for updates by itself, every 24 hours (`SUEnableAutomaticChecks`, on by default like the Mac). pub auto_update_check: bool, - /// Metrics shown in the tray Title and ToolTip, from `cpu cpuGraph ram net disk battery` (the Mac's `menuBarItems`). Empty (the default) samples nothing until the settings window of Phase 11 lets the user opt in. + /// Metrics shown in the tray Title and ToolTip, from `cpu cpuGraph ram net disk battery` (the Mac's `menuBarItems`). Empty (the default) samples nothing until the user turns the metrics on in `menew settings`. pub monitor_tray_items: Vec, /// Apps "Quit all apps" never closes (`neverQuit` on the Mac): desktop ids or program names. pub never_quit: Vec, + /// The interface language: `en`, `pt`, `de`, `es` or `zh`. `None` follows the desktop (the Mac's + /// "System" choice), which is also what an unknown value means. + pub language: Option, } impl Default for Config { @@ -60,6 +63,7 @@ impl Default for Config { auto_update_check: true, monitor_tray_items: Vec::new(), never_quit: vec![], + language: None, } } } @@ -107,6 +111,11 @@ impl Config { Self::load_from(&Self::default_path()) } + /// Write the file the daemon reads at startup (`~/.config/menew/config.json`). + pub fn save(&self) -> std::io::Result<()> { + self.save_to(&Self::default_path()) + } + pub fn save_to(&self, path: &Path) -> std::io::Result<()> { if let Some(parent) = path.parent() { crate::private_fs::create_private_dir(parent)?; @@ -162,6 +171,18 @@ mod tests { assert!(!Config::load_from(&path).auto_update_check); } + #[test] + fn language_is_saved_and_missing_means_follow_the_desktop() { + let dir = tempfile::tempdir().unwrap(); + let path = Config::path_in(dir.path()); + assert_eq!(Config::default().language, None); + let cfg = Config { language: Some("pt".into()), ..Config::default() }; + cfg.save_to(&path).unwrap(); + assert_eq!(Config::load_from(&path).language.as_deref(), Some("pt")); + std::fs::write(&path, r#"{"paste_mode": "auto"}"#).unwrap(); + assert_eq!(Config::load_from(&path).language, None); + } + #[test] fn malformed_or_unknown_falls_back_to_defaults() { let dir = tempfile::tempdir().unwrap(); diff --git a/crates/menew-core/src/i18n.rs b/crates/menew-core/src/i18n.rs index 6622ddf..d914a3d 100644 --- a/crates/menew-core/src/i18n.rs +++ b/crates/menew-core/src/i18n.rs @@ -10,6 +10,9 @@ pub enum Language { } impl Language { + /// Every language the interface has, in the order the settings window lists them. + pub const ALL: [Language; 5] = [Language::En, Language::Pt, Language::De, Language::Es, Language::Zh]; + pub fn code(&self) -> &'static str { match self { Language::En => "en", diff --git a/crates/menew-core/src/palette.rs b/crates/menew-core/src/palette.rs index bd0bee4..2c4da22 100644 --- a/crates/menew-core/src/palette.rs +++ b/crates/menew-core/src/palette.rs @@ -543,6 +543,12 @@ fn commands(ctx: &PaletteContext) -> Vec { .icon(Icon::Symbol("system-run-symbolic")) .act(ItemAction::ToggleAutostart), ); + out.push( + PaletteItem::new("action.settings", Kind::Action, &tr("settings_title", lang, &[])) + .kw("settings configurar configuração preferências preferences einstellungen ajustes config 设置") + .icon(Icon::Symbol("emblem-system-symbolic")) + .act(ItemAction::Command("app.settings".into())), + ); // the Mac opens its welcome tour from the menu; here it is an action of the palette out.push( PaletteItem::new("action.welcome", Kind::Action, &tr("act_welcome", lang, &[])) diff --git a/crates/menew-core/src/strings_r1.rs b/crates/menew-core/src/strings_r1.rs index 6c1c2b6..3708147 100644 --- a/crates/menew-core/src/strings_r1.rs +++ b/crates/menew-core/src/strings_r1.rs @@ -128,4 +128,43 @@ pub(crate) static TABLE: &[(&str, [&str; 5])] = &[ ("sc_clipboard", ["Clipboard history", "Histórico do clipboard", "Zwischenablage-Verlauf", "Historial del portapapeles", "剪贴板历史"]), ("sc_paste_next", ["Paste the next item", "Colar o próximo item", "Nächsten Eintrag einfügen", "Pegar el siguiente elemento", "粘贴下一项"]), ("sc_capture_text", ["Copy text from the screen", "Copiar texto da tela", "Text vom Bildschirm kopieren", "Copiar texto de la pantalla", "复制屏幕上的文字"]), + // ---- settings window (linux; the Mac has its own settings view) ---- + ("settings_title", ["Settings", "Configurações", "Einstellungen", "Ajustes", "设置"]), + ("settings_general", ["General", "Geral", "Allgemein", "General", "通用"]), + ("settings_language", ["Language", "Idioma", "Sprache", "Idioma", "语言"]), + ("settings_language_system", ["System", "Sistema", "System", "Sistema", "系统"]), + ("settings_language_hint", ["Takes effect the next time Menew starts", "Passa a valer na próxima vez que o Menew iniciar", "Gilt ab dem nächsten Start von Menew", "Se aplica la próxima vez que se inicie Menew", "下次启动 Menew 时生效"]), + ("settings_autostart", ["Start at login", "Iniciar com o sistema", "Beim Anmelden starten", "Iniciar al iniciar sesión", "登录时启动"]), + ("settings_autostart_sub", ["So the shortcuts and the clipboard history are always there", "Para os atalhos e o histórico do clipboard estarem sempre lá", "Damit Kurzbefehle und Zwischenablage-Verlauf immer da sind", "Para que los atajos y el historial del portapapeles estén siempre ahí", "这样快捷键和剪贴板历史随时可用"]), + ("settings_welcome_sub", ["What Menew set up on this desktop, and the shortcuts to remember", "O que o Menew configurou neste desktop e os atalhos para lembrar", "Was Menew auf diesem Desktop eingerichtet hat, und die Kurzbefehle", "Lo que Menew configuró en este escritorio y los atajos", "Menew 在此桌面上的配置,以及要记住的快捷键"]), + ("settings_clipboard", ["Clipboard", "Área de transferência", "Zwischenablage", "Portapapeles", "剪贴板"]), + ("settings_paste_mode", ["After picking an entry", "Depois de escolher um item", "Nach dem Auswählen eines Eintrags", "Después de elegir una entrada", "选择条目后"]), + ("settings_paste_auto", ["Copy and paste", "Copiar e colar", "Kopieren und einfügen", "Copiar y pegar", "复制并粘贴"]), + ("settings_paste_copy", ["Only copy", "Somente copiar", "Nur kopieren", "Solo copiar", "仅复制"]), + ("settings_paste_sub", ["Pasting needs /dev/uinput access; otherwise Menew copies and asks for Ctrl+V", "Colar precisa de acesso ao /dev/uinput; sem ele o Menew copia e pede Ctrl+V", "Einfügen braucht Zugriff auf /dev/uinput; sonst kopiert Menew und bittet um Strg+V", "Pegar necesita acceso a /dev/uinput; si no, Menew copia y pide Ctrl+V", "粘贴需要 /dev/uinput 权限;否则 Menew 只复制并提示按 Ctrl+V"]), + ("settings_max_items", ["Entries kept", "Itens guardados", "Gespeicherte Einträge", "Entradas guardadas", "保留的条目"]), + ("settings_max_items_sub", ["Unpinned entries; pins are always kept", "Itens sem fixar; os fixados ficam sempre", "Einträge ohne Anheftung; Angeheftete bleiben immer", "Entradas sin fijar; las fijadas se guardan siempre", "未固定的条目;已固定的始终保留"]), + ("settings_auto_delete", ["Delete after (days)", "Apagar depois de (dias)", "Löschen nach (Tagen)", "Borrar después de (días)", "之后删除(天)"]), + ("settings_auto_delete_sub", ["0 keeps them forever", "0 guarda para sempre", "0 behält sie für immer", "0 las guarda para siempre", "0 表示永久保留"]), + ("settings_ocr", ["Read text in copied images", "Ler o texto de imagens copiadas", "Text in kopierten Bildern lesen", "Leer el texto de imágenes copiadas", "读取复制图片中的文字"]), + ("settings_ocr_sub", ["Needs tesseract; lets search find the text", "Precisa do tesseract; a busca passa a achar o texto", "Braucht tesseract; die Suche findet dann den Text", "Necesita tesseract; la búsqueda encuentra el texto", "需要 tesseract;搜索即可找到文字"]), + ("settings_ignored_apps", ["Apps that are not saved", "Apps que não são guardados", "Apps, die nicht gespeichert werden", "Apps que no se guardan", "不保存的应用"]), + ("settings_ignored_apps_sub", ["Comma separated ids; GNOME only", "Ids separados por vírgula; só no GNOME", "Durch Kommas getrennte Ids; nur GNOME", "Ids separados por comas; solo GNOME", "用逗号分隔的 ID;仅 GNOME"]), + ("settings_updates", ["Updates", "Atualizações", "Updates", "Actualizaciones", "更新"]), + ("settings_auto_update", ["Check for updates automatically", "Procurar atualizações sozinho", "Automatisch nach Updates suchen", "Buscar actualizaciones automáticamente", "自动检查更新"]), + ("settings_auto_update_sub", ["Once a day, reading only the GitHub release list", "Uma vez por dia, lendo só a lista de releases do GitHub", "Einmal pro Tag, nur die GitHub-Release-Liste", "Una vez al día, solo la lista de versiones de GitHub", "每天一次,只读取 GitHub 发布列表"]), + ("settings_check_now", ["Check for updates now", "Procurar atualizações agora", "Jetzt nach Updates suchen", "Buscar actualizaciones ahora", "立即检查更新"]), + ("settings_tray", ["Tray", "Bandeja", "Infobereich", "Bandeja", "托盘"]), + ("settings_tray_metrics", ["Metrics in the tray", "Métricas na bandeja", "Messwerte im Infobereich", "Métricas en la bandeja", "托盘中的指标"]), + ("settings_tray_sub", ["KDE shows the text in the panel; GNOME shows it in the tooltip", "O KDE mostra o texto no painel; o GNOME mostra na dica", "KDE zeigt den Text im Panel; GNOME im Tooltip", "KDE muestra el texto en el panel; GNOME en la información", "KDE 在面板显示文字;GNOME 在提示中显示"]), + ("metric_cpu", ["CPU", "CPU", "CPU", "CPU", "CPU"]), + ("metric_cpu_graph", ["CPU graph", "Gráfico da CPU", "CPU-Diagramm", "Gráfico de CPU", "CPU 图表"]), + ("metric_ram", ["Memory", "Memória", "Arbeitsspeicher", "Memoria", "内存"]), + ("metric_net", ["Network", "Rede", "Netzwerk", "Red", "网络"]), + ("metric_disk", ["Disk", "Disco", "Datenträger", "Disco", "磁盘"]), + ("metric_battery", ["Battery", "Bateria", "Akku", "Batería", "电池"]), + ("settings_saved", ["Saved", "Salvo", "Gespeichert", "Guardado", "已保存"]), + ("settings_about", ["About", "Sobre", "Info", "Acerca de", "关于"]), + ("settings_version", ["Version {}", "Versão {}", "Version {}", "Versión {}", "版本 {}"]), + ("settings_website", ["Website", "Site", "Webseite", "Sitio web", "网站"]), ]; diff --git a/crates/menew-tray/src/lib.rs b/crates/menew-tray/src/lib.rs index bb5ce63..16d4499 100644 --- a/crates/menew-tray/src/lib.rs +++ b/crates/menew-tray/src/lib.rs @@ -6,6 +6,8 @@ pub enum TrayCommand { OpenPalette, OpenClipboard, OpenMonitor, + /// Open the settings window. + OpenSettings, /// Delete every unpinned clipboard entry. ClearHistory, /// Pause the clipboard capture until resumed, or resume it. @@ -119,6 +121,7 @@ mod linux_impl { let tx_open = self.tx.clone(); let tx_clip = self.tx.clone(); let tx_mon = self.tx.clone(); + let tx_settings = self.tx.clone(); let tx_clear = self.tx.clone(); let tx_pause = self.tx.clone(); let tx_next = self.tx.clone(); @@ -174,6 +177,15 @@ mod linux_impl { ..Default::default() } .into(), + StandardItem { + label: menew_core::t("settings_title").to_string(), + activate: Box::new(move |_| { + info!("Tray: settings requested"); + let _ = tx_settings.send(TrayCommand::OpenSettings); + }), + ..Default::default() + } + .into(), StandardItem { label: menew_core::t("tray_clear_history").to_string(), activate: Box::new(move |_| { diff --git a/crates/menew-ui/Cargo.toml b/crates/menew-ui/Cargo.toml index 62f47b3..02c9b3b 100644 --- a/crates/menew-ui/Cargo.toml +++ b/crates/menew-ui/Cargo.toml @@ -12,5 +12,5 @@ tracing = "0.1" [target.'cfg(target_os = "linux")'.dependencies] gtk4 = { version = "0.9", package = "gtk4" } -libadwaita = { version = "0.7", package = "libadwaita", features = ["v1_2"] } +libadwaita = { version = "0.7", package = "libadwaita", features = ["v1_5"] } pangocairo = "0.20" diff --git a/crates/menew-ui/src/lib.rs b/crates/menew-ui/src/lib.rs index e034046..df67b0b 100644 --- a/crates/menew-ui/src/lib.rs +++ b/crates/menew-ui/src/lib.rs @@ -87,6 +87,8 @@ pub use monitor_view::{MonitorWidget, MonitorWindow}; pub mod dialogs; #[cfg(target_os = "linux")] pub mod welcome; +#[cfg(target_os = "linux")] +pub mod settings; #[cfg(target_os = "linux")] pub mod palette { @@ -1076,8 +1078,8 @@ pub mod palette { .subtitle("\u{2022}\u{2022}\u{2022}\u{2022}\u{2022}\u{2022}\u{2022}\u{2022}") .title_lines(1) .subtitle_lines(1) - .icon_name("dialog-password-symbolic") .build(); + row.add_prefix(>k4::Image::from_icon_name("dialog-password-symbolic")); self.list_box.append(&row); } *self.visible_passwords.borrow_mut() = found; @@ -1094,8 +1096,8 @@ pub mod palette { .title_lines(1) .subtitle_lines(1) .use_markup(false) - .icon_name("insert-text-symbolic") .build(); + row.add_prefix(>k4::Image::from_icon_name("insert-text-symbolic")); self.list_box.append(&row); } *self.visible_snippets.borrow_mut() = found; diff --git a/crates/menew-ui/src/notes_view.rs b/crates/menew-ui/src/notes_view.rs index b32aa52..70ad6ff 100644 --- a/crates/menew-ui/src/notes_view.rs +++ b/crates/menew-ui/src/notes_view.rs @@ -526,7 +526,8 @@ impl NotesApp { sub = if sub.is_empty() { tags_line } else { format!("{sub}\n{tags_line}") }; } let age = format_age(age_between(now_ms, ((n.updated + notes::SWIFT_EPOCH_OFFSET) * 1000.0) as i64)); - let row = adw::ActionRow::builder().title(glib::markup_escape_text(&n.title(lang))).subtitle(glib::markup_escape_text(&sub)).title_lines(1).subtitle_lines(2).activatable(true).icon_name(icon).build(); + let row = adw::ActionRow::builder().title(glib::markup_escape_text(&n.title(lang))).subtitle(glib::markup_escape_text(&sub)).title_lines(1).subtitle_lines(2).activatable(true).build(); + row.add_prefix(>k4::Image::from_icon_name(icon)); row.add_suffix(>k4::Label::builder().label(age).css_classes(["dim-label", "caption"]).build()); ui.list.append(&row); ids.push(n.id.clone()); diff --git a/crates/menew-ui/src/settings.rs b/crates/menew-ui/src/settings.rs new file mode 100644 index 0000000..ee6c665 --- /dev/null +++ b/crates/menew-ui/src/settings.rs @@ -0,0 +1,364 @@ +//! The settings window (`menew settings`, the palette and the tray). The Mac has its own Settings view; +//! here it is a libadwaita preferences window over `~/.config/menew/config.json`, so nobody has to edit +//! JSON by hand. Everything is saved the moment it changes. Two things are read by the daemon when it +//! starts (the interface language and the clipboard service), so the window says so instead of pretending +//! the change already happened. + +use gtk4::prelude::*; +use libadwaita as adw; +use libadwaita::prelude::*; +use menew_core::strings::tr; +use menew_core::{autostart, current_language, Config, Language}; +use std::cell::RefCell; +use std::rc::Rc; +use tracing::{info, warn}; + +/// What the window asks of the daemon for the rows that are not a plain `config.json` key. +pub struct SettingsHooks { + /// "Welcome and setup": the setup window of the first start. + pub show_welcome: Rc, + /// "Check for updates now". + pub check_updates: Rc, + /// Turn the automatic update check on or off; the daemon's updater owns that state. + pub set_auto_update: Rc, +} + +pub struct SettingsWindow { + window: adw::PreferencesWindow, + config: Rc>, +} + +/// The name of a language in that language (never translated). +fn language_name(lang: Language) -> &'static str { + match lang { + Language::En => "English", + Language::Pt => "Português", + Language::De => "Deutsch", + Language::Es => "Español", + Language::Zh => "中文", + } +} + +fn language_index(lang: Language) -> u32 { + Language::ALL.iter().position(|l| *l == lang).map(|i| i as u32 + 1).unwrap_or(0) +} + +fn toast(window: &adw::PreferencesWindow, text: &str) { + window.add_toast(adw::Toast::new(text)); +} + +fn save(window: &adw::PreferencesWindow, config: &Rc>, lang: Language) { + match config.borrow().save() { + Ok(()) => toast(window, &tr("settings_saved", lang, &[])), + Err(e) => { + warn!("Settings: could not write config.json: {}", e); + toast(window, &format!("config.json: {e}")); + } + } +} + +fn action_row(title: &str, subtitle: &str) -> adw::ActionRow { + let row = adw::ActionRow::builder().title(title).subtitle(subtitle).activatable(true).build(); + row.add_suffix(>k4::Image::from_icon_name("go-next-symbolic")); + row +} + +fn switch_row(title: &str, subtitle: &str, active: bool) -> adw::SwitchRow { + adw::SwitchRow::builder().title(title).subtitle(subtitle).active(active).build() +} + +impl SettingsWindow { + pub fn new(app: &adw::Application, hooks: SettingsHooks) -> Rc { + let lang = current_language(); + let config = Rc::new(RefCell::new(Config::load())); + let window = adw::PreferencesWindow::builder() + .application(app) + .search_enabled(false) + .build(); + window.set_title(Some(&tr("settings_title", lang, &[]))); + window.set_hide_on_close(true); + window.set_default_size(640, 720); + + // ---- General: language, start at login, welcome, updates ---- + let general = adw::PreferencesPage::new(); + general.set_title(&tr("settings_general", lang, &[])); + let group = adw::PreferencesGroup::new(); + + let mut names = vec![tr("settings_language_system", lang, &[])]; + names.extend(Language::ALL.iter().map(|l| language_name(*l).to_string())); + let name_refs: Vec<&str> = names.iter().map(String::as_str).collect(); + let model = gtk4::StringList::new(&name_refs); + let combo = adw::ComboRow::builder().title(tr("settings_language", lang, &[])).model(&model).build(); + combo.set_subtitle(&tr("settings_language_hint", lang, &[])); + let chosen = config.borrow().language.as_deref().map(Language::from_code).map(language_index).unwrap_or(0); + combo.set_selected(chosen); + { + let config = Rc::clone(&config); + let window = window.clone(); + combo.connect_selected_notify(move |row| { + let selected = row.selected(); + let want = if selected == 0 { + None + } else { + Language::ALL.get(selected as usize - 1).map(|l| l.code().to_string()) + }; + if config.borrow().language == want { + return; + } + config.borrow_mut().language = want.clone(); + // most of the interface is built when the daemon starts: the change is applied then + let lang = want.as_deref().map(Language::from_code).unwrap_or_else(Language::detect); + info!("Settings: language set to {:?} for the next start", lang); + save(&window, &config, current_language()); + }); + } + group.add(&combo); + + let login = switch_row( + &tr("settings_autostart", lang, &[]), + &tr("settings_autostart_sub", lang, &[]), + autostart::is_enabled(), + ); + { + login.connect_active_notify(move |row| { + let want = row.is_active(); + if autostart::is_enabled() == want { + return; + } + match autostart::set_enabled(want) { + Ok(()) => info!("Settings: start at login set to {}", want), + Err(e) => { + warn!("Settings: could not change start at login: {}", e); + // put the switch back where the desktop really is + row.set_active(!want); + } + } + }); + } + group.add(&login); + general.add(&group); + + let actions = adw::PreferencesGroup::new(); + let welcome = action_row(&tr("act_welcome", lang, &[]), &tr("settings_welcome_sub", lang, &[])); + { + let hook = Rc::clone(&hooks.show_welcome); + let window = window.clone(); + welcome.connect_activated(move |_| { + window.set_visible(false); + hook(); + }); + } + actions.add(&welcome); + let check = action_row(&tr("settings_check_now", lang, &[]), &tr("settings_auto_update_sub", lang, &[])); + { + let hook = Rc::clone(&hooks.check_updates); + check.connect_activated(move |_| hook()); + } + actions.add(&check); + general.add(&actions); + window.add(&general); + + // ---- Clipboard ---- + let clipboard = adw::PreferencesPage::new(); + clipboard.set_title(&tr("settings_clipboard", lang, &[])); + let clip_group = adw::PreferencesGroup::new(); + + let modes = gtk4::StringList::new(&[ + &tr("settings_paste_auto", lang, &[]), + &tr("settings_paste_copy", lang, &[]), + ]); + let paste = adw::ComboRow::builder().title(tr("settings_paste_mode", lang, &[])).model(&modes).build(); + paste.set_subtitle(&tr("settings_paste_sub", lang, &[])); + paste.set_selected(if config.borrow().paste_mode == menew_core::config::PasteMode::CopyOnly { 1 } else { 0 }); + { + let config = Rc::clone(&config); + let window = window.clone(); + paste.connect_selected_notify(move |row| { + let want = if row.selected() == 1 { + menew_core::config::PasteMode::CopyOnly + } else { + menew_core::config::PasteMode::Auto + }; + if config.borrow().paste_mode == want { + return; + } + config.borrow_mut().paste_mode = want; + save(&window, &config, current_language()); + }); + } + clip_group.add(&paste); + + let max = adw::SpinRow::builder() + .title(tr("settings_max_items", lang, &[])) + .subtitle(tr("settings_max_items_sub", lang, &[])) + .adjustment(>k4::Adjustment::new(config.borrow().clipboard_max_items as f64, 20.0, 5000.0, 10.0, 100.0, 0.0)) + .climb_rate(10.0) + .build(); + { + let config = Rc::clone(&config); + let window = window.clone(); + max.connect_value_notify(move |row| { + let want = row.value().round().max(20.0) as usize; + if config.borrow().clipboard_max_items == want { + return; + } + config.borrow_mut().clipboard_max_items = want; + save(&window, &config, current_language()); + }); + } + clip_group.add(&max); + + let days = adw::SpinRow::builder() + .title(tr("settings_auto_delete", lang, &[])) + .subtitle(tr("settings_auto_delete_sub", lang, &[])) + .adjustment(>k4::Adjustment::new(config.borrow().clipboard_auto_delete_days as f64, 0.0, 365.0, 1.0, 10.0, 0.0)) + .climb_rate(1.0) + .build(); + { + let config = Rc::clone(&config); + let window = window.clone(); + days.connect_value_notify(move |row| { + let want = row.value().round().max(0.0) as u32; + if config.borrow().clipboard_auto_delete_days == want { + return; + } + config.borrow_mut().clipboard_auto_delete_days = want; + save(&window, &config, current_language()); + }); + } + clip_group.add(&days); + + let ocr = switch_row(&tr("settings_ocr", lang, &[]), &tr("settings_ocr_sub", lang, &[]), config.borrow().clipboard_ocr); + { + let config = Rc::clone(&config); + let window = window.clone(); + ocr.connect_active_notify(move |row| { + let want = row.is_active(); + if config.borrow().clipboard_ocr == want { + return; + } + config.borrow_mut().clipboard_ocr = want; + save(&window, &config, current_language()); + }); + } + clip_group.add(&ocr); + + let ignored = adw::EntryRow::builder() + .title(tr("settings_ignored_apps", lang, &[])) + .text(config.borrow().clipboard_ignored_apps.join(", ")) + .build(); + ignored.set_tooltip_text(Some(&tr("settings_ignored_apps_sub", lang, &[]))); + { + let config = Rc::clone(&config); + let window = window.clone(); + ignored.connect_changed(move |row| { + let want: Vec = row + .text() + .split(',') + .map(|s| s.trim().to_string()) + .filter(|s| !s.is_empty()) + .collect(); + if config.borrow().clipboard_ignored_apps == want { + return; + } + config.borrow_mut().clipboard_ignored_apps = want; + save(&window, &config, current_language()); + }); + } + clip_group.add(&ignored); + clipboard.add(&clip_group); + window.add(&clipboard); + + // ---- Updates ---- + let updates = adw::PreferencesPage::new(); + updates.set_title(&tr("settings_updates", lang, &[])); + let upd_group = adw::PreferencesGroup::new(); + let auto = switch_row( + &tr("settings_auto_update", lang, &[]), + &tr("settings_auto_update_sub", lang, &[]), + config.borrow().auto_update_check, + ); + { + let config = Rc::clone(&config); + let window = window.clone(); + let hook = Rc::clone(&hooks.set_auto_update); + auto.connect_active_notify(move |row| { + let want = row.is_active(); + if config.borrow().auto_update_check == want { + return; + } + config.borrow_mut().auto_update_check = want; + hook(want); + save(&window, &config, current_language()); + }); + } + upd_group.add(&auto); + updates.add(&upd_group); + window.add(&updates); + + // ---- Tray metrics ---- + let tray = adw::PreferencesPage::new(); + tray.set_title(&tr("settings_tray", lang, &[])); + let tray_group = adw::PreferencesGroup::new(); + tray_group.set_title(&tr("settings_tray_metrics", lang, &[])); + tray_group.set_description(Some(&tr("settings_tray_sub", lang, &[]))); + let metrics = [ + ("cpu", "metric_cpu"), + ("cpuGraph", "metric_cpu_graph"), + ("ram", "metric_ram"), + ("net", "metric_net"), + ("disk", "metric_disk"), + ("battery", "metric_battery"), + ]; + for (id, key) in metrics { + let row = switch_row(&tr(key, lang, &[]), "", config.borrow().monitor_tray_items.iter().any(|m| m == id)); + { + let config = Rc::clone(&config); + let window = window.clone(); + row.connect_active_notify(move |row| { + let want = row.is_active(); + let mut items = config.borrow().monitor_tray_items.clone(); + let has = items.iter().any(|m| m == id); + if has == want { + return; + } + if want { + items.push(id.to_string()); + } else { + items.retain(|m| m != id); + } + config.borrow_mut().monitor_tray_items = items; + save(&window, &config, current_language()); + }); + } + tray_group.add(&row); + } + tray.add(&tray_group); + window.add(&tray); + + // ---- About ---- + let about = adw::PreferencesPage::new(); + about.set_title(&tr("settings_about", lang, &[])); + let about_group = adw::PreferencesGroup::new(); + about_group.add(&adw::ActionRow::builder().title("Menew").subtitle(tr("settings_version", lang, &[env!("CARGO_PKG_VERSION")])).build()); + let site = action_row(&tr("settings_website", lang, &[]), "menew.pururucos.com.br"); + site.connect_activated(|_| { + let _ = gtk4::gio::AppInfo::launch_default_for_uri("https://menew.pururucos.com.br/linux", gtk4::gio::AppLaunchContext::NONE); + }); + about_group.add(&site); + about.add(&about_group); + window.add(&about); + + Rc::new(Self { window, config }) + } + + pub fn show(&self) { + self.window.present(); + info!("Settings window presented"); + } + + /// The config as it is now (tests). + pub fn config(&self) -> Config { + self.config.borrow().clone() + } +} diff --git a/crates/menew/Cargo.toml b/crates/menew/Cargo.toml index 9cf7a5a..151e190 100644 --- a/crates/menew/Cargo.toml +++ b/crates/menew/Cargo.toml @@ -17,7 +17,7 @@ tracing = "0.1" tracing-subscriber = { version = "0.3", features = ["env-filter"] } [target.'cfg(target_os = "linux")'.dependencies] -libadwaita = { version = "0.7", package = "libadwaita", features = ["v1_2"] } +libadwaita = { version = "0.7", package = "libadwaita", features = ["v1_5"] } gtk4 = { version = "0.9", package = "gtk4" } zbus = { version = "5", default-features = false, features = ["tokio"] } ashpd = { version = "0.10", default-features = false, features = ["tokio", "tracing"] } diff --git a/crates/menew/src/main.rs b/crates/menew/src/main.rs index 4fa6dd4..ca2f1a6 100644 --- a/crates/menew/src/main.rs +++ b/crates/menew/src/main.rs @@ -64,6 +64,8 @@ enum Action { ClipboardView(String, String), /// Open the notes window. ShowNotes, + /// `menew settings`: the settings window (also the palette and the tray). + ShowSettings, /// Test hooks: create a note (`text`, `secure` or `passwords`, then the text), open one by id, or paste the /// password or username of a row of the Passwords filter. NotesCreate(String, String), @@ -130,6 +132,8 @@ fn decide(args: &[String], is_remote: bool, test_mode: bool) -> Action { Action::ShowClipboard } else if args.iter().any(|a| a == "notes") { Action::ShowNotes + } else if args.iter().any(|a| a == "settings") { + Action::ShowSettings } else if args.iter().any(|a| a == "capture-full") { Action::CaptureFull } else if args.iter().any(|a| a == "capture-text") { @@ -260,10 +264,10 @@ fn main() -> Result<(), Box> { info!("Starting Menew Linux"); - // Language detection - let detected_lang = Language::detect(); - set_language(detected_lang); - info!("Language set to: {:?}", detected_lang); + // The language chosen in the settings window, else the one of the desktop + let chosen_lang = menew_core::Config::load().language.as_deref().map(Language::from_code).unwrap_or_else(Language::detect); + set_language(chosen_lang); + info!("Language set to: {:?}", chosen_lang); #[cfg(target_os = "linux")] { @@ -371,6 +375,7 @@ fn run_gtk_app(args: Vec) { let commands_cell: Rc>>> = Rc::new(RefCell::new(None)); let setup_cell: Rc>>> = Rc::new(RefCell::new(None)); + let settings_cell: Rc>>> = Rc::new(RefCell::new(None)); let test_mode_env = std::env::var("MENEW_TEST").map(|v| v == "1").unwrap_or(false); // connect_startup is guaranteed to execute ONLY on the primary instance @@ -380,6 +385,7 @@ fn run_gtk_app(args: Vec) { let rt_startup = Arc::clone(&rt); let w_startup = Rc::clone(&watcher_cell); let s_startup = Rc::clone(&setup_cell); + let set_startup = Rc::clone(&settings_cell); app.connect_startup(move |application| { info!("GApplication startup: primary instance initializing background services"); @@ -473,6 +479,25 @@ fn run_gtk_app(args: Vec) { let vault: Rc = Rc::new(menew_clipboard::secrets::SecretServiceVault); let notes_store = menew_core::notes::NotesStore::load_default(vault); let notes = menew_ui::notes_view::NotesApp::new(application, notes_store, Arc::new(menew_clipboard::secrets::PolkitAuthenticator)); + // the settings window: config.json with a way to change it, plus the welcome and the update check + let settings = menew_ui::settings::SettingsWindow::new( + application, + menew_ui::settings::SettingsHooks { + show_welcome: { + let s = Rc::clone(&setup); + Rc::new(move || s.show_welcome(false)) + }, + check_updates: { + let u = Rc::clone(&updater); + Rc::new(move || u.check_manual()) + }, + set_auto_update: { + let u = Rc::clone(&updater); + Rc::new(move |on| u.set_auto(on)) + }, + }, + ); + *set_startup.borrow_mut() = Some(Rc::clone(&settings)); // the screen: the system takes the capture (screenshot portal), the answer comes back to the GTK thread let rt_portal = Arc::clone(&rt_startup); let portal: menew_ui::screen::Portal = Rc::new(move |interactive, done| { @@ -512,6 +537,17 @@ fn run_gtk_app(args: Vec) { let p = Rc::clone(&palette); setup.set_open_menew(Rc::new(move || p.show())); } + // the palette's Settings item and `menew run app.settings` + { + let s = Rc::clone(&settings); + cmds.add_runner(Rc::new(move |c: &str| { + if c != "app.settings" { + return false; + } + s.show(); + true + })); + } *c_startup.borrow_mut() = Some(Rc::clone(&cmds)); let db_tray = db.clone(); @@ -638,12 +674,18 @@ fn run_gtk_app(args: Vec) { let tray_ctl = Rc::clone(&control); let app_handle = application.clone(); let upd_tray = Rc::clone(&updater); + let set_tray = Rc::clone(&set_startup); glib::MainContext::default().spawn_local(async move { while let Some(cmd) = tray_rx.recv().await { match cmd { TrayCommand::OpenPalette => p_tray.toggle(), TrayCommand::OpenClipboard => p_tray.show_mode(PaletteMode::Clipboard), TrayCommand::OpenMonitor => p_tray.open_monitor(), + TrayCommand::OpenSettings => { + if let Some(s) = set_tray.borrow().as_ref() { + s.show(); + } + } TrayCommand::ClearHistory => match db_tray.clear_unpinned() { Ok(n) => info!("Tray: cleared {} unpinned clipboard entries", n), Err(e) => warn!("Tray: failed to clear clipboard history: {}", e), @@ -699,6 +741,7 @@ fn run_gtk_app(args: Vec) { let app_cmd = app.clone(); let upd_cmd = Rc::clone(&updater_cell); let s_cmd = Rc::clone(&setup_cell); + let set_cmd = Rc::clone(&settings_cell); app.connect_command_line(move |_application, cmd_line| { let cmd_args: Vec = cmd_line .arguments() @@ -787,6 +830,11 @@ fn run_gtk_app(args: Vec) { palette.notes().show(); } } + Action::ShowSettings => { + if let Some(s) = set_cmd.borrow().as_ref() { + s.show(); + } + } Action::NotesCreate(kind, text) => { if let Some(palette) = p_cmd.borrow().as_ref() { let text = text.replace("\\n", "\n"); diff --git a/crates/menew/src/updater.rs b/crates/menew/src/updater.rs index 05e4f46..cc50dba 100644 --- a/crates/menew/src/updater.rs +++ b/crates/menew/src/updater.rs @@ -73,7 +73,14 @@ impl Updater { } pub fn toggle_auto(&self) { - let want = !self.auto.get(); + self.set_auto(!self.auto.get()); + } + + /// Turn the automatic check on or off (the tray and the settings window). + pub fn set_auto(&self, want: bool) { + if self.auto.get() == want { + return; + } self.auto.set(want); let mut cfg = menew_core::Config::load(); cfg.auto_update_check = want; diff --git a/data/app.menew.Menew.desktop b/data/app.menew.Menew.desktop index 07e1a1f..91413ba 100644 --- a/data/app.menew.Menew.desktop +++ b/data/app.menew.Menew.desktop @@ -12,7 +12,7 @@ Terminal=false Categories=Utility; Keywords=launcher;clipboard;palette;calculator;screenshot;notes; StartupNotify=false -Actions=clipboard;capture;new-note;welcome; +Actions=clipboard;capture;new-note;welcome;settings; [Desktop Action clipboard] Name=Clipboard history @@ -38,6 +38,14 @@ Name[es]=Nueva nota Name[zh_CN]=新建笔记 Exec=menew run note.new +[Desktop Action settings] +Name=Settings +Name[pt]=Configurações +Name[de]=Einstellungen +Name[es]=Ajustes +Name[zh_CN]=设置 +Exec=menew settings + [Desktop Action welcome] Name=Welcome and setup Name[pt]=Boas-vindas e configuração diff --git a/docs/monitor-spec.md b/docs/monitor-spec.md index caad96e..3f441f1 100644 --- a/docs/monitor-spec.md +++ b/docs/monitor-spec.md @@ -63,7 +63,7 @@ In a table cell `-` means "nothing / none". Cells never contain a pipe character AppIndicator shows only the icon, so on GNOME the metrics are in the tooltip only (where the extension shows it). The Mac `temp` item needs sensors (R2) and is not offered. - **Choice of items**: `monitor_tray_items` in `config.json` (the Mac `menuBarItems`). Empty by default: nothing - is sampled until the user opts in, because the settings window only comes in Phase 11. + is sampled until the user opts in in the settings window (`menew settings`). ## Vectors diff --git a/docs/parity.md b/docs/parity.md index 14a8487..8d3d614 100644 --- a/docs/parity.md +++ b/docs/parity.md @@ -19,10 +19,10 @@ Licence: GPL-3.0-only, the same as the Mac app; name and icon under `TRADEMARK.m | Math (`12*7.5`, `20% of 340`) | ✅ | ✅ | R1 | Own parser like the Mac: `+ - * / ^ x × ÷ % ! √`, `pi`, `e`, `sqrt sin cos tan log ln abs round`, `2(3+1)`, `200+10%`. Decimal comma or point; result uses the language's decimal separator. `calculator.rs`. | | Unit conversions (`5 km to mi`, `72 f to c`) | ✅ | ✅ | R1 | Same unit list and aliases as the Mac (length, mass, volume, data, time, speed, area, temperature) and the same connectors in 5 languages. `conversions.rs`. | | Currency conversion (`100 usd to brl`, fetched on ↩) | ✅ | ✅ | R1 | Same 24 currencies and provider (ECB through `api.frankfurter.app`), fetched only on Enter, cached 6 h. The request goes through the system `curl` (no HTTP/TLS crate in the tree). Currency text (`$100.00`, `R$ 100,00`, `100,00 €`) follows hand-written locale rules instead of Foundation's. `currency.rs`. | -| Time zones (`3pm ny to lisbon`) and world clocks | ✅ | 🟡 | R1 | Time zones: same aliases (pt, en, de, es, zh) and cities of the tz database, DST through `date` with `TZ` (needs tzdata and coreutils). World clocks: the list is in `~/.config/menew/config.json` (`world_clocks`) and typing `clocks` shows them in the palette; the card at the top of the Now tab and the settings window come in Phase 11. `time_zones.rs`. | +| Time zones (`3pm ny to lisbon`) and world clocks | ✅ | 🟡 | R1 | Time zones: same aliases (pt, en, de, es, zh) and cities of the tz database, DST through `date` with `TZ` (needs tzdata and coreutils). World clocks: the list is in `~/.config/menew/config.json` (`world_clocks`) and typing `clocks` shows them in the palette; the card at the top of the Now tab and an editor in the settings window are still missing. `time_zones.rs`. | | Text transforms (case, accents, sort/dedupe, JSON, Base64, URL, counts) with live preview | ✅ | ✅ | R1 | All 20 transforms, with the same keywords in 5 languages and the preview (first 200 characters, `⏎` between lines, none above 100,000 bytes). Applies to the clipboard text read by GTK while the palette is open, else the newest history entry. Word counts use letter and digit runs, not Apple's word breaker. `text_transforms.rs`. | | Developer tools (JWT decode, UUID, Unix timestamp) | ✅ | ✅ | R1 | JWT (with `exp`/`iat`/`nbf` dates), UUID v4, Unix timestamp now, and a pasted 10 or 13 digit timestamp shown as a date (Enter copies the ISO date). The long date text is written by hand per language and can differ from macOS. `dev_tools.rs`. | -| Quick links (`g`, `gh`, `maps`, `yt`, `wiki`, custom `{q}`), open typed addresses, web search | ✅ | ✅ | R1 | Same six defaults (`maps` opens OpenStreetMap: the Mac uses its native Apple Maps, Linux has no native map app, and copied addresses also open in OpenStreetMap; edit `quick_links` in `config.json` to use another map). Custom links live in `~/.config/menew/config.json` until the settings window (Phase 11). Opens with the default browser. `quick_links.rs`. | +| Quick links (`g`, `gh`, `maps`, `yt`, `wiki`, custom `{q}`), open typed addresses, web search | ✅ | ✅ | R1 | Same six defaults (`maps` opens OpenStreetMap: the Mac uses its native Apple Maps, Linux has no native map app, and copied addresses also open in OpenStreetMap; edit `quick_links` in `config.json` to use another map). Custom links live in `~/.config/menew/config.json`; the settings window has no editor for them yet. Opens with the default browser. `quick_links.rs`. | | Emoji and symbols (`emoji rocket`, `:fire`, arrow/degree/euro) | ✅ | ✅ | R1 | Same filter and word table as the Mac; names come from the Unicode data of the build host (`emoji_data.rs`, generated). The Apple logo symbol is left out. Pasting uses the same path as the clipboard (uinput or copy + notification). `emoji.rs`. | | Timers and alarms (`timer 10m tea`, `alarm 7:30`), countdown in the tray | ✅ | ✅ | R1 | Countdown in the StatusNotifierItem `Title` and `ToolTip` (KDE shows the tooltip; GNOME depends on the AppIndicator extension). At the end: a notification and the sound of the freedesktop theme (`canberra-gtk-play`, else `paplay`, else a beep). In memory only. The Mac's HUD toasts ("Copied: x", "Timer until 9:10") are desktop notifications here. `timers.rs`, `crates/menew/src/alerts.rs`. | | Focus timer (`focus 50`) | ✅ | 🟡 | R1 | Same flow: 25 min default, `focus N` (1 to 600), +5 min, stop, 5 min break (`focus_breaks` in `config.json`), notification and sound at the end, countdown in the tray. The options that mute the microphone, keep the computer awake or pause the clipboard while focusing are the `FocusHooks` trait, empty today: they come with the quick actions (Phase 9) and the clipboard pause (Phase 5). `focus.rs`. | @@ -66,7 +66,7 @@ Licence: GPL-3.0-only, the same as the Mac app; name and icon under `TRADEMARK.m | Feature | Mac | Linux | R1 | Notes | |---|---|---|---|---| -| Capture area / window / screen with a shortcut | ✅ | 🟡 | R1 | `org.freedesktop.portal.Screenshot` (`portal.rs`), `interactive` so the system shows its own picker; `Ctrl+Alt+Shift+S` (GlobalShortcuts portal), `menew capture`, `menew capture-full`, the palette and the tray. The file the portal writes is deleted right after it is read (the Mac deletes its temporary file). A portal failure shows `cap_portal_failed`, there is no silent fallback. **Limited**: the portal itself could not run in the headless sessions (`A portal frontend implementing org.freedesktop.portal.Screenshot was not found`), so the picture came from the test hook `__capture-from` there; the real picker and the shortcut are not tested on a real desktop. The Mac captures the screen with the mouse for "whole screen", the portal chooses the screen. | +| Capture area / window / screen with a shortcut | ✅ | 🟡 | R1 | `org.freedesktop.portal.Screenshot` (`portal.rs`), `interactive` so the system shows its own picker; `Ctrl+Alt+Shift+S` (GlobalShortcuts portal), `menew capture`, `menew capture-full`, the palette and the tray. The file the portal writes is deleted right after it is read (the Mac deletes its temporary file). A portal failure shows `cap_portal_failed`. **GNOME: every capture goes through the picker**; a silent capture is refused there, because GNOME 45 to 47 ask for the "screenshot" permission in a system dialog that is only shown to the app in front, and Menew is a background daemon (found on a real GNOME 46 session: the portal answered `Other` and nothing was saved). KDE: a silent capture is tried first, with the picker as the fallback. The Mac captures the screen with the mouse for "whole screen", the portal chooses the screen. **Not yet verified on a real desktop**: the picker itself and the shortcut. | | Annotate (pen, arrows, rectangles, text, blur), copy, save, drag | ✅ | ✅ | R1 | `menew-ui/src/screen.rs` `Editor`, rules in `capture.rs`: same line width, font size, arrow head, text outline, 8 colors and thresholds as `Capture.swift`; blur really pixelates (the pixelated image shown inside the box; checked pixel by pixel in the desktop test). Copy puts the image on the clipboard (and so in the history), Save opens a file dialog in the Desktop folder with `Screenshot .png`, drag gives a file `Screenshot.png` and the image. Not verified: the drag itself (needs a pointer) and the file dialog (portal) in the headless sessions. No "Pin" button (not in release 1). The Mac also keeps a copy in Memory (not in release 1). Vectors in `docs/screenshots-spec.md`. | | Pin a screenshot floating on screen | ✅ | 🟡 | | Not in release 1. A normal always-on-top window is not guaranteed on Wayland. The editor has no "Pin" button. | | Copy text from the screen (OCR) | ✅ | ✅ | R1 | `Ctrl+Alt+Shift+T`, `menew capture-text`, the palette, the tray, and the "Copy text" button of the editor (reads the capture without the marks). Portal + `tesseract` (`ocr.rs`, reused from Phase 5); messages "Reading text…", "Text copied", "Text copied (N lines)", "No text found" as on the Mac; the picture given to tesseract is a file in the private runtime folder, deleted when read. Tested with a generated image with a known text. | @@ -116,7 +116,7 @@ Licence: GPL-3.0-only, the same as the Mac app; name and icon under `TRADEMARK.m |---|---|---|---|---| | CPU, GPU, memory, swap, disk, battery, network live | ✅ | 🟡 | R1 | DONE in Phase 10 (`monitor.rs`, `monitor_view.rs`, vectors in `docs/monitor-spec.md`). `/proc/stat`, `/proc/meminfo`, `/proc/net/dev`, `statvfs`, `/sys/class/power_supply`. Limited: GPU only on AMD (`gpu_busy_percent`; Intel and NVIDIA report no load in sysfs, so the card is hidden, never an estimate); memory pressure is derived from the available share (no Linux level); battery times are computed from energy and power; the disk read/write speed, per-core efficiency/performance split, uptime and local IP of the Mac cards are not done. | | Top processes (quit in one click) | ✅ | ✅ | R1 | DONE in Phase 10. By CPU (over the last interval, from `/proc//stat`) and by memory, 5 each; SIGTERM in one click, Force Quit (SIGKILL) as a second, explicit button; only the user's own processes are listed and quit (system and other users' refused, also by `menew __quit-process` in the tests). The Mac's "open Activity Monitor" link has no counterpart. | -| Metrics in the tray (choose which) | ✅ | 🟡 | R1 | DONE in Phase 10 with limits. `Title` + `ToolTip` of the StatusNotifierItem with cpu, cpuGraph, ram, net, disk, battery (`temp` needs sensors, R2). KDE Plasma shows the Title as text in the panel; **GNOME's AppIndicator shows only the icon**, so on GNOME the metrics are only in the tooltip. The choice is `monitor_tray_items` in `config.json`, empty by default (opt-in) until the settings window of Phase 11; the Mac default is CPU + RAM. No separate icons per metric. | +| Metrics in the tray (choose which) | ✅ | 🟡 | R1 | DONE in Phase 10 with limits. `Title` + `ToolTip` of the StatusNotifierItem with cpu, cpuGraph, ram, net, disk, battery (`temp` needs sensors, R2). KDE Plasma shows the Title as text in the panel; **GNOME's AppIndicator shows only the icon**, so on GNOME the metrics are only in the tooltip. The choice is `monitor_tray_items` in `config.json`, empty by default (opt-in) and turned on in `menew settings`; the Mac default is CPU + RAM. No separate icons per metric. | | History 24 h / 7 d / 30 d with the apps that used the most | ✅ | ⬜ | | | | Temperatures and fans | ✅ | 🔁 | | hwmon. | | Battery health and wear history | ✅ | 🔁 | | UPower / `/sys/class/power_supply`. | @@ -149,11 +149,11 @@ Licence: GPL-3.0-only, the same as the Mac app; name and icon under `TRADEMARK.m |---|---|---|---|---| | Menu bar popover ("Now", "Actions" tabs) | ✅ | 🔁 | R1 | SNI menus can't host custom views. A small popover-like window opened from the tray (left click) with the same tabs. | | Menew window (sidebar: Overview, Clipboard, Notes, Performance, Settings...) | ✅ | 🔁 | R1 | libadwaita `NavigationSplitView`. | -| Settings (incl. turning features off completely) | ✅ | ⬜ | R1 | | +| Settings (incl. turning features off completely) | ✅ | 🟡 | R1 | `menew settings`, the palette and the tray open a libadwaita preferences window (`crates/menew-ui/src/settings.rs`) over `config.json`: language, start at login, welcome and update check, the clipboard options (paste mode, entries kept, auto delete, OCR, ignored apps) and the tray metrics. Saved as each row changes; the language, the clipboard options and the tray metrics are read at startup, so they apply when Menew restarts. Missing against the Mac: switching whole modules off, the quick links and world clocks editors, and choosing which shortcuts are created. | | Welcome tour | ✅ | ✅ | R1 | `crates/menew-ui/src/welcome.rs`: three pages like `Onboarding.swift` (hello, setup, all set). The Mac's permission page is a setup page here: what Menew did by itself on the first start (`crates/menew/src/setup.rs`: start at login on for new users like `LaunchAtLogin.applyDefault`, the GNOME extension turned on and, without the GlobalShortcuts portal, GNOME custom shortcuts created) with a button where something is missing. Shown once for new users, again from the palette or `menew welcome`. The Mac's module switches and menu bar preview have no Linux counterpart yet (Phase 11 settings). Headless test: `scripts/desktop-test/welcome.sh`. | -| 5 languages, follow system or pick | ✅ | 🟡 | R1 | Strings in 5 languages; no picker yet. | +| 5 languages, follow system or pick | ✅ | ✅ | R1 | Strings in 5 languages. The picker is in `menew settings` (`language` in `config.json`; "System" follows the desktop); the choice is read at startup, like the Mac's relaunch. | | Backup / restore (`.menew` file) | ✅ | ⬜ | | Same format as the Mac where possible. | -| Updates | ✅ Sparkle | ✅ | R1 | Same behavior as `Updater.swift`: automatic check on by default with a toggle (`auto_update_check` in `config.json` and a tray checkmark; the settings window comes in Phase 11), every 24 h (+ one 5 minutes after start), a discreet reminder (dot on the tray icon and an "Update available: X" menu item, never a window by itself), "Check for Updates…" in the tray and the palette, a window with the version's notes and Install and Relaunch / Skip This Version / Later, nothing in `--snapshot`. Feed: the GitHub releases listing (pre-releases included for a pre-release build) + the `update.json` of the release, with an Ed25519 signature (Linux-only key) checked together with size and SHA-256 before anything is installed. AppImage: replaced in place and restarted; `.deb`: `pkexec apt-get install -y`; other: tells with the link. Differences: no install on quit, restart without arguments, `menew check-updates [--install]` for terminals. `updates.rs`, `updater.rs`, `docs/updates-spec.md`, `scripts/make-update-json.sh`, `scripts/test-updates-e2e.sh`. The public key in `UPDATE_PUBLIC_KEY` is a placeholder until the real key is made (see CHANGELOG). | +| Updates | ✅ Sparkle | ✅ | R1 | Same behavior as `Updater.swift`: automatic check on by default with a toggle (`auto_update_check` in `config.json`, a tray checkmark and the settings window), every 24 h (+ one 5 minutes after start), a discreet reminder (dot on the tray icon and an "Update available: X" menu item, never a window by itself), "Check for Updates…" in the tray and the palette, a window with the version's notes and Install and Relaunch / Skip This Version / Later, nothing in `--snapshot`. Feed: the GitHub releases listing (pre-releases included for a pre-release build) + the `update.json` of the release, with an Ed25519 signature (Linux-only key) checked together with size and SHA-256 before anything is installed. AppImage: replaced in place and restarted; `.deb`: `pkexec apt-get install -y`; other: tells with the link. Differences: no install on quit, restart without arguments, `menew check-updates [--install]` for terminals. `updates.rs`, `updater.rs`, `docs/updates-spec.md`, `scripts/make-update-json.sh`, `scripts/test-updates-e2e.sh`. The public key in `UPDATE_PUBLIC_KEY` is a placeholder until the real key is made (see CHANGELOG). | | Live notch | ✅ | ❌ | | No notch; the same alerts go to notifications and the tray. | | Widgets | ✅ | ❌ | | No cross-desktop widget API (KDE Plasmoids could come later). | | Siri, Shortcuts, Spotlight | ✅ | 🔁 | | D-Bus actions for scripting; GNOME Shell search provider and KRunner for search. | @@ -176,4 +176,4 @@ To build for R1 (grouped into relay phases in `docs/plan-mvp.md`): 5. Windows: DONE (the Mac's 17 positions through a KWin script and the GNOME extension's `org.menew.Shell`, read back by `scripts/desktop-test/actions.sh`). Not verified on a real desktop: the snapping shortcuts. 6. Quick actions: DONE (mic/sound/output, dark mode, keep awake, lock, trash, color picker, plain text, eject, brightness, quit apps, ports). Not verified on a real desktop: audio devices, brightness, eject. 7. System monitor with top processes and tray metrics: DONE in Phase 10 (see the rows above and `docs/monitor-spec.md`). -8. Tray popover (Now / Actions), Menew window, settings, welcome tour, language picker, update check. +8. Tray popover (Now / Actions), Menew window, settings, welcome tour, language picker, update check. Done: welcome tour, update check, settings window and language picker. Still open: the tray popover and the Menew window. diff --git a/docs/updates-spec.md b/docs/updates-spec.md index 9f742f6..3ffc304 100644 --- a/docs/updates-spec.md +++ b/docs/updates-spec.md @@ -14,7 +14,7 @@ In a table cell `-` is "nothing / none" and lists are joined with `¶`. Cells ne | Part | Mac (Sparkle) | Linux | |---|---|---| -| Automatic check | On by default (`SUEnableAutomaticChecks`), toggle in Settings, `automaticallyChecksForUpdates` | On by default, `auto_update_check` in `config.json` and a checkmark item in the tray (the settings window comes in Phase 11) | +| Automatic check | On by default (`SUEnableAutomaticChecks`), toggle in Settings, `automaticallyChecksForUpdates` | On by default, `auto_update_check` in `config.json`, a checkmark item in the tray and the settings window | | Interval | `SUScheduledCheckInterval` 86400 s | 86400 s (`AUTO_CHECK_INTERVAL_SECS`), first check 300 s after the daemon starts (`STARTUP_CHECK_DELAY_SECS`) | | Discreet reminder | "Gentle reminders": `standardUserDriverShouldHandleShowingScheduledUpdate` returns false, a dot on the icon, no window | A scheduled check never opens a window and never notifies: the tray icon gets the "needs attention" status with an overlay icon and the menu gets "Update available: X" | | Manual check | "Check for Updates…" opens the window or says up to date | "Check for Updates…" in the tray and the palette: window if found, a notification "Menew is up to date" or "Could not check for updates" otherwise; if an update is already pending it opens its window | diff --git a/site/content.json b/site/content.json index 8ab965c..e8ff270 100644 --- a/site/content.json +++ b/site/content.json @@ -78,7 +78,7 @@ "n4_t": "More in the system monitor", "n4_d": "History, temperatures and fans, battery health and alerts.", "n5_t": "Memory and on-device AI", - "n5_d": "Remember what you did on the computer, and local AI through Ollama. Also a window of its own with settings.", + "n5_d": "Remember what you did on the computer, and local AI through Ollama.", "next_note": "Every Mac feature and its Linux status:", "next_link": "the parity list on GitHub", "req_eyebrow": "Linux requirements", @@ -232,7 +232,7 @@ "n4_t": "Mais no monitor do sistema", "n4_d": "Histórico, temperaturas e ventoinhas, saúde da bateria e alertas.", "n5_t": "Memória e IA no dispositivo", - "n5_d": "Lembrar o que você fez no computador e IA local pelo Ollama. Também uma janela própria com ajustes.", + "n5_d": "Lembrar o que você fez no computador e IA local pelo Ollama.", "next_note": "Cada recurso do Mac e o seu status no Linux:", "next_link": "a lista de paridade no GitHub", "req_eyebrow": "Requisitos no Linux", @@ -386,7 +386,7 @@ "n4_t": "Mehr im Systemmonitor", "n4_d": "Verlauf, Temperaturen und Lüfter, Akkuzustand und Warnungen.", "n5_t": "Memory und KI auf dem Gerät", - "n5_d": "Sich merken, was du am Rechner getan hast, und lokale KI über Ollama. Dazu ein eigenes Fenster mit Einstellungen.", + "n5_d": "Sich merken, was du am Rechner getan hast, und lokale KI über Ollama.", "next_note": "Jede Mac-Funktion und ihr Linux-Status:", "next_link": "die Paritätsliste auf GitHub", "req_eyebrow": "Voraussetzungen unter Linux", @@ -540,7 +540,7 @@ "n4_t": "Más en el monitor del sistema", "n4_d": "Historial, temperaturas y ventiladores, salud de la batería y alertas.", "n5_t": "Memory e IA en el dispositivo", - "n5_d": "Recordar lo que hiciste en el equipo e IA local con Ollama. También una ventana propia con ajustes.", + "n5_d": "Recordar lo que hiciste en el equipo e IA local con Ollama.", "next_note": "Cada función del Mac y su estado en Linux:", "next_link": "la lista de paridad en GitHub", "req_eyebrow": "Requisitos en Linux", @@ -694,7 +694,7 @@ "n4_t": "系统监视器的更多功能", "n4_d": "历史记录、温度和风扇、电池健康和提醒。", "n5_t": "Memory 和设备端 AI", - "n5_d": "记住你在电脑上做过的事,以及通过 Ollama 使用本地 AI。还有带设置的独立窗口。", + "n5_d": "记住你在电脑上做过的事,以及通过 Ollama 使用本地 AI。", "next_note": "每项 Mac 功能及其在 Linux 上的进度:", "next_link": "GitHub 上的对照清单", "req_eyebrow": "Linux 系统要求",