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
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
23 changes: 22 additions & 1 deletion crates/menew-core/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>,
/// Apps "Quit all apps" never closes (`neverQuit` on the Mac): desktop ids or program names.
pub never_quit: Vec<String>,
/// 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<String>,
}

impl Default for Config {
Expand All @@ -60,6 +63,7 @@ impl Default for Config {
auto_update_check: true,
monitor_tray_items: Vec::new(),
never_quit: vec![],
language: None,
}
}
}
Expand Down Expand Up @@ -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)?;
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 3 additions & 0 deletions crates/menew-core/src/i18n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions crates/menew-core/src/palette.rs
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,12 @@ fn commands(ctx: &PaletteContext) -> Vec<PaletteItem> {
.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, &[]))
Expand Down
39 changes: 39 additions & 0 deletions crates/menew-core/src/strings_r1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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", "网站"]),
];
12 changes: 12 additions & 0 deletions crates/menew-tray/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 |_| {
Expand Down
2 changes: 1 addition & 1 deletion crates/menew-ui/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 4 additions & 2 deletions crates/menew-ui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(&gtk4::Image::from_icon_name("dialog-password-symbolic"));
self.list_box.append(&row);
}
*self.visible_passwords.borrow_mut() = found;
Expand All @@ -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(&gtk4::Image::from_icon_name("insert-text-symbolic"));
self.list_box.append(&row);
}
*self.visible_snippets.borrow_mut() = found;
Expand Down
3 changes: 2 additions & 1 deletion crates/menew-ui/src/notes_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(&gtk4::Image::from_icon_name(icon));
row.add_suffix(&gtk4::Label::builder().label(age).css_classes(["dim-label", "caption"]).build());
ui.list.append(&row);
ids.push(n.id.clone());
Expand Down
Loading