Compare commits
15 commits
5af952d285
...
e87a7f214a
| Author | SHA1 | Date | |
|---|---|---|---|
| e87a7f214a | |||
| f93673c6f4 | |||
| 821f54693e | |||
|
|
7a8ee76e8f | ||
|
|
3a60da0213 | ||
|
|
fe2b6ca484 | ||
|
|
a301e64503 | ||
|
|
a3132220e2 | ||
|
|
b6cc5d0e37 | ||
| 8db4948de3 | |||
| 437665dd78 | |||
| 87128d72d6 | |||
| 4d05e77e1b | |||
| 65fc96eab8 | |||
| 6b5a7ee8c8 |
14 changed files with 915 additions and 380 deletions
964
Cargo.lock
generated
964
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
53
Cargo.toml
53
Cargo.toml
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "cosmic-term"
|
||||
version = "1.0.13"
|
||||
version = "1.0.14"
|
||||
authors = ["Jeremy Soller <jeremy@system76.com>"]
|
||||
edition = "2024"
|
||||
license = "GPL-3.0-only"
|
||||
|
|
@ -17,7 +17,10 @@ regex = "1"
|
|||
ron = "0.11"
|
||||
serde = { version = "1", features = ["serde_derive"] }
|
||||
shlex = "1"
|
||||
tokio = { version = "1", features = ["sync"] }
|
||||
tokio = { version = "1", features = ["sync", "rt", "macros", "time"] }
|
||||
# HTTP client for Modjo AI integration
|
||||
reqwest = { version = "0.12", features = ["json", "stream"], optional = true }
|
||||
serde_json = { version = "1", optional = true }
|
||||
# CLI arguments
|
||||
clap_lex = "0.7"
|
||||
# Internationalization
|
||||
|
|
@ -36,15 +39,16 @@ thiserror = { version = "2.0", optional = true }
|
|||
secstr = { version = "0.5", optional = true }
|
||||
|
||||
[dependencies.cosmic-files]
|
||||
git = "https://github.com/pop-os/cosmic-files.git"
|
||||
path = "../cosmic-files"
|
||||
default-features = false
|
||||
|
||||
[dependencies.cosmic-text]
|
||||
version = "0.19"
|
||||
path = "../cosmic-text"
|
||||
features = ["monospace_fallback", "shape-run-cache"]
|
||||
|
||||
[dependencies.libcosmic]
|
||||
git = "https://github.com/pop-os/libcosmic.git"
|
||||
[dependencies.cosmic]
|
||||
package = "libcosmic-yoda"
|
||||
path = "../libcosmic"
|
||||
default-features = false
|
||||
#TODO: a11y feature crashes file chooser dialog
|
||||
features = ["about", "autosize", "multi-window", "tokio", "winit", "surface-message"]
|
||||
|
|
@ -57,17 +61,40 @@ xdgen = "0.1"
|
|||
|
||||
[features]
|
||||
default = ["dbus-config", "wgpu", "wayland", "password_manager"]
|
||||
dbus-config = ["libcosmic/dbus-config"]
|
||||
wgpu = ["libcosmic/wgpu", "cosmic-files/wgpu"]
|
||||
wayland = ["libcosmic/wayland", "cosmic-files/wayland"]
|
||||
dbus-config = ["cosmic/dbus-config"]
|
||||
wgpu = ["cosmic/wgpu", "cosmic-files/wgpu"]
|
||||
wayland = ["cosmic/wayland", "cosmic-files/wayland"]
|
||||
password_manager = ["secret-service", "thiserror", "secstr"]
|
||||
modjo = ["dep:reqwest", "dep:serde_json"]
|
||||
|
||||
[profile.release-with-debug]
|
||||
inherits = "release"
|
||||
debug = true
|
||||
|
||||
|
||||
#[patch.'https://github.com/pop-os/libcosmic']
|
||||
#libcosmic = { path = "../libcosmic" }
|
||||
#cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||
#cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
||||
[patch.'https://github.com/pop-os/libcosmic']
|
||||
cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||
cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
||||
iced = { path = "../libcosmic/iced" }
|
||||
iced_accessibility = { path = "../libcosmic/iced/accessibility" }
|
||||
iced_core = { path = "../libcosmic/iced/core" }
|
||||
iced_futures = { path = "../libcosmic/iced/futures" }
|
||||
iced_graphics = { path = "../libcosmic/iced/graphics" }
|
||||
iced_renderer = { path = "../libcosmic/iced/renderer" }
|
||||
iced_runtime = { path = "../libcosmic/iced/runtime" }
|
||||
iced_tiny_skia = { path = "../libcosmic/iced/tiny_skia" }
|
||||
iced_wgpu = { path = "../libcosmic/iced/wgpu" }
|
||||
iced_widget = { path = "../libcosmic/iced/widget" }
|
||||
iced_winit = { path = "../libcosmic/iced/winit" }
|
||||
|
||||
[patch.'https://github.com/pop-os/cosmic-protocols']
|
||||
cosmic-protocols = { path = "../cosmic-protocols" }
|
||||
cosmic-client-toolkit = { path = "../cosmic-protocols/client-toolkit" }
|
||||
|
||||
[patch.'https://github.com/pop-os/cosmic-text.git']
|
||||
cosmic-text = { path = "../cosmic-text" }
|
||||
|
||||
[patch.'https://forge.aditua.com/leyoda/window_clipboard.git']
|
||||
window_clipboard = { path = "../window_clipboard" }
|
||||
dnd = { path = "../window_clipboard/dnd" }
|
||||
mime = { path = "../window_clipboard/mime" }
|
||||
|
|
|
|||
6
debian/changelog
vendored
6
debian/changelog
vendored
|
|
@ -1,3 +1,9 @@
|
|||
cosmic-term (1.0.14) noble; urgency=medium
|
||||
|
||||
* Epoch 1.0.14 version update
|
||||
|
||||
-- Jeremy Soller <jeremy@system76.com> Tue, 26 May 2026 08:31:52 -0600
|
||||
|
||||
cosmic-term (1.0.13) noble; urgency=medium
|
||||
|
||||
* Epoch 1.0.13 version update
|
||||
|
|
|
|||
|
|
@ -63,13 +63,14 @@ focus-follow-mouse = Typing focus follows mouse
|
|||
advanced = Advanced
|
||||
show-headerbar = Show header
|
||||
show-header-description = Reveal the header from the right-click menu
|
||||
tab-new-inherit-working-directory = New tabs use current directory
|
||||
tab-new-inherit-working-directory-description = Open new tabs in the active tab's working directory
|
||||
tab-new-inherit-working-directory = New tabs and windows use current directory
|
||||
tab-new-inherit-working-directory-description = Open new tabs and windows in the active tab's working directory
|
||||
|
||||
### Keyboard shortcuts
|
||||
add-another-keybinding = Add another keybinding
|
||||
cancel = Cancel
|
||||
close-window = Close window
|
||||
confirm = Confirm
|
||||
copy-or-sigint = Copy or SIGINT
|
||||
disable = Disable
|
||||
focus-pane-down = Focus pane down
|
||||
|
|
@ -83,6 +84,7 @@ password-manager = Password manager
|
|||
paste-primary = Paste primary
|
||||
replace = Replace
|
||||
reset-to-default = Reset to default
|
||||
reset = Reset
|
||||
shortcut-capture-hint = Press the key combination
|
||||
shortcut-group-clipboard = Clipboard
|
||||
shortcut-group-other = Other
|
||||
|
|
@ -92,6 +94,9 @@ shortcut-group-zoom = Zoom
|
|||
shortcut-replace-body = { $binding } is already assigned to { $existing }. Replace it with { $new_action }?
|
||||
shortcut-replace-title = Replace shortcut?
|
||||
tab-activate = Activate tab { $number }
|
||||
rename-tab = Rename tab
|
||||
tab-name-placeholder = Tab name
|
||||
tab-rename-title = Rename tab
|
||||
toggle-fullscreen = Toggle fullscreen
|
||||
type-to-search = Type to search...
|
||||
|
||||
|
|
|
|||
|
|
@ -121,6 +121,7 @@ copy-link = Copier le lien
|
|||
add-another-keybinding = Ajouter un autre raccourci clavier
|
||||
cancel = Annuler
|
||||
close-window = Fermer la fenêtre
|
||||
confirm = Confirmer
|
||||
copy-or-sigint = Copier ou SIGINT
|
||||
disable = Désactiver
|
||||
keyboard-shortcuts = Raccourcis clavier
|
||||
|
|
@ -144,7 +145,11 @@ focus-pane-left = Passer au panneau de gauche
|
|||
focus-pane-right = Passer au panneau de droite
|
||||
focus-pane-up = Passer au panneau du dessus
|
||||
reset-to-default = Rétablir les paramètres par défaut
|
||||
reset = Réinitialiser
|
||||
toggle-fullscreen = Basculer en plein écran
|
||||
rename-tab = Renommer l'onglet
|
||||
tab-name-placeholder = Nom de l'onglet
|
||||
tab-rename-title = Renommer l'onglet
|
||||
comment = Émulateur de terminal pour le bureau COSMIC
|
||||
keywords = Commande;Shell;Terminal;CLI;
|
||||
tab-new-inherit-working-directory = Les nouveaux onglets utilisent le répertoire actuel
|
||||
|
|
|
|||
|
|
@ -147,3 +147,5 @@ type-to-search = Clóscríobh le cuardach a dhéanamh...
|
|||
comment = Aithriseoir teirminéal don deasc COSMIC
|
||||
keywords = Ordú;Blaosc;Teirminéal;CLI;
|
||||
copy-link = Cóipeáil Nasc
|
||||
tab-new-inherit-working-directory = Úsáideann cluaisíní nua an eolaire reatha
|
||||
tab-new-inherit-working-directory-description = Oscail cluaisíní nua in eolaire oibre an chluaisín ghníomhaigh
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
cosmic-terminal = COSMIC Terminál
|
||||
comment = Terminálemulátor a COSMIC asztali környezethez
|
||||
keywords = parancssor;terminál;
|
||||
keywords = parancssor;héj;terminál;CLI;
|
||||
new-terminal = Új terminál
|
||||
|
||||
# Context Pages
|
||||
|
|
@ -32,7 +32,7 @@ new-profile = Új profil
|
|||
make-default = Beállítás alapértelmezettként
|
||||
working-directory = Munkakönyvtár
|
||||
hold = Maradjon nyitva
|
||||
remain-open = Maradjon nyitva a gyermekfolyamat kilépése után
|
||||
remain-open = Maradjon nyitva a gyermekfolyamat kilépése után.
|
||||
|
||||
## Settings
|
||||
|
||||
|
|
|
|||
|
|
@ -72,3 +72,4 @@ default-zoom-step = Zoom steg
|
|||
focus-follow-mouse = Skrivefokus følger musen
|
||||
hold = Hold
|
||||
cancel = Avbryt
|
||||
replace = Erstatt
|
||||
|
|
|
|||
|
|
@ -113,3 +113,4 @@ menu-about = Acerca do Terminal COSMIC...
|
|||
repository = Repositório
|
||||
support = Suporte
|
||||
clear-scrollback = Limpar scrollback
|
||||
cancel = Cancelar
|
||||
|
|
|
|||
150
src/main.rs
150
src/main.rs
|
|
@ -4,6 +4,7 @@
|
|||
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
||||
use cosmic::iced::clipboard::dnd::DndAction;
|
||||
use cosmic::iced::core::keyboard::key::Named;
|
||||
use cosmic::iced::keyboard::key::Physical;
|
||||
use cosmic::widget::menu::action::MenuAction;
|
||||
use cosmic::widget::menu::key_bind::KeyBind;
|
||||
use cosmic::widget::pane_grid::Pane;
|
||||
|
|
@ -277,6 +278,7 @@ pub enum Action {
|
|||
TabNewNoProfile,
|
||||
TabNext,
|
||||
TabPrev,
|
||||
TabRename,
|
||||
ToggleFullscreen,
|
||||
WindowClose,
|
||||
WindowNew,
|
||||
|
|
@ -330,6 +332,7 @@ impl Action {
|
|||
Self::TabNewNoProfile => Message::TabNewNoProfile,
|
||||
Self::TabNext => Message::TabNext,
|
||||
Self::TabPrev => Message::TabPrev,
|
||||
Self::TabRename => Message::TabRenameOpen(entity_opt),
|
||||
Self::ToggleFullscreen => Message::ToggleFullscreen,
|
||||
Self::WindowClose => Message::WindowClose,
|
||||
Self::WindowNew => Message::WindowNew,
|
||||
|
|
@ -383,7 +386,7 @@ pub enum Message {
|
|||
FindSearchValueChanged(String),
|
||||
MiddleClick(pane_grid::Pane, Option<segmented_button::Entity>),
|
||||
FocusFollowMouse(bool),
|
||||
Key(Modifiers, Key),
|
||||
Key(Modifiers, Physical, Key),
|
||||
LaunchUrl(String),
|
||||
LaunchUrlByMenu,
|
||||
Modifiers(Modifiers),
|
||||
|
|
@ -437,6 +440,12 @@ pub enum Message {
|
|||
TabNewNoProfile,
|
||||
TabNext,
|
||||
TabPrev,
|
||||
TabRenameOpenForPane(pane_grid::Pane, segmented_button::Entity),
|
||||
TabRenameOpen(Option<segmented_button::Entity>),
|
||||
TabRenameInput(String),
|
||||
TabRenameCommit,
|
||||
TabRenameCancel,
|
||||
TabRenameResetToDefault,
|
||||
TermEvent(pane_grid::Pane, segmented_button::Entity, TermEvent),
|
||||
TermEventTx(mpsc::UnboundedSender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>),
|
||||
ToggleFullscreen,
|
||||
|
|
@ -510,6 +519,8 @@ pub struct App {
|
|||
color_scheme_expanded: Option<(ColorSchemeKind, Option<ColorSchemeId>)>,
|
||||
color_scheme_renaming: Option<(ColorSchemeKind, ColorSchemeId, String)>,
|
||||
color_scheme_rename_id: widget::Id,
|
||||
rename_tab: Option<(segmented_button::Entity, String)>,
|
||||
rename_tab_id: widget::Id,
|
||||
color_scheme_tab_model: widget::segmented_button::SingleSelectModel,
|
||||
profile_expanded: Option<ProfileId>,
|
||||
show_advanced_font_settings: bool,
|
||||
|
|
@ -674,7 +685,7 @@ impl App {
|
|||
|
||||
// Update terminal window background color
|
||||
{
|
||||
let color = Color::from(theme.cosmic().background.base);
|
||||
let color = Color::from(theme.cosmic().background(false).base);
|
||||
let bytes = color.into_rgba8();
|
||||
let data = u32::from(bytes[2])
|
||||
| (u32::from(bytes[1]) << 8)
|
||||
|
|
@ -758,7 +769,9 @@ impl App {
|
|||
}
|
||||
|
||||
fn update_focus(&self) -> Task<Message> {
|
||||
if self.find {
|
||||
if self.rename_tab.is_some() {
|
||||
widget::text_input::focus(self.rename_tab_id.clone())
|
||||
} else if self.find {
|
||||
widget::text_input::focus(self.find_search_id.clone())
|
||||
} else if self.core.window.show_context {
|
||||
// Right now we only care about the KeyboardShortcuts context page, so we use a simple if.
|
||||
|
|
@ -990,6 +1003,7 @@ impl App {
|
|||
//TODO: re-export in libcosmic
|
||||
iced::widget::text::Style {
|
||||
color: Some(cosmic.destructive_text_color().into()),
|
||||
..Default::default()
|
||||
}
|
||||
}))
|
||||
.into(),
|
||||
|
|
@ -1872,6 +1886,8 @@ impl Application for App {
|
|||
color_scheme_expanded: None,
|
||||
color_scheme_renaming: None,
|
||||
color_scheme_rename_id: widget::Id::unique(),
|
||||
rename_tab: None,
|
||||
rename_tab_id: widget::Id::unique(),
|
||||
color_scheme_tab_model: widget::segmented_button::Model::default(),
|
||||
profile_expanded: None,
|
||||
show_advanced_font_settings: false,
|
||||
|
|
@ -2419,7 +2435,7 @@ impl Application for App {
|
|||
Message::FocusFollowMouse(focus_follow_mouse) => {
|
||||
config_set!(focus_follow_mouse, focus_follow_mouse);
|
||||
}
|
||||
Message::Key(modifiers, key) => {
|
||||
Message::Key(modifiers, physical, key) => {
|
||||
// Hard-coded keys
|
||||
match key {
|
||||
Key::Named(Named::Copy) => {
|
||||
|
|
@ -2459,7 +2475,7 @@ impl Application for App {
|
|||
|
||||
// Handle configurable keys
|
||||
for (key_bind, action) in &self.key_binds {
|
||||
if key_bind.matches(modifiers, &key) {
|
||||
if key_bind.matches(modifiers, &key, None) {
|
||||
return self.update(action.message(None));
|
||||
}
|
||||
}
|
||||
|
|
@ -2942,7 +2958,9 @@ impl Application for App {
|
|||
let pos_y = _position.y as i32;
|
||||
|
||||
tasks.push(cosmic::task::message(Message::Surface(
|
||||
cosmic::surface::action::app_popup(move |_app: &mut Self| {
|
||||
cosmic::surface::action::app_popup(
|
||||
|_: &Self| cosmic::surface::action::LiveSettings::default(),
|
||||
move |_app: &mut Self| {
|
||||
use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
||||
use cosmic::iced::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
|
||||
|
||||
|
|
@ -3019,6 +3037,64 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
Message::TabRenameOpenForPane(pane, entity) => {
|
||||
self.pane_model.set_focus(pane);
|
||||
return self.update(Message::TabRenameOpen(Some(entity)));
|
||||
}
|
||||
Message::TabRenameOpen(entity_opt) => {
|
||||
if let Some(tab_model) = self.pane_model.active() {
|
||||
let entity = entity_opt.unwrap_or_else(|| tab_model.active());
|
||||
let initial = tab_model
|
||||
.text(entity)
|
||||
.map(|s| s.to_string())
|
||||
.unwrap_or_default();
|
||||
self.rename_tab = Some((entity, initial));
|
||||
self.pane_model.unfocus_all_terminals();
|
||||
return self.update_focus();
|
||||
}
|
||||
}
|
||||
Message::TabRenameInput(value) => {
|
||||
if let Some((_, buffer)) = self.rename_tab.as_mut() {
|
||||
*buffer = value;
|
||||
}
|
||||
}
|
||||
Message::TabRenameCommit => {
|
||||
if let Some((entity, value)) = self.rename_tab.take() {
|
||||
let trimmed = value.trim().to_string();
|
||||
if let Some(tab_model) = self.pane_model.active_mut() {
|
||||
if trimmed.is_empty() {
|
||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
terminal.lock().unwrap().tab_title_override = None;
|
||||
}
|
||||
tab_model.text_set(entity, fl!("new-terminal"));
|
||||
} else {
|
||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
terminal.lock().unwrap().tab_title_override = Some(trimmed.clone());
|
||||
}
|
||||
tab_model.text_set(entity, trimmed);
|
||||
}
|
||||
}
|
||||
self.pane_model.update_terminal_focus();
|
||||
return self.update_title(None);
|
||||
}
|
||||
}
|
||||
Message::TabRenameCancel => {
|
||||
self.rename_tab = None;
|
||||
self.pane_model.update_terminal_focus();
|
||||
}
|
||||
Message::TabRenameResetToDefault => {
|
||||
if let Some((entity, _)) = self.rename_tab.take()
|
||||
&& let Some(tab_model) = self.pane_model.active_mut()
|
||||
{
|
||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
terminal.lock().unwrap().tab_title_override = None;
|
||||
}
|
||||
tab_model.text_set(entity, fl!("new-terminal"));
|
||||
self.pane_model.update_terminal_focus();
|
||||
return self.update_title(None);
|
||||
}
|
||||
self.pane_model.update_terminal_focus();
|
||||
}
|
||||
Message::TermEvent(pane, entity, event) => {
|
||||
match event {
|
||||
TermEvent::Bell => {
|
||||
|
|
@ -3225,12 +3301,21 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
Message::WindowNew => match env::current_exe() {
|
||||
Ok(exe) => match process::Command::new(&exe).spawn() {
|
||||
Ok(exe) => {
|
||||
let mut command = process::Command::new(&exe);
|
||||
if self.config.tab_new_inherit_working_directory
|
||||
&& let Some(dir) = self.active_terminal_working_directory()
|
||||
{
|
||||
command.arg("--working-directory");
|
||||
command.arg(dir);
|
||||
}
|
||||
match command.spawn() {
|
||||
Ok(_child) => {}
|
||||
Err(err) => {
|
||||
log::error!("failed to execute {:?}: {}", exe, err);
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("failed to get current executable path: {}", err);
|
||||
}
|
||||
|
|
@ -3335,6 +3420,31 @@ impl Application for App {
|
|||
}
|
||||
|
||||
fn dialog(&self) -> Option<Element<'_, Message>> {
|
||||
if let Some((_, buffer)) = self.rename_tab.as_ref() {
|
||||
let input = widget::text_input(fl!("tab-name-placeholder"), buffer)
|
||||
.id(self.rename_tab_id.clone())
|
||||
.on_input(Message::TabRenameInput)
|
||||
.on_submit(|_| Message::TabRenameCommit);
|
||||
|
||||
return Some(
|
||||
widget::dialog()
|
||||
.title(fl!("tab-rename-title"))
|
||||
.control(input)
|
||||
.primary_action(
|
||||
widget::button::suggested(fl!("confirm"))
|
||||
.on_press(Message::TabRenameCommit),
|
||||
)
|
||||
.secondary_action(
|
||||
widget::button::standard(fl!("cancel")).on_press(Message::TabRenameCancel),
|
||||
)
|
||||
.tertiary_action(
|
||||
widget::button::text(fl!("reset"))
|
||||
.on_press(Message::TabRenameResetToDefault),
|
||||
)
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
|
||||
let conflict = self.shortcut_conflict.as_ref()?;
|
||||
let binding = shortcuts::binding_display(&conflict.binding);
|
||||
let existing = shortcuts::action_label(conflict.existing_action);
|
||||
|
|
@ -3409,7 +3519,6 @@ impl Application for App {
|
|||
let pane_grid = PaneGrid::new(&self.pane_model.panes, |pane, tab_model, _is_maximized| {
|
||||
let mut tab_column = widget::column::with_capacity(1);
|
||||
|
||||
if tab_model.iter().count() > 1 {
|
||||
tab_column = tab_column.push(
|
||||
widget::container(
|
||||
widget::tab_bar::horizontal(tab_model)
|
||||
|
|
@ -3419,16 +3528,15 @@ impl Application for App {
|
|||
.button_height(32)
|
||||
.button_spacing(space_xxs)
|
||||
.on_activate(Message::TabActivate)
|
||||
.on_close(|entity| Message::TabClose(Some(entity))),
|
||||
.on_close(|entity| Message::TabClose(Some(entity)))
|
||||
.on_context(move |entity| Message::TabRenameOpenForPane(pane, entity)),
|
||||
)
|
||||
.class(style::Container::Custom(Box::new(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
cosmic::iced::widget::container::Style {
|
||||
icon_color: Some(Color::from(cosmic.background.on)),
|
||||
text_color: Some(Color::from(cosmic.background.on)),
|
||||
background: Some(iced::Background::Color(
|
||||
cosmic.background.base.into(),
|
||||
)),
|
||||
icon_color: Some(Color::from(cosmic.background(false).on)),
|
||||
text_color: Some(Color::from(cosmic.background(false).on)),
|
||||
background: Some(iced::Background::Color(cosmic.background(false).base.into())),
|
||||
border: iced::Border::default(),
|
||||
shadow: iced::Shadow::default(),
|
||||
snap: true,
|
||||
|
|
@ -3436,7 +3544,6 @@ impl Application for App {
|
|||
})))
|
||||
.width(Length::Fill),
|
||||
);
|
||||
}
|
||||
|
||||
let entity = tab_model.active();
|
||||
let entity_middle_click = tab_model.active();
|
||||
|
|
@ -3448,7 +3555,7 @@ impl Application for App {
|
|||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
let mut terminal_box = terminal_box(terminal, &self.key_binds)
|
||||
.id(terminal_id)
|
||||
.disabled(self.core.window.show_context)
|
||||
.disabled(self.core.window.show_context || self.rename_tab.is_some())
|
||||
.on_context_menu(move |menu_state| Message::TabContextMenu(pane, menu_state))
|
||||
.on_middle_click(move || Message::MiddleClick(pane, Some(entity_middle_click)))
|
||||
.on_open_hyperlink(Some(Box::new(Message::LaunchUrl)))
|
||||
|
|
@ -3608,9 +3715,12 @@ impl Application for App {
|
|||
|
||||
Subscription::batch([
|
||||
event::listen_with(|event, _status, _window_id| match event {
|
||||
Event::Keyboard(KeyEvent::KeyPressed { key, modifiers, .. }) => {
|
||||
Some(Message::Key(modifiers, key))
|
||||
}
|
||||
Event::Keyboard(KeyEvent::KeyPressed {
|
||||
key,
|
||||
physical_key,
|
||||
modifiers,
|
||||
..
|
||||
}) => Some(Message::Key(modifiers, physical_key, key)),
|
||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||
Some(Message::Modifiers(modifiers))
|
||||
}
|
||||
|
|
|
|||
10
src/menu.rs
10
src/menu.rs
|
|
@ -45,10 +45,11 @@ pub fn context_menu<'a>(
|
|||
String::new()
|
||||
};
|
||||
fn key_style(theme: &cosmic::Theme) -> TextStyle {
|
||||
let mut color = theme.cosmic().background.component.on;
|
||||
let mut color = theme.cosmic().background(false).component.on;
|
||||
color.alpha *= 0.75;
|
||||
TextStyle {
|
||||
color: Some(color.into()),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -94,7 +95,9 @@ pub fn context_menu<'a>(
|
|||
)),
|
||||
Element::from(divider::horizontal::light()),
|
||||
Element::from(menu_item(fl!("new-tab"), Action::TabNew)),
|
||||
Element::from(menu_item(fl!("rename-tab"), Action::TabRename)),
|
||||
Element::from(menu_item(fl!("menu-settings"), Action::Settings)),
|
||||
Element::from(menu_item(fl!("menu-about"), Action::About)),
|
||||
];
|
||||
#[cfg(feature = "password_manager")]
|
||||
{
|
||||
|
|
@ -128,7 +131,7 @@ pub fn context_menu<'a>(
|
|||
//TODO: move style to libcosmic
|
||||
.style(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background.component;
|
||||
let component = &cosmic.background(false).component;
|
||||
widget::container::Style {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
|
|
@ -176,7 +179,7 @@ pub fn color_scheme_menu<'a>(
|
|||
//TODO: move style to libcosmic
|
||||
.style(|theme| {
|
||||
let cosmic = theme.cosmic();
|
||||
let component = &cosmic.background.component;
|
||||
let component = &cosmic.background(false).component;
|
||||
widget::container::Style {
|
||||
icon_color: Some(component.on.into()),
|
||||
text_color: Some(component.on.into()),
|
||||
|
|
@ -224,6 +227,7 @@ pub fn menu_bar<'a>(
|
|||
MenuItem::Folder(fl!("profile"), profile_items),
|
||||
MenuItem::Button(fl!("menu-profiles"), None, Action::Profiles),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("rename-tab"), None, Action::TabRename),
|
||||
MenuItem::Button(fl!("close-tab"), None, Action::TabClose),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("quit"), None, Action::WindowClose),
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ pub enum KeyBindAction {
|
|||
TabNew,
|
||||
TabNext,
|
||||
TabPrev,
|
||||
TabRename,
|
||||
ToggleFullscreen,
|
||||
WindowClose,
|
||||
WindowNew,
|
||||
|
|
@ -127,6 +128,7 @@ impl KeyBindAction {
|
|||
Self::TabNew => Some(Action::TabNew),
|
||||
Self::TabNext => Some(Action::TabNext),
|
||||
Self::TabPrev => Some(Action::TabPrev),
|
||||
Self::TabRename => Some(Action::TabRename),
|
||||
Self::ToggleFullscreen => Some(Action::ToggleFullscreen),
|
||||
Self::WindowClose => Some(Action::WindowClose),
|
||||
Self::WindowNew => Some(Action::WindowNew),
|
||||
|
|
@ -288,6 +290,7 @@ pub fn action_label(action: KeyBindAction) -> String {
|
|||
KeyBindAction::TabNew => fl!("new-tab"),
|
||||
KeyBindAction::TabNext => fl!("next-tab"),
|
||||
KeyBindAction::TabPrev => fl!("previous-tab"),
|
||||
KeyBindAction::TabRename => fl!("rename-tab"),
|
||||
KeyBindAction::ToggleFullscreen => fl!("toggle-fullscreen"),
|
||||
KeyBindAction::WindowClose => fl!("close-window"),
|
||||
KeyBindAction::WindowNew => fl!("new-window"),
|
||||
|
|
@ -320,6 +323,7 @@ pub fn shortcut_groups() -> Vec<ShortcutGroup> {
|
|||
actions: vec![
|
||||
KeyBindAction::TabNew,
|
||||
KeyBindAction::TabClose,
|
||||
KeyBindAction::TabRename,
|
||||
KeyBindAction::TabNext,
|
||||
KeyBindAction::TabPrev,
|
||||
KeyBindAction::TabActivate0,
|
||||
|
|
@ -454,6 +458,7 @@ fn fallback_shortcuts() -> Shortcuts {
|
|||
bind!([Ctrl, Shift], "V", Paste);
|
||||
bind!([Shift], "Insert", PastePrimary);
|
||||
bind!([Ctrl, Shift], "W", TabClose);
|
||||
bind!([Ctrl, Shift], "R", TabRename);
|
||||
bind!([Ctrl], ",", Settings);
|
||||
bind!([], "F11", ToggleFullscreen);
|
||||
|
||||
|
|
@ -505,9 +510,26 @@ fn fallback_shortcuts() -> Shortcuts {
|
|||
|
||||
fn key_from_string(value: &str) -> Option<Key> {
|
||||
match value {
|
||||
"Backspace" => Some(Key::Named(Named::Backspace)),
|
||||
"Enter" => Some(Key::Named(Named::Enter)),
|
||||
"Escape" => Some(Key::Named(Named::Escape)),
|
||||
"Insert" => Some(Key::Named(Named::Insert)),
|
||||
"Delete" => Some(Key::Named(Named::Delete)),
|
||||
"Tab" => Some(Key::Named(Named::Tab)),
|
||||
"F1" => Some(Key::Named(Named::F1)),
|
||||
"F2" => Some(Key::Named(Named::F2)),
|
||||
"F3" => Some(Key::Named(Named::F3)),
|
||||
"F4" => Some(Key::Named(Named::F4)),
|
||||
"F5" => Some(Key::Named(Named::F5)),
|
||||
"F6" => Some(Key::Named(Named::F6)),
|
||||
"F7" => Some(Key::Named(Named::F7)),
|
||||
"F8" => Some(Key::Named(Named::F8)),
|
||||
"F9" => Some(Key::Named(Named::F9)),
|
||||
"F10" => Some(Key::Named(Named::F10)),
|
||||
"F11" => Some(Key::Named(Named::F11)),
|
||||
"F12" => Some(Key::Named(Named::F12)),
|
||||
"Home" => Some(Key::Named(Named::Home)),
|
||||
"End" => Some(Key::Named(Named::End)),
|
||||
"ArrowLeft" | "Left" => Some(Key::Named(Named::ArrowLeft)),
|
||||
"ArrowRight" | "Right" => Some(Key::Named(Named::ArrowRight)),
|
||||
"ArrowUp" | "Up" => Some(Key::Named(Named::ArrowUp)),
|
||||
|
|
|
|||
|
|
@ -198,7 +198,7 @@ impl TerminalPaneGrid {
|
|||
}
|
||||
pub fn unfocus_all_terminals(&self) {
|
||||
for (_pane, tab_model) in self.panes.panes.iter() {
|
||||
let entity = tab_model.active();
|
||||
for entity in tab_model.iter() {
|
||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
let mut terminal = terminal.lock().unwrap();
|
||||
terminal.is_focused = false;
|
||||
|
|
@ -206,6 +206,7 @@ impl TerminalPaneGrid {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash, Clone)]
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ where
|
|||
let scrollbar_color: Color = if pressed {
|
||||
// pressed_state_color, 0.5
|
||||
cosmic_theme
|
||||
.background
|
||||
.background(false)
|
||||
.component
|
||||
.pressed
|
||||
.without_alpha()
|
||||
|
|
@ -769,7 +769,7 @@ where
|
|||
} else if hover {
|
||||
// hover_state_color, 0.2
|
||||
cosmic_theme
|
||||
.background
|
||||
.background(false)
|
||||
.component
|
||||
.hover
|
||||
.without_alpha()
|
||||
|
|
@ -936,13 +936,14 @@ where
|
|||
},
|
||||
Event::Keyboard(KeyEvent::KeyPressed {
|
||||
key: Key::Named(named),
|
||||
physical_key,
|
||||
modified_key: Key::Named(modified_named),
|
||||
modifiers,
|
||||
text,
|
||||
..
|
||||
}) if state.is_focused && named == modified_named => {
|
||||
for key_bind in self.key_binds.keys() {
|
||||
if key_bind.matches(*modifiers, &Key::Named(*named)) {
|
||||
if key_bind.matches(*modifiers, &Key::Named(*named), None) {
|
||||
shell.capture_event();
|
||||
return;
|
||||
}
|
||||
|
|
@ -1102,6 +1103,7 @@ where
|
|||
text,
|
||||
modifiers,
|
||||
key,
|
||||
physical_key,
|
||||
..
|
||||
}) if state.is_focused && *key == Key::Character(SmolStr::new(" ")) => {
|
||||
//Special handle Enter, Escape, Backspace and Tab as described in
|
||||
|
|
@ -1127,10 +1129,11 @@ where
|
|||
text,
|
||||
modifiers,
|
||||
key,
|
||||
physical_key,
|
||||
..
|
||||
}) if state.is_focused => {
|
||||
for key_bind in self.key_binds.keys() {
|
||||
if key_bind.matches(*modifiers, key) {
|
||||
if key_bind.matches(*modifiers, key, None) {
|
||||
shell.capture_event();
|
||||
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue