feat: Konsole parity phase 1 (save output, search options, monitors, profile CLI)
Implements the first batch of COSMIC_TERMINAL_KONSOLE_PARITY.md:
Save output as text:
- New SaveOutput action in the Edit menu, terminal context menu and
keyboard shortcuts (Ctrl+Shift+S, Konsole parity, rebindable).
- Terminal::scrollback_text() extracts history plus visible screen via
alacritty bounds_to_string, trimming trailing empty lines.
- Save-file dialog through cosmic-files; the file is written in a
spawn_blocking task so large scrollbacks never stall the UI.
Search options:
- Case-sensitive and regex checkboxes in the find bar.
- App::find_pattern() escapes the pattern when regex mode is off and
prefixes (?i) when case-insensitive (same approach as Alacritty).
Per-tab monitors (activity / silence / process finished):
- Toggles in the View menu and terminal context menu, state stored in
Terminal (monitor_* fields).
- Activity alerts on PTY output (Wakeup) for non-active tabs; silence
alerts after 10 s without output (Konsole default); process-finished
compares the shell pgrp with the tty tpgid via /proc/<pid>/stat and
alerts when the foreground job exits.
- Silence and process checks run on a 1 s iced::time subscription that
is only active while at least one tab needs it.
- Tab bar shows an armed icon (view-reveal-symbolic) and per-kind alert
icons; activating the tab acknowledges the alert.
Profile CLI:
- --profile/-p <name-or-id> applies a profile to the first tab only,
unknown profiles exit(1) with the available list on stderr.
- --list-profiles prints "id<TAB>name" and exits.
- Config is now loaded before the daemonize fork so CLI output reaches
the launching terminal.
- --help now documents -e/--command, --no-daemon and the new flags
(-e already worked; audit confirmed everything after it becomes the
command and its arguments).
i18n: new en/fr strings (save-output, monitor-*, find-case-sensitive,
find-regex).
Validated with ./check_cosmic_local.sh terminal, cargo fmt, and a debug
build exercising the CLI flags and a 6 s live run. The shutdown panic
in iced_winit ("async fn resumed after completion") pre-exists and is
reproducible with the installed binary.
Leyoda 2026 – GPLv3
This commit is contained in:
parent
5af952d285
commit
43d38aed8a
6 changed files with 529 additions and 42 deletions
41
src/menu.rs
41
src/menu.rs
|
|
@ -18,7 +18,7 @@ use cosmic::{
|
|||
};
|
||||
use std::{collections::HashMap, sync::LazyLock};
|
||||
|
||||
use crate::{Action, ColorSchemeId, ColorSchemeKind, Config, Message, fl};
|
||||
use crate::{Action, ColorSchemeId, ColorSchemeKind, Config, Message, fl, terminal::MonitorKind};
|
||||
|
||||
static MENU_ID: LazyLock<cosmic::widget::Id> =
|
||||
LazyLock::new(|| cosmic::widget::Id::new("responsive-menu"));
|
||||
|
|
@ -35,6 +35,7 @@ pub fn context_menu<'a>(
|
|||
key_binds: &HashMap<KeyBind, Action>,
|
||||
entity: segmented_button::Entity,
|
||||
link: Option<String>,
|
||||
monitors: (bool, bool, bool),
|
||||
) -> Element<'a, Message> {
|
||||
let find_key = |action: &Action| -> String {
|
||||
for (key_bind, key_action) in key_binds {
|
||||
|
|
@ -83,6 +84,23 @@ pub fn context_menu<'a>(
|
|||
Element::from(menu_item(fl!("select-all"), Action::SelectAll)),
|
||||
Element::from(divider::horizontal::light()),
|
||||
Element::from(menu_item(fl!("clear-scrollback"), Action::ClearScrollback)),
|
||||
Element::from(menu_item(fl!("save-output"), Action::SaveOutput)),
|
||||
Element::from(divider::horizontal::light()),
|
||||
Element::from(menu_checkbox(
|
||||
fl!("monitor-activity"),
|
||||
monitors.0,
|
||||
Action::Monitor(MonitorKind::Activity),
|
||||
)),
|
||||
Element::from(menu_checkbox(
|
||||
fl!("monitor-silence"),
|
||||
monitors.1,
|
||||
Action::Monitor(MonitorKind::Silence),
|
||||
)),
|
||||
Element::from(menu_checkbox(
|
||||
fl!("monitor-process-finished"),
|
||||
monitors.2,
|
||||
Action::Monitor(MonitorKind::ProcessFinished),
|
||||
)),
|
||||
Element::from(divider::horizontal::light()),
|
||||
Element::from(menu_item(
|
||||
fl!("split-horizontal"),
|
||||
|
|
@ -200,6 +218,7 @@ pub fn menu_bar<'a>(
|
|||
core: &Core,
|
||||
config: &Config,
|
||||
key_binds: &HashMap<KeyBind, Action>,
|
||||
monitors: (bool, bool, bool),
|
||||
) -> Element<'a, Message> {
|
||||
let mut profile_items = Vec::with_capacity(config.profiles.len());
|
||||
for (name, id) in config.profile_names() {
|
||||
|
|
@ -243,6 +262,7 @@ pub fn menu_bar<'a>(
|
|||
MenuItem::Button(fl!("select-all"), None, Action::SelectAll),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("clear-scrollback"), None, Action::ClearScrollback),
|
||||
MenuItem::Button(fl!("save-output"), None, Action::SaveOutput),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("find"), None, Action::Find),
|
||||
],
|
||||
|
|
@ -269,6 +289,25 @@ pub fn menu_bar<'a>(
|
|||
Action::PaneToggleMaximized,
|
||||
),
|
||||
MenuItem::Divider,
|
||||
MenuItem::CheckBox(
|
||||
fl!("monitor-activity"),
|
||||
None,
|
||||
monitors.0,
|
||||
Action::Monitor(MonitorKind::Activity),
|
||||
),
|
||||
MenuItem::CheckBox(
|
||||
fl!("monitor-silence"),
|
||||
None,
|
||||
monitors.1,
|
||||
Action::Monitor(MonitorKind::Silence),
|
||||
),
|
||||
MenuItem::CheckBox(
|
||||
fl!("monitor-process-finished"),
|
||||
None,
|
||||
monitors.2,
|
||||
Action::Monitor(MonitorKind::ProcessFinished),
|
||||
),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(
|
||||
fl!("menu-color-schemes"),
|
||||
None,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue