Merge branch 'master' into feat/add-working-dir-arg

This commit is contained in:
Jacob Kauffmann 2026-02-16 12:41:51 -07:00
commit 773c3719a1
51 changed files with 3009 additions and 968 deletions

8
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,8 @@
- [ ] I have disclosed use of any AI generated code in my commit messages.
- If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
- In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
- [ ] I understand these changes in full and will be able to respond to review comments.
- [ ] My change is accurately described in the commit message.
- [ ] My contribution is tested and working as described.
- [ ] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.

1601
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[package]
name = "cosmic-term"
version = "0.1.0"
version = "1.0.6"
authors = ["Jeremy Soller <jeremy@system76.com>"]
edition = "2024"
license = "GPL-3.0-only"
@ -14,6 +14,7 @@ log = "0.4"
open = "5.3.2"
palette = { version = "0.7", features = ["serde"] }
paste = "1.0"
regex = "1"
ron = "0.11"
serde = { version = "1", features = ["serde_derive"] }
shlex = "1"
@ -52,6 +53,9 @@ features = ["about", "multi-window", "tokio", "winit", "surface-message"]
[target.'cfg(unix)'.dependencies]
fork = "0.4"
[build-dependencies]
xdgen = "0.1"
[features]
default = ["dbus-config", "wgpu", "wayland", "password_manager"]
dbus-config = ["libcosmic/dbus-config"]

View file

@ -1,5 +1,5 @@
# cosmic-term
WIP COSMIC terminal emulator, built using [alacritty\_terminal](https://docs.rs/alacritty_terminal) that is provided by the [alacritty](https://github.com/alacritty/alacritty) project. `cosmic-term` provides bidirectional rendering and ligatures with a custom renderer based on [cosmic-text](https://github.com/pop-os/cosmic-text).
COSMIC terminal emulator, built using [alacritty\_terminal](https://docs.rs/alacritty_terminal) that is provided by the [alacritty](https://github.com/alacritty/alacritty) project. `cosmic-term` provides bidirectional rendering and ligatures with a custom renderer based on [cosmic-text](https://github.com/pop-os/cosmic-text).
The `wgpu` feature, enabled by default, supports GPU rendering using `glyphon`
and `wgpu`. If `wgpu` is not enabled or fails to initialize, then rendering falls

24
build.rs Normal file
View file

@ -0,0 +1,24 @@
use std::{env, fs, path::PathBuf};
use xdgen::{App, Context, FluentString};
fn main() {
let id = "com.system76.CosmicTerm";
let ctx = Context::new("i18n", env::var("CARGO_PKG_NAME").unwrap()).unwrap();
let app = App::new(FluentString("cosmic-terminal"))
.comment(FluentString("comment"))
.keywords(FluentString("keywords"));
let output = PathBuf::from("target/xdgen");
fs::create_dir_all(&output).unwrap();
fs::write(
output.join(format!("{}.desktop", id)),
app.expand_desktop(format!("res/{}.desktop", id), &ctx)
.unwrap(),
)
.unwrap();
fs::write(
output.join(format!("{}.metainfo.xml", id)),
app.expand_metainfo(format!("res/{}.metainfo.xml", id), &ctx)
.unwrap(),
)
.unwrap();
}

View file

@ -0,0 +1,41 @@
(
name: "Seal Brown Amber",
background: "#623004",
foreground: "#FFBF00",
cursor: "#FFBF00",
dim_foreground: "#cfa02e",
normal: (
black: "#2b1503",
red: "#c1311c",
green: "#8bab6c",
yellow: "#FFBF00",
blue: "#4b5f8a",
magenta: "#7a4a8f",
cyan: "#6b8f8a",
white: "#f1e6c8",
),
bright: (
black: "#4a2a10",
red: "#e0482f",
green: "#a9c98c",
yellow: "#ffd54a",
blue: "#6f86c9",
magenta: "#9b6fc2",
cyan: "#8fc9c3",
white: "#ffffff",
),
dim: (
black: "#1e0f02",
red: "#8f2414",
green: "#6e8a55",
yellow: "#c99a28",
blue: "#39476b",
magenta: "#5e3a70",
cyan: "#4f6f6b",
white: "#cdbf9e",
),
)

18
debian/changelog vendored
View file

@ -1,3 +1,21 @@
cosmic-term (1.0.6) noble; urgency=medium
* Epoch 1.0.6 version update
-- Jeremy Soller <jeremy@system76.com> Thu, 05 Feb 2026 15:23:41 -0700
cosmic-term (1.0.5) noble; urgency=medium
* Epoch 1.0.5 version update
-- Jeremy Soller <jeremy@system76.com> Fri, 30 Jan 2026 17:16:48 -0700
cosmic-term (1.0.4) noble; urgency=medium
* Epoch 1.0.4 version update
-- Jeremy Soller <jeremy@system76.com> Wed, 21 Jan 2026 10:18:52 -0700
cosmic-term (0.1.0) jammy; urgency=medium
* Initial release.

32
flake.lock generated
View file

@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1746232882,
"narHash": "sha256-MHmBH2rS8KkRRdoU/feC/dKbdlMkcNkB5mwkuipVHeQ=",
"lastModified": 1766309749,
"narHash": "sha256-3xY8CZ4rSnQ0NqGhMKAy5vgC+2IVK0NoVEzDoOh4DA4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7a2622e2c0dbad5c4493cb268aba12896e28b008",
"rev": "a6531044f6d0bef691ea18d4d4ce44d0daa6e816",
"type": "github"
},
"original": {
@ -34,22 +34,6 @@
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
@ -59,14 +43,16 @@
},
"rust-overlay": {
"inputs": {
"nixpkgs": "nixpkgs_2"
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1746239644,
"narHash": "sha256-wMvMBMlpS1H8CQdSSgpLeoCWS67ciEkN/GVCcwk7Apc=",
"lastModified": 1766630657,
"narHash": "sha256-wW15buPGU29v0XuAmDkc30+d5j4Tmg/V8AkpHH+hDWY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "bd32e88bef6da0e021a42fb4120a8df2150e9b8c",
"rev": "3bf67c5e473f29ca79ff15904f3072d87cf6d087",
"type": "github"
},
"original": {

View file

@ -2,7 +2,10 @@
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
flake-utils.lib.eachDefaultSystem
@ -15,7 +18,7 @@
in
with pkgs;
{
formatter = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt;
formatter = nixpkgs.legacyPackages.${system}.nixpkgs-fmt;
devShells.default = mkShell {
buildInputs = [
rust-bin.stable.latest.default

View file

@ -1,4 +1,6 @@
cosmic-terminal = طرفية COSMIC
comment = محاكي طرفي لسطح مكتب COSMIC
keywords = cli;طرفية;أوامر;صدفة;
new-terminal = طرفية جديدة
# Context Pages
@ -117,3 +119,28 @@ open-link = افتح الرابط
menu-password-manager = كلمات السر...
password-input = كلمة السر
password-input-description = الوصف
add-another-keybinding = أضِف ارتباطات مفاتيح أخرى
cancel = ألغِ
close-window = أغلِق النافذة
disable = عطِّل
focus-pane-left = تركيز على اللوحة الشِمالية
focus-pane-right = تركيز على اللوحة اليمنى
focus-pane-up = تركيز على اللوحة الفوقية
keyboard-shortcuts = اختصارات لوحة المفاتيح
menu-keyboard-shortcuts = اختصارات لوحة المفاتيح...
no-shortcuts = لا اختصارات
password-manager = مدير كلمات السر
paste-primary = ألصِق الرئيسي
replace = استبدل
reset-to-default = صفّر إلى المبدئي
shortcut-capture-hint = اضغط على تركيبة المفاتيح
shortcut-group-clipboard = الحافظة
shortcut-group-other = أخرى
shortcut-group-tabs = ألسنة
shortcut-group-window = نافذة
shortcut-group-zoom = كبِّر
shortcut-replace-body = عُيِّن { $binding } بالفعل لـ { $existing }. أتريد استبداله بـ { $new_action }؟
shortcut-replace-title = استبدل الاختصار؟
tab-activate = نشّط لسان { $number }
toggle-fullscreen = بدّل ملء الشاشة
type-to-search = اكتب للبحث...

View file

@ -44,7 +44,7 @@ light = Светлая
syntax-dark = Цёмны сінтаксіс
syntax-light = Светлы сінтаксіс
default-zoom-step = Крок маштабавання
opacity = Непразрыстаць фону
opacity = Непразрыстасць фону
### Font
@ -97,7 +97,7 @@ find = Знайсці
## View
view = Выгляд
zoom-in = Большы тэкст
zoom-in = Павялічыць тэкст
zoom-reset = Прадв. памер тэксту
zoom-out = Меньшы тэкст
next-tab = Наступная ўкладка

View file

@ -1,9 +1,11 @@
comment = Emulátor terminálu pro pracovní prostředí COSMIC
keywords = Příkaz;Shell;Terminál;Konzole;CLI;
settings = Nastavení
appearance = Vzhled
theme = Téma
theme = Motiv
match-desktop = Podle systému
dark = Tmavé
light = Světlé
dark = Tmavý
light = Světlý
file = Soubor
quit = Ukončit
import = Importovat
@ -44,7 +46,7 @@ splits = Rozdělení
focus-follow-mouse = Zaměření psaní sleduje myš
advanced = Pokročilé
show-headerbar = Zobrazit hlavičku
show-header-description = Hlavičku je možné odkrýt z kontextového menu.
show-header-description = Hlavičku je možné odkrýt z kontextového menu
find-placeholder = Najít...
find-previous = Najít předchozí
find-next = Najít další
@ -60,9 +62,9 @@ select-all = Vybrat vše
find = Najít
clear-scrollback = Vymazat rolování
view = Zobrazení
zoom-in = Větší text
zoom-in = Zvětšit text
zoom-reset = Výchozí velikost textu
zoom-out = Menší text
zoom-out = Zmenšit text
next-tab = Další karta
previous-tab = Předchozí karta
split-horizontal = Rozdělit horizontálně
@ -77,3 +79,30 @@ add-password = Přidat heslo
password-input = Heslo
password-input-description = Popis
open-link = Otevřít odkaz
add-another-keybinding = Přidat další klávesovou zkratku
cancel = Zrušit
close-window = Zavřít okno
disable = Zakázat
keyboard-shortcuts = Klávesové zkratky
menu-keyboard-shortcuts = Klávesové zkratky...
no-shortcuts = Žádné zkratky
password-manager = Manažer hesel
replace = Nahradit
reset-to-default = Obnovit výchozí
shortcut-group-clipboard = Schránka
shortcut-group-tabs = Karty
shortcut-group-window = Okno
shortcut-replace-title = Nahradit zkratku?
tab-activate = Aktivovat kartu { $number }
shortcut-group-other = Ostatní
shortcut-group-zoom = Přiblížení
toggle-fullscreen = Přepnout režim celé obrazovky
type-to-search = Pište pro vyhledávání...
copy-or-sigint = Kopírovat nebo SIGINT
focus-pane-down = Zaměřit panel dole
focus-pane-left = Zaměřit panel vlevo
focus-pane-right = Zaměřit panel vpravo
focus-pane-up = Zaměřit panel nahoře
shortcut-replace-body = { $binding } je již přiřazena k „{ $existing }“. Nahradit za „{ $new_action }“?
shortcut-capture-hint = Stiskněte kombinaci kláves
paste-primary = Vložit primární

View file

@ -110,3 +110,4 @@ menu-color-schemes = Farbschemen...
menu-settings = Einstellungen...
menu-about = Über COSMIC Terminal...
repository = Repository
cancel = Abbrechen

View file

@ -1,4 +1,6 @@
cosmic-terminal = COSMIC Terminal
comment = Terminal emulator for the COSMIC desktop
keywords = Command;Shell;Terminal;CLI;
new-terminal = New terminal
# Context Pages
@ -62,6 +64,35 @@ advanced = Advanced
show-headerbar = Show header
show-header-description = Reveal the header from the right-click menu.
### Keyboard shortcuts
add-another-keybinding = Add another keybinding
cancel = Cancel
close-window = Close window
copy-or-sigint = Copy or SIGINT
disable = Disable
focus-pane-down = Focus pane down
focus-pane-left = Focus pane left
focus-pane-right = Focus pane right
focus-pane-up = Focus pane up
keyboard-shortcuts = Keyboard shortcuts
menu-keyboard-shortcuts = Keyboard shortcuts...
no-shortcuts = No shortcuts
password-manager = Password manager
paste-primary = Paste primary
replace = Replace
reset-to-default = Reset to default
shortcut-capture-hint = Press the key combination
shortcut-group-clipboard = Clipboard
shortcut-group-other = Other
shortcut-group-tabs = Tabs
shortcut-group-window = Window
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 }
toggle-fullscreen = Toggle fullscreen
type-to-search = Type to search...
# Find
find-placeholder = Find...
find-previous = Find previous

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminal COSMIC
comment = Emulador de terminal de escritorio COSMIC
keywords = Comando;Shell;Terminal;Consola;
new-terminal = Nuevo terminal
# Context Pages

View file

@ -117,3 +117,30 @@ add-password = Ajouter un mot de passe
password-input = Mot de passe
password-input-description = Description
open-link = Ouvrir le lien
add-another-keybinding = Ajouter un autre raccourci clavier
cancel = Annuler
close-window = Fermer la fenêtre
copy-or-sigint = Copier ou SIGINT
disable = Désactiver
keyboard-shortcuts = Raccourcis clavier
menu-keyboard-shortcuts = Raccourcis clavier...
no-shortcuts = Aucun raccourci
password-manager = Gestionnaire de mots de passe
paste-primary = Coller primaire
replace = Remplacer
shortcut-capture-hint = Appuyer sur la combinaison de touches
shortcut-group-clipboard = Presse-papier
shortcut-group-other = Autre
shortcut-group-tabs = Onglets
shortcut-group-window = Fenêtre
shortcut-group-zoom = Zoom
shortcut-replace-body = { $binding } est déjà assigné à { $existing }. Le remplacer avec { $new_action }?
shortcut-replace-title = Remplacer raccourci?
tab-activate = Activer l'onglet { $number }
type-to-search = Taper pour chercher...
focus-pane-down = Passer au panneau du dessous
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
toggle-fullscreen = Basculer en plein écran

View file

@ -117,3 +117,30 @@ passwords-title = Pasfhocail
add-password = Cuir Pasfhocal leis
password-input = Pasfhocal
password-input-description = Cur síos
add-another-keybinding = Cuir ceangal eochrach eile leis
cancel = Cealaigh
close-window = Dún an fhuinneog
copy-or-sigint = Cóipeáil nó SIGINT
disable = Díchumasaigh
focus-pane-down = Painéal fócais síos
focus-pane-left = Painéal fócais ar chlé
focus-pane-right = Painéal fócais ar dheis
focus-pane-up = Painéal fócais suas
keyboard-shortcuts = Aicearraí méarchláir
menu-keyboard-shortcuts = Aicearraí méarchláir...
no-shortcuts = Gan aicearraí
password-manager = Bainisteoir pasfhocal
paste-primary = Greamaigh príomhúil
replace = Athsholáthair
reset-to-default = Athshocraigh go réamhshocraithe
shortcut-capture-hint = Brúigh an teaglaim eochrach
shortcut-group-clipboard = Gearrthaisce
shortcut-group-other = Eile
shortcut-group-tabs = Cluaisíní
shortcut-group-window = Fuinneog
shortcut-group-zoom = Súmáil
shortcut-replace-body = Tá { $binding } sannta do { $existing } cheana féin. Cuir { $new_action } ina áit?
shortcut-replace-title = Aicearra a athsholáthar?
tab-activate = Gníomhachtaigh an cluaisín { $number }
toggle-fullscreen = Scoraigh lánscáileán
type-to-search = Clóscríobh le cuardach a dhéanamh...

View file

@ -1,4 +1,6 @@
cosmic-terminal = COSMIC Terminál
comment = Terminálemulátor a COSMIC asztali környezethez
keywords = parancssor;terminál;
new-terminal = Új terminál
# Context Pages
@ -30,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
@ -51,7 +53,7 @@ opacity = Háttér átlátszósága
### Font
font = Betűtípus
advanced-font-settings = Haladó betűtípus-beállítások
advanced-font-settings = Speciális betűtípus-beállítások
default-font = Betűtípus
default-font-size = Betűméret
default-font-stretch = Betűszélesség
@ -67,11 +69,11 @@ focus-follow-mouse = A fókusz követi az egeret gépelés közben
### Advanced
advanced = Haladó
advanced = Speciális
show-headerbar = Fejléc megjelenítése
show-header-description = Fejléc megjelenítése a jobb gombos menüből.
show-header-description = Fejléc megjelenítése a jobb gombos menüből
# Find
find-placeholder = Keresés...
find-placeholder = Keresés
find-previous = Előző találat
find-next = Következő találat
@ -84,7 +86,7 @@ file = Fájl
new-tab = Új lap
new-window = Új ablak
profile = Profil
menu-profiles = Profilok...
menu-profiles = Profilok
close-tab = Lap bezárása
quit = Kilépés
@ -108,12 +110,39 @@ previous-tab = Előző lap
split-horizontal = Vízszintes felosztás
split-vertical = Függőleges felosztás
pane-toggle-maximize = Panel maximalizálása
menu-color-schemes = Színsémák...
menu-settings = Beállítások...
menu-about = A COSMIC Terminál névjegye...
menu-password-manager = Jelszavak...
menu-color-schemes = Színsémák
menu-settings = Beállítások
menu-about = A COSMIC Terminál névjegye
menu-password-manager = Jelszavak
passwords-title = Jelszavak
add-password = Jelszó hozzáadása
password-input = Jelszó
password-input-description = Leírás
open-link = Link megnyitása
open-link = Hivatkozás megnyitása
add-another-keybinding = Új gyorsbillentyű hozzáadása
cancel = Mégse
close-window = Ablak bezárása
copy-or-sigint = Másolás vagy SIGINT
disable = Letiltás
focus-pane-down = Fókusz az alsó panelre
focus-pane-left = Fókusz a bal oldali panelre
focus-pane-right = Fókusz a jobb oldali panelre
keyboard-shortcuts = Gyorsbillentyűk
menu-keyboard-shortcuts = Gyorsbillentyűk…
no-shortcuts = Nincsenek gyorsbillentyűk
password-manager = Jelszókezelő
focus-pane-up = Fókusz a felső panelre
paste-primary = Elsődleges vágólap beillesztése
replace = Csere
reset-to-default = Visszaállítás alapértelmezettre
shortcut-capture-hint = Nyomd meg a billentyűkombinációt
shortcut-group-clipboard = Vágólap
shortcut-group-other = Egyéb
shortcut-group-tabs = Lapok
shortcut-group-window = Ablak
shortcut-group-zoom = Nagyítás
shortcut-replace-body = A(z) { $binding } már hozzá van rendelve ehhez: { $existing }. Lecseréled erre: { $new_action }?
shortcut-replace-title = Gyorsbillentyű cseréje?
tab-activate = { $number }. lap aktiválása
toggle-fullscreen = Teljes képernyő váltása
type-to-search = Gépelj a kereséshez…

View file

@ -0,0 +1,106 @@
syntax-light = Skema warna terang
new-terminal = Terminal baru
repository = Repositori
support = Dukungan
color-schemes = Skema warna
cosmic-terminal = Terminal COSMIC
rename = Ganti nama
export = Ekspor
delete = Hapus
import = Impor
import-errors = Galat impor
profiles = Profil
name = Nama
command-line = Baris perintah
tab-title = Judul tab
tab-title-description = Timpakan judul tab bawaan
add-profile = Tambahkan profil
new-profile = Profil baru
make-default = Jadikan bawaan
working-directory = Direktori kerja
hold = Tahan
remain-open = Tetap buka setelah proses anak berakhir.
settings = Pengaturan
appearance = Tampilan
theme = Tema
match-desktop = Cocokkan desktop
dark = Gelap
light = Terang
syntax-dark = Skema warna gelap
default-zoom-step = Langkah pembesar
opacity = Opasitas latar belakang
font = Huruf
advanced-font-settings = Pengaturan huruf lanjutan
default-font = Huruf
default-font-size = Ukuran huruf
default-font-stretch = Peregangan huruf
default-font-weight = Bobot huruf normal
default-dim-font-weight = Bobot huruf redup
default-bold-font-weight = Bobot huruf tebal
use-bright-bold = Jadikan teks tebal lebih terang
splits = Pemisahan
focus-follow-mouse = Fokus pengetikan mengikuti tetikus
advanced = Lanjutan
show-header-description = Tampilkan tajuk dari menu klik kanan.
show-headerbar = Tampilkan tajuk
find-placeholder = Temukan...
find-previous = Temukan sebelumnya
find-next = Temukan selanjutnya
file = Berkas
new-tab = Tab baru
new-window = Jendela baru
profile = Profil
menu-profiles = Profil...
close-tab = Tutup tab
quit = Keluar
edit = Sunting
copy = Salin
paste = Tempel
select-all = Pilih semua
find = Temukan
clear-scrollback = Hapus riwayat gulir
open-link = Buka Tautan
view = Tampilan
zoom-in = Teks lebih besar
zoom-reset = Ukuran teks bawaan
zoom-out = Teks lebih kecil
next-tab = Tab selanjutnya
previous-tab = Tab sebelumnya
split-horizontal = Pemisahan horisontal
split-vertical = Pemisahan vertikal
pane-toggle-maximize = Ubah ke maksimal
menu-color-schemes = Skema warna...
menu-settings = Pengaturan...
menu-about = Tentang Terminal COSMIC...
menu-password-manager = Kata Sandi...
passwords-title = Kata Sandi
add-password = Tambahkan Kata Sandi
password-input = Kata Sandi
password-input-description = Deskripsi
add-another-keybinding = Tambahkan pintasan tombol lainnya
cancel = Batalkan
close-window = Tutup jendela
copy-or-sigint = Salin atau SIGINT
disable = Nonaktifkan
type-to-search = Ketik untuk mencari...
toggle-fullscreen = Ubah layar penuh
tab-activate = Aktifkan tab { $number }
replace = Ganti
shortcut-replace-title = Ganti pintasan?
shortcut-group-zoom = Zum
shortcut-group-window = Jendela
shortcut-group-tabs = Tab
shortcut-group-other = Lainnya
shortcut-group-clipboard = Papan klip
shortcut-capture-hint = Tekan kombinasi tombol
reset-to-default = Atur ulang ke bawaan
shortcut-replace-body = { $binding } sudah ditetapkan ke { $existing }. Ganti dengan { $new_action }?
paste-primary = Tempel primer
password-manager = Pengelolaan kata sandi
no-shortcuts = Tidak ada pintasan
menu-keyboard-shortcuts = Pintasan papan ketik...
keyboard-shortcuts = Pintasan papan ketik
focus-pane-down = Fokuskan panel ke bawah
focus-pane-left = Fokuskan panel ke kiri
focus-pane-right = Fokuskan panel ke kanan
focus-pane-up = Fokuskan panel ke atas

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminale COSMIC
comment = Emulatore di terminale di COSMIC
keywords = Comando;Shell;Terminale;Console;
new-terminal = Nuovo terminale
# Context Pages

106
i18n/kk/cosmic_term.ftl Normal file
View file

@ -0,0 +1,106 @@
name = Аты
delete = Өшіру
repository = Репозиторий
support = Қолдау
settings = Баптаулар
appearance = Сыртқы түрі
theme = Тақырып
match-desktop = Жұмыс үстеліне сәйкес келу
dark = Қараңғы
light = Жарық
file = Файл
new-tab = Жаңа бет
new-window = Жаңа терезе
close-tab = Бетті жабу
quit = Шығу
edit = Түзету
copy = Көшіру
paste = Кірістіру
select-all = Барлығын таңдау
view = Көрініс
menu-settings = Баптаулар...
export = Экспорттау
import = Импорттау
default-zoom-step = Масштабтау қадамдары
find-placeholder = Табу...
find-previous = Алдыңғысын табу
find-next = Келесісін табу
find = Табу
cosmic-terminal = COSMIC терминалы
new-terminal = Жаңа терминал
color-schemes = Түстер схемалары
rename = Атын өзгерту
import-errors = Импорттау қателері
profiles = Профильдер
command-line = Командалық жол
tab-title = Бет атауы
tab-title-description = Әдепкі бет атауын алмастыру
add-profile = Профильді қосу
new-profile = Жаңа профиль
make-default = Әдепкі қылып орнату
working-directory = Жұмыс бумасы
hold = Ұстап тұру
remain-open = Туынды процесс аяқталғаннан кейін ашық күйде қалу.
syntax-dark = Қараңғы түстер схемасы
syntax-light = Ашық түстер схемасы
opacity = Фон мөлдірлігі
font = Қаріп
advanced-font-settings = Қаріптің қосымша баптаулары
default-font = Қаріп
default-font-size = Қаріп өлшемі
default-font-stretch = Қаріпті созу
default-font-weight = Қалыпты қаріптің қалыңдығы
default-dim-font-weight = Күңгірт қаріптің қалыңдығы
default-bold-font-weight = Жуан қаріптің қалыңдығы
use-bright-bold = Жуан мәтінді жарықтау қылу
splits = Бөліктер
focus-follow-mouse = Теру фокусы тышқан соңынан ереді
advanced = Қосымша
show-headerbar = Тақырыптаманы көрсету
show-header-description = Оң жақ батырма мәзірі арқылы тақырыптаманы көрсету.
profile = Профиль
menu-profiles = Профильдер...
clear-scrollback = Айналдыру тарихын тазарту
open-link = Сілтемені ашу
zoom-in = Үлкенірек мәтін
zoom-reset = Әдепкі мәтін өлшемі
zoom-out = Кішірек мәтін
next-tab = Келесі бет
previous-tab = Алдыңғы бет
split-horizontal = Горизонталды бөлу
split-vertical = Вертикалды бөлу
pane-toggle-maximize = Толық экран режимін ауыстыру
menu-color-schemes = Түс схемалары...
menu-about = COSMIC терминалы туралы...
menu-password-manager = Парольдер...
passwords-title = Парольдер
add-password = Пароль қосу
password-input = Пароль
password-input-description = Сипаттама
cancel = Бас тарту
add-another-keybinding = Басқа пернелер тіркесін қосу
close-window = Терезені жабу
copy-or-sigint = Көшіру немесе SIGINT
disable = Сөндіру
focus-pane-down = Төмендегі панельге фокустау
focus-pane-left = Сол жақтағы панельге фокустау
focus-pane-right = Оң жақтағы панельге фокустау
focus-pane-up = Жоғарыдағы панельге фокустау
keyboard-shortcuts = Пернетақта жарлықтары
menu-keyboard-shortcuts = Пернетақта жарлықтары...
no-shortcuts = Жарлықтар жоқ
password-manager = Парольдер менеджері
paste-primary = Негізгіні кірістіру
replace = Алмастыру
reset-to-default = Әдепкі күйге қайтару
shortcut-capture-hint = Пернелер комбинациясын басыңыз
shortcut-group-clipboard = Алмасу буфері
shortcut-group-other = Басқа
shortcut-group-tabs = Беттер
shortcut-group-window = Терезе
shortcut-group-zoom = Масштаб
shortcut-replace-body = { $binding } қазірдің өзінде { $existing } үшін тағайындалған. Оны { $new_action } әрекетімен алмастыру керек пе?
shortcut-replace-title = Жарлықты алмастыру керек пе?
tab-activate = { $number }-бетті белсендіру
toggle-fullscreen = Толық экран режиміне ауысу
type-to-search = Іздеу үшін теріңіз...

View file

@ -0,0 +1,79 @@
new-terminal = 새 터미널
quit = 종료
rename = 이름 바꾸기
theme = 테마
appearance = 외관
name = 이름
light = 라이트
delete = 삭제
repository = 저장소
support = 지원
dark = 다크
match-desktop = 시스템과 동기화
settings = 설정
file = 파일
cosmic-terminal = COSMIC 터미널
color-schemes = 색 구성표
import-errors = 가져오기 오류
import = 가져오기
profiles = 프로필
command-line = 명령줄
syntax-light = 라이트모드 색 구성표
default-font-weight = 일반 글꼴 굵기
add-profile = 프로필 추가
find-next = 다음 찾기
splits = 분할
zoom-in = 텍스트 크게
select-all = 모두 선택
previous-tab = 이전 탭
show-headerbar = 헤더 표시
new-window = 새 창
zoom-out = 텍스트 작게
split-vertical = 세로로 분할
syntax-dark = 다크모드 색 구성표
menu-profiles = 프로필...
tab-title-description = 기본 탭 제목 재정의
menu-about = COSMIC 터미널 정보...
remain-open = 자식 프로세스 종료 후 열린 상태를 유지합니다.
menu-color-schemes = 색 구성표...
working-directory = 작업 디렉터리
opacity = 배경 투명도
tab-title = 탭 제목
zoom-reset = 기본 텍스트 크기
passwords-title = 암호
edit = 편집
copy = 복사
pane-toggle-maximize = 최대화 전환
export = 내보내기
password-input = 암호
close-tab = 탭 닫기
default-dim-font-weight = 희미한 글꼴 굵기
advanced = 고급
use-bright-bold = 굵은 텍스트를 더 밝게 표시
default-bold-font-weight = 굵은 글꼴 굵기
show-header-description = 오른쪽 클릭 메뉴를 통해 헤더를 나타냅니다.
password-input-description = 설명
default-font = 글꼴
paste = 붙여넣기
menu-settings = 설정...
add-password = 암호 추가
view = 보기
default-font-stretch = 글꼴 늘이기
hold = 유지
menu-password-manager = 암호...
find-previous = 이전 찾기
default-font-size = 글꼴 크기
split-horizontal = 가로로 분할
find-placeholder = 찾기...
focus-follow-mouse = 마우스가 위치한 곳에 입력
advanced-font-settings = 고급 글꼴 설정
font = 글꼴
next-tab = 다음 탭
default-zoom-step = 확대/축소 간격
clear-scrollback = 이전 출력 내역 지우기
open-link = 링크 열기
make-default = 기본으로 설정
new-profile = 새 프로필
find = 찾기
profile = 프로필
new-tab = 새 탭

View file

@ -71,3 +71,5 @@ menu-password-manager = Slaptažodžiai...
passwords-title = Slaptažodžiai
add-password = Pridėti Slaptažodį
password-input = Slaptažodis
default-font-stretch = Šrifto tempimas
password-input-description = Aprašymas

0
i18n/ml/cosmic_term.ftl Normal file
View file

0
i18n/ms/cosmic_term.ftl Normal file
View file

View file

@ -11,9 +11,9 @@ new-terminal = Nieuwe terminal
color-schemes = Kleurenschema's
rename = Hernoem
export = Exporteer
export = Exporteren
delete = Verwijder
import = Importeer
import = Importeren
import-errors = Importfouten
## Profiles
@ -80,7 +80,7 @@ find-next = Zoek volgende
file = Bestand
new-tab = Nieuw tabblad
new-window = Nieuw venster
new-window = Nieuw venster openen
profile = Profiel
menu-profiles = Profielen...
close-tab = Sluit tabblad
@ -89,7 +89,7 @@ quit = Beëindig
## Edit
edit = Bewerk
copy = Kopieer
copy = Kopiëer
paste = Plak
select-all = Selecteer alles
find = Zoek
@ -107,7 +107,10 @@ split-horizontal = Splits horizontaal
split-vertical = Splits verticaal
pane-toggle-maximize = Gemaximaliseerd
menu-color-schemes = Kleurenpaletten...
menu-settings = Instellingen...
menu-settings = Instellingen
menu-about = Over COSMIC Terminal…
support = Ondersteuning
repository = Bibliotheek
cancel = Annuleren
type-to-search = Typ om te zoeken…
replace = Vervangen

0
i18n/oc/cosmic_term.ftl Normal file
View file

0
i18n/pa/cosmic_term.ftl Normal file
View file

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminal COSMIC
comment = Emulator terminala dla pulpitu COSMIC
keywords = Cli;WierszPoleceń;Powłoka;Terminal;
new-terminal = Nowy terminal
# Context Pages
@ -117,3 +119,30 @@ add-password = Dodaj Hasło
password-input = Hasło
password-input-description = Opis
open-link = Otwórz Odnośnik
add-another-keybinding = Dodaj kolejny skrót klawiszowy
cancel = Anuluj
close-window = Zamknij okno
copy-or-sigint = Kopiuj lub SIGINT
disable = Wyłącz
keyboard-shortcuts = Skróty klawiszowe
menu-keyboard-shortcuts = Skróty klawiszowe…
no-shortcuts = Brak skrótów
password-manager = Menedżer haseł
paste-primary = Wklej główne
replace = Zastąp
reset-to-default = Przywróć domyślne
shortcut-capture-hint = Naciśnij kombinację klawiszy
shortcut-group-clipboard = Schowek
shortcut-group-other = Inne
shortcut-group-tabs = Karty
shortcut-group-window = Okno
shortcut-group-zoom = Przybliżenie
shortcut-replace-body = { $binding } jest już przypisany do { $existing }. Zastąpć je przez { $new_action }?
shortcut-replace-title = Zastąpić skrót klawiszowy?
tab-activate = Aktywuj kartę { $number }
toggle-fullscreen = Przełącznik pełnego ekranu
type-to-search = Zacznij pisać by wyszukać…
focus-pane-down = Aktywuj panel niżej
focus-pane-left = Aktywuj lewy panel
focus-pane-right = Aktywuj prawy panel
focus-pane-up = Aktywuj panel wyżej

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminal COSMIC
comment = Emulador de terminal do desktop COSMIC
keywords = Comando;Shell;Terminal;
new-terminal = Novo terminal
# Context Pages
@ -117,3 +119,30 @@ passwords-title = Senhas
add-password = Adicionar Senha
password-input = Senha
password-input-description = Descrição
add-another-keybinding = Adicionar outra combinação de teclas
cancel = Cancelar
close-window = Fechar janela
copy-or-sigint = Copiar ou SIGINT
disable = Desabilitar
focus-pane-down = Focar painel abaixo
focus-pane-left = Focar painel à esquerda
focus-pane-right = Focar painel à direita
focus-pane-up = Focar painel acima
keyboard-shortcuts = Atalhos de teclado
menu-keyboard-shortcuts = Atalhos de teclado...
no-shortcuts = Sem atalhos
password-manager = Gerenciador de senhas
paste-primary = Colar
replace = Substituir
reset-to-default = Restaurar padrão
shortcut-capture-hint = Pressione a combinação de teclas
shortcut-group-clipboard = Área de transferência
shortcut-group-other = Outro
shortcut-group-tabs = Abas
shortcut-group-window = Janela
shortcut-group-zoom = Zoom
shortcut-replace-body = { $binding } já está atribuído a { $existing }. Substituir por { $new_action }?
shortcut-replace-title = Substituir atalho?
tab-activate = Ativar aba { $number }
toggle-fullscreen = Alternar para tela cheia
type-to-search = Digite para pesquisar...

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminal COSMIC
comment = Emulador de terminal do desktop COSMIC
keywords = Comando;Shell;Terminal;Console;
new-terminal = Novo terminal
# Context Pages

View file

@ -1,4 +1,6 @@
cosmic-terminal = Терминал COSMIC
comment = Эмулятор терминала для рабочей среды COSMIC
keywords = Команда;Оболочка;Терминал;Консоль;
new-terminal = Новый терминал
# Context Pages
@ -13,7 +15,7 @@ color-schemes = Цветовые схемы
rename = Переименовать
export = Экспортировать
delete = Удалить
import = Импортировать
import = Импорт
import-errors = Ошибки при импорте
## Profiles
@ -39,8 +41,8 @@ settings = Параметры
appearance = Оформление
theme = Тема
match-desktop = Как в системе
dark = Тёмное
light = Светлое
dark = Тёмная
light = Светлая
syntax-dark = Тёмная цветовая схема
syntax-light = Светлая цветовая схема
default-zoom-step = Шаг масштабирования
@ -111,3 +113,30 @@ menu-about = О Терминале COSMIC...
support = Поддержка
repository = Репозиторий
clear-scrollback = Очистить вывод команд
add-another-keybinding = Добавить сочетание клавиш
cancel = Отмена
close-window = Закрыть окно
copy-or-sigint = Копировать или SIGINT
disable = Отключить
focus-pane-down = Переместить фокус вниз
focus-pane-left = Переместить фокус налево
focus-pane-right = Переместить фокус направо
focus-pane-up = Переместить фокус вверх
keyboard-shortcuts = Сочетания клавиш
menu-keyboard-shortcuts = Сочетания клавиш...
no-shortcuts = Нет сочетаний клавиш
password-manager = Менеджер паролей
paste-primary = Вставить первичное выделение
replace = Заменить
reset-to-default = Вернуть по умолчанию
shortcut-capture-hint = Нажмите комбинацию клавиш
shortcut-group-clipboard = Буфер обмена
shortcut-group-other = Прочие
shortcut-group-tabs = Вкладки
shortcut-group-window = Окно
shortcut-group-zoom = Масштаб
shortcut-replace-body = { $binding } уже присвоено { $existing }. Заменить его на { $new_action }?
shortcut-replace-title = Заменить сочетание клавиш?
tab-activate = Активировать вкладку { $number }
toggle-fullscreen = Вкл./выкл. полноэкранный режим
type-to-search = Введите для поиска...

View file

@ -1,4 +1,6 @@
cosmic-terminal = Terminál COSMIC
comment = Emulátor terminálu pre pracovné prostredie COSMIC
keywords = Príkaz;Shell;Terminál;Konzola;
new-terminal = Nový terminál
# Kontextové stránky

View file

@ -1,4 +1,6 @@
cosmic-terminal = COSMIC Terminal
comment = Terminalemulator för skribordsmiljön COSMIC
keywords = Kommando;Skal;Terminal;CLI;Konsol;
new-terminal = Ny terminal
# Context Pages
@ -121,3 +123,30 @@ passwords-title = Lösenord
add-password = Lägg till lösenord
password-input = Lösenord
password-input-description = Beskrivning
type-to-search = Skriv för att söka...
cancel = Avbryt
close-window = Stäng fönster
copy-or-sigint = Kopiera eller SIGINT
disable = Avaktivera
password-manager = Lösenordshanterare
replace = Ersätt
shortcut-capture-hint = Tryck tangentkombinationen
shortcut-group-window = Fönster
shortcut-replace-body = { $binding } har redan tilldelats till { $existing }. Ersätt den med { $new_action }?
shortcut-replace-title = Ersätt genväg?
tab-activate = Aktivera flik { $number }
toggle-fullscreen = Växla helskärmsläge
add-another-keybinding = Lägg till ytterligare tangentbindning
focus-pane-down = Fokusera fält nedåt
focus-pane-left = Fokusera fält vänster
focus-pane-right = Fokusera fält höger
focus-pane-up = Fokusera fält uppåt
keyboard-shortcuts = Tangentbordsgenvägar
menu-keyboard-shortcuts = Tangentbordsgenvägar...
no-shortcuts = Inga genvägar
paste-primary = Klistra in primär
reset-to-default = Återställ till standard
shortcut-group-clipboard = Urklipp
shortcut-group-other = Andra
shortcut-group-tabs = Flikar
shortcut-group-zoom = Zooma

0
i18n/ti/cosmic_term.ftl Normal file
View file

View file

@ -9,10 +9,10 @@ new-terminal = Новий термінал
## Color schemes
color-schemes = Схеми кольорів
color-schemes = Кольорові схеми
rename = Перейменувати
export = Експортувати
delete = Вилучити
export = Експорт
delete = Видалити
import = Імпортувати
import-errors = Помилки імпорту
@ -21,7 +21,7 @@ import-errors = Помилки імпорту
profiles = Профілі
name = Назва
command-line = Командний рядок
tab-title = Назва вкладки
tab-title = Заголовок вкладки
tab-title-description = Замінити типовий заголовок вкладки
add-profile = Додати профіль
new-profile = Новий профіль
@ -38,30 +38,30 @@ settings = Налаштування
appearance = Зовнішній вигляд
theme = Тема
match-desktop = Відповідно системі
match-desktop = Системна
dark = Темна
light = Світла
syntax-dark = Темна схема кольорів
syntax-light = Світла схема кольорів
syntax-dark = Темна колірна схема
syntax-light = Світла колірна схема
default-zoom-step = Зміна масштабу
opacity = Непрозорість тла
### Font
font = Шрифт
advanced-font-settings = Розширені налаштування шрифтів
advanced-font-settings = Розширені налаштування шрифту
default-font = Шрифт
default-font-size = Розмір шрифту
default-font-stretch = Розтягнення шрифту
default-font-weight = Звичайна товщина шрифту
default-dim-font-weight = Товщина тьмяного шрифту
default-bold-font-weight = Товщина жирного шрифту
use-bright-bold = Збільшити яскравість жирного шрифту
default-font-weight = Звичайне накреслення шрифту
default-dim-font-weight = Приглушене накреслення шрифту
default-bold-font-weight = Жирне накреслення шрифту
use-bright-bold = Зробити жирний текст яскравішим
### Splits
splits = Розділення
focus-follow-mouse = Ділянка під мишею отримує фокус для введення даних
focus-follow-mouse = Фокус введення слідує за мишею
### Advanced
@ -96,7 +96,7 @@ find = Знайти
## View
view = Вигляд
view = Вид
zoom-in = Збільшити текст
zoom-reset = Типовий розмір тексту
zoom-out = Зменшити текст
@ -105,15 +105,42 @@ previous-tab = Попередня вкладка
split-horizontal = Розділити горизонтально
split-vertical = Розділити вертикально
pane-toggle-maximize = Перемкнути розгортання
menu-color-schemes = Схеми кольорів...
menu-color-schemes = Кольорові схеми...
menu-settings = Налаштування...
menu-about = Про Термінал COSMIC...
repository = Репозиторій
repository = Сховище
support = Підтримка
clear-scrollback = Очистити текст поза межами екрану
clear-scrollback = Очистити прокрутку
menu-password-manager = Паролі...
passwords-title = Паролі
add-password = Додати пароль
password-input = Пароль
password-input-description = Опис
open-link = Відкрити посилання
open-link = Відкрити ланку
cancel = Скасувати
close-window = Закрити вікно
disable = Вимкнути
keyboard-shortcuts = Сполучення клавіш
menu-keyboard-shortcuts = Сполучення клавіш...
password-manager = Менеджер паролів
replace = Замінити
reset-to-default = Типові значення
shortcut-group-tabs = Вкладки
shortcut-group-window = Вікно
shortcut-replace-body = { $binding } вже призначено { $existing }. Замінити на { $new_action }?
shortcut-replace-title = Замінити сполучення?
type-to-search = Введіть для пошуку…
copy-or-sigint = Копіювати або SIGINT
no-shortcuts = Сполучення не призначено
paste-primary = Вставити основне
shortcut-capture-hint = Натисніть комбінацію клавіш
shortcut-group-clipboard = Буфер обміну
shortcut-group-other = Інше
shortcut-group-zoom = Масштаб
tab-activate = Вибрати вкладку { $number }
toggle-fullscreen = На весь екран
add-another-keybinding = Додати ще сполучення
focus-pane-down = Фокус на нижню панель
focus-pane-left = Фокус на ліву панель
focus-pane-right = Фокус на праву панель
focus-pane-up = Фокус на верхню панель

0
i18n/uz/cosmic_term.ftl Normal file
View file

View file

@ -22,9 +22,9 @@ profiles = 配置文件
name = 名称
command-line = 命令行
tab-title = 标签标题
tab-title-description = 覆盖默认标签标题
add-profile = 创建配置文件
new-profile = 新建配置文件
tab-title-description = 覆盖默认标签标题
add-profile = 添加配置
new-profile = 新建配置
make-default = 设为默认配置
working-directory = 工作目录
hold = 保留
@ -67,10 +67,10 @@ focus-follow-mouse = 聚焦窗口跟随鼠标
advanced = 高级
show-headerbar = 显示标题栏
show-header-description = 右键菜单显示标题栏。
show-header-description = 右键菜单提供显示标题栏选项
# Find
find-placeholder = 查找...
find-previous = 上一个
find-previous = 查找上一个
find-next = 查找下一个
# Menu
@ -79,11 +79,11 @@ find-next = 查找下一个
## File
file = 文件
new-tab = 新建标签
new-tab = 新建标签
new-window = 新建窗口
profile = 配置文件
profile = 配置
menu-profiles = 配置文件...
close-tab = 关闭标签
close-tab = 关闭标签
quit = 退出
## Edit
@ -98,11 +98,11 @@ clear-scrollback = 清除滚动缓冲区
## View
view = 视图
zoom-in = 大字体
zoom-in = 大字体
zoom-reset = 默认字体大小
zoom-out = 缩小字体
next-tab = 下一个标签
previous-tab = 上一个标签
next-tab = 下一个标签
previous-tab = 上一个标签
split-horizontal = 水平分割
split-vertical = 垂直分割
pane-toggle-maximize = 切换最大化
@ -111,3 +111,36 @@ menu-settings = 设置...
menu-about = 关于 COSMIC 终端...
repository = 仓库
support = 支持
open-link = 打开链接
menu-password-manager = 密码…
passwords-title = 密码
add-password = 添加密码
password-input = 密码
password-input-description = 描述
cancel = 取消
close-window = 关闭窗口
disable = 禁用
shortcut-group-window = 窗口
add-another-keybinding = 添加另一个快捷键
keyboard-shortcuts = 键盘快捷键
menu-keyboard-shortcuts = 键盘快捷键…
no-shortcuts = 无快捷键
password-manager = 密码管理器
replace = 替换
reset-to-default = 重置为默认值
shortcut-group-clipboard = 剪切板
shortcut-group-other = 其他
shortcut-group-tabs = 标签
shortcut-group-zoom = 缩放
type-to-search = 输入即可搜索...
copy-or-sigint = 复制或 SIGINT
focus-pane-down = 聚焦下方窗格
focus-pane-left = 聚焦左侧窗格
focus-pane-right = 聚焦右侧窗格
focus-pane-up = 聚焦上方窗格
paste-primary = 粘贴主要
shortcut-capture-hint = 按下组合键
shortcut-replace-body = { $binding } 已分配给 { $existing }。是否将其替换为 { $new_action }
shortcut-replace-title = 是否替换快捷键?
tab-activate = 启用标签 { $number }
toggle-fullscreen = 切换全屏

View file

@ -13,11 +13,11 @@ bin-src := cargo-target-dir / 'release' / name
bin-dst := base-dir / 'bin' / name
desktop := APPID + '.desktop'
desktop-src := 'res' / desktop
desktop-src := 'target/xdgen' / desktop
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / desktop
metainfo := APPID + '.metainfo.xml'
metainfo-src := 'res' / metainfo
metainfo-src := 'target/xdgen' / metainfo
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / metainfo
icons-src := 'res' / 'icons' / 'hicolor'

View file

@ -1,26 +1,6 @@
#TODO: more build-out, desktop actions, translations?
[Desktop Entry]
Name=COSMIC Terminal
Name[ar]=طرفية COSMIC
Name[cs]=Terminál COSMIC
Name[zh_CN]=COSMIC
Name[pl]=Terminal COSMIC
Name[pt_BR]=Terminal
Name[ru]=Терминал
Name[hu]=COSMIC Terminál
Name[pt]=Terminal
Name[sk]=Terminál COSMIC
Name[es]=Terminal COSMIC
Name[it]=Terminale di COSMIC
Name[sv]=COSMIC Terminal
Comment=Terminal emulator for the COSMIC desktop
Comment[ar]=محاكي طرفي لسطح مكتب COSMIC
Comment[cs]=Emulátor terminálu pro pracovní prostředí COSMIC
Comment[sk]=Emulátor terminálu pre pracovné prostredie COSMIC
Comment[ru]=Эмулятор терминала для рабочей среды COSMIC
Comment[hu]=Terminálemulátor a COSMIC asztali környezethez
Comment[it]=Emulatore di terminale di COSMIC
Comment[sv]=Terminalemulator för skribordsmiljön COSMIC
Exec=cosmic-term
Terminal=false
Type=Application
@ -28,14 +8,3 @@ StartupNotify=true
Icon=com.system76.CosmicTerm
Categories=COSMIC;System;TerminalEmulator;
Keywords=Command;Shell;Terminal;CLI;
Keywords[ar]=cli;طرفية;أوامر;صدفة;
Keywords[cs]=Příkaz;Shell;Terminál;Konzole;CLI;
Keywords[pl]=Cli;WierszPoleceń;Powłoka;Terminal;
Keywords[pt_BR]=Comando;Shell;Terminal;
Keywords[hu]=parancssor;terminál;
Keywords[pt]=Comando;Shell;Terminal;Console;
Keywords[sk]=Príkaz;Shell;Terminál;Konzola;
Keywords[ru]=Команда;Оболочка;Терминал;Консоль;
Keywords[es]=Comando;Shell;Terminal;Consola;
Keywords[it]=Comando;Shell;Terminale;Console;
Keywords[sv]=Kommando;Skal;Terminal;CLI;Konsol

View file

@ -9,27 +9,7 @@
<url type="homepage">https://github.com/pop-os/cosmic-term</url>
<url type="bugtracker">https://github.com/pop-os/cosmic-term</url>
<name>COSMIC Terminal</name>
<name xml:lang="ar">طرفية COSMIC</name>
<name xml:lang="cs">Terminál COSMIC</name>
<name xml:lang="pl">Terminal COSMIC</name>
<name xml:lang="hu">COSMIC Terminál</name>
<name xml:lang="pt_BR">Terminal</name>
<name xml:lang="pt">Terminal</name>
<name xml:lang="sk">Terminál COSMIC</name>
<name xml:lang="es">Terminal COSMIC</name>
<name xml:lang="it">Terminale di COSMIC</name>
<name xml:lang="sv">COSMIC Terminal</name>
<summary>Terminal emulator for the COSMIC desktop</summary>
<summary xml:lang="ar">محاكي طرفي لسطح مكتب COSMIC</summary>
<summary xml:lang="cs">Emulátor terminálu pro pracovní prostředí COSMIC</summary>
<summary xml:lang="pl">Emulator terminala dla pulpitu COSMIC</summary>
<summary xml:lang="hu">Terminálemulátor a COSMIC asztali környezethez</summary>
<summary xml:lang="pt_BR">Emulador de terminal do desktop COSMIC</summary>
<summary xml:lang="pt">Emulador de terminal do desktop COSMIC</summary>
<summary xml:lang="sk">Emulátor terminálu pre pracovné prostredie COSMIC</summary>
<summary xml:lang="es">Emulador de terminal de escritorio COSMIC</summary>
<summary xml:lang="it">Emulatore di terminale di COSMIC</summary>
<summary xml:lang="sv">Terminalemulator för skrivbordsmiljön COSMIC</summary>
<description>
<p>Terminal emulator for the COSMIC desktop</p>
<p xml:lang="ar">محاكي طرفي لسطح مكتب COSMIC</p>
@ -43,6 +23,12 @@
<p xml:lang="it">Emulatore di terminale di COSMIC</p>
<p xml:lang="sv">Terminalemulator för skrivbordsmiljön COSMIC</p>
</description>
<keywords>
<keyword>Command</keyword>
<keyword>Shell</keyword>
<keyword>Terminal</keyword>
<keyword>CLI</keyword>
</keywords>
<launchable type="desktop-id">com.system76.CosmicTerm.desktop</launchable>
<icon type="remote" height="256" width="256">
https://raw.githubusercontent.com/pop-os/cosmic-term/master/res/icons/hicolor/256x256/apps/com.system76.CosmicTerm.svg</icon>

View file

@ -0,0 +1,10 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_409_3702)">
<path d="M7 2L2 5L7 8V6H10C11.68 6 13 7.32 13 9C13 10.68 11.68 12 10 12L6 12.004C5.73478 12.004 5.48043 12.1094 5.29289 12.2969C5.10536 12.4844 5 12.7388 5 13.004C5 13.2692 5.10536 13.5236 5.29289 13.7111C5.48043 13.8987 5.73478 14.004 6 14.004L10 14C12.753 13.997 15 11.753 15 9C15 6.247 12.753 4 10 4H7V2Z" fill="#232323"/>
</g>
<defs>
<clipPath id="clip0_409_3702">
<rect width="16" height="16" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 573 B

View file

@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::sync::OnceLock;
use crate::{fl, localize::LANGUAGE_SORTER};
use crate::{fl, localize::LANGUAGE_SORTER, shortcuts::Shortcuts};
pub const CONFIG_VERSION: u64 = 1;
pub const COSMIC_THEME_DARK: &str = "COSMIC Dark";
@ -236,6 +236,8 @@ pub struct Config {
pub syntax_theme_light: String,
pub focus_follow_mouse: bool,
pub default_profile: Option<ProfileId>,
#[serde(default)]
pub shortcuts_custom: Shortcuts,
}
impl Default for Config {
@ -259,6 +261,7 @@ impl Default for Config {
syntax_theme_light: COSMIC_THEME_LIGHT.to_string(),
use_bright_bold: false,
default_profile: None,
shortcuts_custom: Shortcuts::default(),
}
}
}

View file

@ -33,6 +33,7 @@ impl IconCache {
bundle!("dialog-error-symbolic", 16);
bundle!("edit-clear-symbolic", 16);
bundle!("edit-delete-symbolic", 16);
bundle!("edit-undo-symbolic", 16);
bundle!("list-add-symbolic", 16);
bundle!("go-down-symbolic", 16);
bundle!("go-up-symbolic", 16);

View file

@ -1,87 +1,9 @@
use cosmic::widget::menu::key_bind::{KeyBind, Modifier};
use cosmic::{iced::keyboard::Key, iced_core::keyboard::key::Named};
use cosmic::widget::menu::key_bind::KeyBind;
use std::collections::HashMap;
use crate::Action;
use crate::shortcuts::ShortcutsConfig;
//TODO: load from config
pub fn key_binds() -> HashMap<KeyBind, Action> {
let mut key_binds = HashMap::new();
macro_rules! bind {
([$($modifier:ident),* $(,)?], $key:expr, $action:ident) => {{
key_binds.insert(
KeyBind {
modifiers: vec![$(Modifier::$modifier),*],
key: $key,
},
Action::$action,
);
}};
}
// Standard key bindings
bind!([Ctrl, Shift], Key::Character("A".into()), SelectAll);
bind!([Ctrl, Shift], Key::Character("C".into()), Copy);
bind!([], Key::Named(Named::Copy), Copy);
bind!([Ctrl], Key::Character("c".into()), CopyOrSigint);
bind!([Ctrl, Shift], Key::Character("F".into()), Find);
bind!([Ctrl, Shift], Key::Character("N".into()), WindowNew);
bind!([Ctrl, Shift], Key::Character("Q".into()), WindowClose);
bind!([Ctrl, Shift], Key::Character("T".into()), TabNew);
bind!([Ctrl, Shift], Key::Character("V".into()), Paste);
bind!([], Key::Named(Named::Paste), Paste);
bind!([Shift], Key::Named(Named::Insert), PastePrimary);
bind!([Ctrl, Shift], Key::Character("W".into()), TabClose);
bind!([Ctrl], Key::Character(",".into()), Settings);
bind!([], Key::Named(Named::F11), ToggleFullscreen);
// Ctrl+Alt+D splits horizontally, Ctrl+Alt+R splits vertically, Ctrl+Shift+X maximizes split
//TODO: Adjust bindings as desired by UX
bind!([Ctrl, Alt], Key::Character("d".into()), PaneSplitHorizontal);
bind!([Ctrl, Alt], Key::Character("r".into()), PaneSplitVertical);
bind!(
[Ctrl, Shift],
Key::Character("X".into()),
PaneToggleMaximized
);
#[cfg(feature = "password_manager")]
bind!([Ctrl, Alt], Key::Character("p".into()), PasswordManager);
// Ctrl+Tab and Ctrl+Shift+Tab cycle through tabs
// Ctrl+Tab is not a special key for terminals and is free to use
bind!([Ctrl], Key::Named(Named::Tab), TabNext);
bind!([Ctrl, Shift], Key::Named(Named::Tab), TabPrev);
// Ctrl+Shift+# activates tabs by index
bind!([Ctrl, Shift], Key::Character("1".into()), TabActivate0);
bind!([Ctrl, Shift], Key::Character("2".into()), TabActivate1);
bind!([Ctrl, Shift], Key::Character("3".into()), TabActivate2);
bind!([Ctrl, Shift], Key::Character("4".into()), TabActivate3);
bind!([Ctrl, Shift], Key::Character("5".into()), TabActivate4);
bind!([Ctrl, Shift], Key::Character("6".into()), TabActivate5);
bind!([Ctrl, Shift], Key::Character("7".into()), TabActivate6);
bind!([Ctrl, Shift], Key::Character("8".into()), TabActivate7);
bind!([Ctrl, Shift], Key::Character("9".into()), TabActivate8);
// Ctrl+0, Ctrl+-, and Ctrl+= are not special keys for terminals and are free to use
bind!([Ctrl], Key::Character("0".into()), ZoomReset);
bind!([Ctrl], Key::Character("-".into()), ZoomOut);
bind!([Ctrl], Key::Character("=".into()), ZoomIn);
bind!([Ctrl], Key::Character("+".into()), ZoomIn);
// Ctrl+Arrows and Ctrl+HJKL move between splits
bind!([Ctrl, Shift], Key::Named(Named::ArrowLeft), PaneFocusLeft);
bind!([Ctrl, Shift], Key::Character("H".into()), PaneFocusLeft);
bind!([Ctrl, Shift], Key::Named(Named::ArrowDown), PaneFocusDown);
bind!([Ctrl, Shift], Key::Character("J".into()), PaneFocusDown);
bind!([Ctrl, Shift], Key::Named(Named::ArrowUp), PaneFocusUp);
bind!([Ctrl, Shift], Key::Character("K".into()), PaneFocusUp);
bind!([Ctrl, Shift], Key::Named(Named::ArrowRight), PaneFocusRight);
bind!([Ctrl, Shift], Key::Character("L".into()), PaneFocusRight);
// CTRL+Alt+L clears the scrollback.
bind!([Ctrl, Alt], Key::Character("L".into()), ClearScrollback);
key_binds
pub fn key_binds(shortcuts: &ShortcutsConfig) -> HashMap<KeyBind, Action> {
shortcuts.key_binds()
}

View file

@ -4,8 +4,11 @@
use alacritty_terminal::tty::Options;
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::widget::menu::action::MenuAction;
use cosmic::widget::menu::key_bind::KeyBind;
use cosmic::widget::pane_grid::Pane;
use cosmic::widget::segmented_button::ReorderEvent;
use cosmic::{
Application, ApplicationExt, Element, action,
app::{Core, Settings, Task, context_drawer},
@ -29,6 +32,7 @@ use cosmic_text::{Family, Stretch, Weight, fontdb::FaceInfo};
use localize::LANGUAGE_SORTER;
use std::{
any::TypeId,
cell::Cell,
cmp,
collections::{BTreeMap, BTreeSet, HashMap},
env,
@ -53,6 +57,8 @@ mod icon_cache;
use key_bind::key_binds;
mod key_bind;
mod shortcuts;
mod localize;
use menu::menu_bar;
@ -169,6 +175,8 @@ fn main() -> Result<(), Box<dyn Error>> {
}
};
let shortcuts_config = shortcuts::ShortcutsConfig::new(config.shortcuts_custom.clone());
let shell = if let Some(shell_program) = shell_program_opt {
Some(tty::Shell::new(shell_program, shell_args))
} else {
@ -198,6 +206,7 @@ fn main() -> Result<(), Box<dyn Error>> {
let flags = Flags {
config_handler,
config,
shortcuts_config,
startup_options,
term_config,
};
@ -225,6 +234,7 @@ Options:
pub struct Flags {
config_handler: Option<cosmic_config::Config>,
config: Config,
shortcuts_config: shortcuts::ShortcutsConfig,
startup_options: Option<tty::Options>,
term_config: term::Config,
}
@ -238,6 +248,7 @@ pub enum Action {
CopyOrSigint,
CopyPrimary,
Find,
KeyboardShortcuts,
LaunchUrlByMenu,
PaneFocusDown,
PaneFocusLeft,
@ -289,6 +300,7 @@ impl Action {
Self::CopyOrSigint => Message::CopyOrSigint(entity_opt),
Self::CopyPrimary => Message::CopyPrimary(entity_opt),
Self::Find => Message::Find(true),
Self::KeyboardShortcuts => Message::ToggleContextPage(ContextPage::KeyboardShortcuts),
Self::LaunchUrlByMenu => Message::LaunchUrlByMenu,
Self::PaneFocusDown => Message::PaneFocusAdjacent(pane_grid::Direction::Down),
Self::PaneFocusLeft => Message::PaneFocusAdjacent(pane_grid::Direction::Left),
@ -376,6 +388,13 @@ pub enum Message {
LaunchUrl(String),
LaunchUrlByMenu,
Modifiers(Modifiers),
ShortcutCaptureCancel,
ShortcutCaptureStart(shortcuts::KeyBindAction),
ShortcutConflictCancel,
ShortcutConflictReplace,
ShortcutRemove(shortcuts::Binding, shortcuts::BindingSource),
ShortcutReset(shortcuts::KeyBindAction),
ShortcutSearch(String),
MouseEnter(pane_grid::Pane),
Opacity(u8),
PaneClicked(pane_grid::Pane),
@ -402,6 +421,7 @@ pub enum Message {
ProfileRemove(ProfileId),
ProfileSyntaxTheme(ProfileId, ColorSchemeKind, usize),
ProfileTabTitle(ProfileId, String),
ReorderTab(Pane, ReorderEvent),
Surface(surface::Action),
SelectAll(Option<segmented_button::Entity>),
ShowAdvancedFontSettings(bool),
@ -436,12 +456,20 @@ pub enum Message {
pub enum ContextPage {
About,
ColorSchemes(ColorSchemeKind),
KeyboardShortcuts,
Profiles,
Settings,
#[cfg(feature = "password_manager")]
PasswordManager,
}
#[derive(Clone, Debug)]
struct ShortcutConflict {
binding: shortcuts::Binding,
existing_action: shortcuts::KeyBindAction,
new_action: shortcuts::KeyBindAction,
}
/// The [`App`] stores application-specific state.
pub struct App {
core: Core,
@ -449,6 +477,7 @@ pub struct App {
pane_model: TerminalPaneGrid,
config_handler: Option<cosmic_config::Config>,
config: Config,
shortcuts_config: shortcuts::ShortcutsConfig,
key_binds: HashMap<KeyBind, Action>,
app_themes: Vec<String>,
font_names: Vec<String>,
@ -483,6 +512,13 @@ pub struct App {
color_scheme_tab_model: widget::segmented_button::SingleSelectModel,
profile_expanded: Option<ProfileId>,
show_advanced_font_settings: bool,
shortcut_capture: Option<shortcuts::KeyBindAction>,
shortcut_conflict: Option<ShortcutConflict>,
shortcut_conflict_overlay_restore: Option<bool>,
shortcut_search_focus: Cell<bool>,
shortcut_search_id: widget::Id,
shortcut_search_regex: Option<regex::Regex>,
shortcut_search_value: String,
modifiers: Modifiers,
#[cfg(feature = "password_manager")]
password_mgr: password_manager::PasswordManager,
@ -554,6 +590,63 @@ impl App {
}
}
fn save_shortcuts_custom(&mut self) {
self.config.shortcuts_custom = self.shortcuts_config.custom.clone();
match &self.config_handler {
Some(config_handler) => {
if let Err(err) =
config_handler.set("shortcuts_custom", &self.config.shortcuts_custom)
{
log::warn!("failed to save shortcuts custom config: {}", err);
}
}
None => {
log::warn!("failed to save shortcuts custom config: no config handler");
}
}
self.key_binds = key_binds(&self.shortcuts_config);
}
fn apply_shortcut_binding(
&mut self,
binding: shortcuts::Binding,
action: shortcuts::KeyBindAction,
) {
self.shortcuts_config.custom.0.insert(binding, action);
self.save_shortcuts_custom();
}
fn set_context_overlay(&mut self, overlay: bool) {
if self.core.window.context_is_overlay != overlay {
self.core.window.context_is_overlay = overlay;
self.core.set_show_context(self.core.window.show_context);
}
}
fn begin_shortcut_conflict(&mut self, conflict: ShortcutConflict) {
if self.shortcut_conflict.is_none() {
self.shortcut_conflict_overlay_restore = Some(self.core.window.context_is_overlay);
self.set_context_overlay(false);
}
self.shortcut_conflict = Some(conflict);
}
fn clear_shortcut_conflict(&mut self) {
self.shortcut_conflict = None;
if let Some(overlay) = self.shortcut_conflict_overlay_restore.take() {
self.set_context_overlay(overlay);
}
}
fn shortcut_page_toggle(&mut self) {
self.shortcut_capture = None;
self.clear_shortcut_conflict();
self.shortcut_search_focus
.set(self.core.window.show_context);
self.shortcut_search_regex = None;
self.shortcut_search_value.clear();
}
fn update_config(&mut self) -> Task<Message> {
let theme = self.config.app_theme.theme();
@ -649,7 +742,16 @@ impl App {
if self.find {
widget::text_input::focus(self.find_search_id.clone())
} else if self.core.window.show_context {
// TODO focus the context page?
match self.context_page {
ContextPage::KeyboardShortcuts => {
if self.shortcut_search_focus.get() {
self.shortcut_search_focus.set(false);
return widget::text_input::focus(self.shortcut_search_id.clone());
}
}
// TODO focus for other context pages?
_ => {}
}
Task::none()
} else if let Some(terminal_id) = self.terminal_ids.get(&self.pane_model.focused()).cloned()
{
@ -881,6 +983,126 @@ impl App {
widget::settings::view_column(sections).into()
}
fn keyboard_shortcuts(&self) -> Element<'_, Message> {
let cosmic_theme::Spacing {
space_xxs,
space_s,
space_m,
space_l,
space_xl,
..
} = self.core().system_theme().cosmic().spacing;
let pad_action = [space_xxs, space_m];
let div_action = space_s;
let pad_binding = [space_xxs, space_xl];
let div_binding = space_l;
let mut groups = Vec::new();
//TODO: fix text input focus going outside bounds
groups.push(widget::horizontal_space().into());
groups.push(
widget::text_input::search_input(fl!("type-to-search"), &self.shortcut_search_value)
.id(self.shortcut_search_id.clone())
.on_input(Message::ShortcutSearch)
.into(),
);
for group in shortcuts::shortcut_groups() {
let mut list = widget::list::list_column();
let mut found_actions = false;
for action in group.actions {
let action_label = shortcuts::action_label(action);
if let Some(regex) = &self.shortcut_search_regex {
if regex.find(&action_label).is_none() {
continue;
}
}
found_actions = true;
let (bindings, changed) = self.shortcuts_config.bindings_for_action(action);
let mut buttons = widget::row::with_capacity(2);
if changed {
buttons = buttons.push(widget::tooltip(
widget::button::custom(icon_cache_get("edit-undo-symbolic", 16))
.class(style::Button::Icon)
.on_press(Message::ShortcutReset(action)),
widget::text::body(fl!("reset-to-default")),
widget::tooltip::Position::Top,
));
}
buttons = buttons.push(widget::tooltip(
widget::button::custom(icon_cache_get("list-add-symbolic", 16))
.class(style::Button::Icon)
.on_press(Message::ShortcutCaptureStart(action)),
widget::text::body(fl!("add-another-keybinding")),
widget::tooltip::Position::Top,
));
list = list.list_item_padding(pad_action);
list = list.divider_padding(div_action);
list = list.add(widget::settings::item_row(vec![
widget::text::heading(action_label)
.width(Length::Fill)
.into(),
buttons.into(),
]));
if bindings.is_empty() {
list = list.list_item_padding(pad_binding);
list = list.add(widget::text::body(fl!("no-shortcuts")));
list = list.divider_padding(div_binding);
} else {
for resolved in bindings {
list = list.list_item_padding(pad_binding);
list = list.add(
widget::settings::item::builder(shortcuts::binding_display(
&resolved.binding,
))
.control(
widget::button::custom(icon_cache_get("edit-delete-symbolic", 16))
.class(style::Button::Icon)
.on_press(Message::ShortcutRemove(
resolved.binding.clone(),
resolved.source,
)),
),
);
list = list.divider_padding(div_binding);
}
}
if self.shortcut_capture == Some(action) {
list = list.list_item_padding(pad_binding);
list = list.add(
widget::settings::item_row(vec![
widget::text::body(fl!("shortcut-capture-hint"))
.width(Length::Fill)
.into(),
widget::button::text(fl!("cancel"))
.on_press(Message::ShortcutCaptureCancel)
.into(),
])
.spacing(space_xxs),
);
list = list.divider_padding(div_binding);
}
}
if found_actions {
groups.push(
widget::settings::section::with_column(list)
.title(group.title)
.into(),
);
}
}
widget::settings::view_column(groups).into()
}
fn profiles(&self) -> Element<'_, Message> {
let cosmic_theme::Spacing {
space_s,
@ -1551,6 +1773,7 @@ impl Application for App {
.icon(widget::icon::from_name(Self::APP_ID))
.version(env!("CARGO_PKG_VERSION"))
.author("System76")
.comments(fl!("comment"))
.license("GPL-3.0-only")
.license_url("https://spdx.org/licenses/GPL-3.0-only")
.developers([("Jeremy Soller", "jeremy@system76.com")])
@ -1562,13 +1785,15 @@ impl Application for App {
),
]);
let key_binds = key_binds(&flags.shortcuts_config);
let mut app = Self {
core,
about,
pane_model,
config_handler: flags.config_handler,
config: flags.config,
key_binds: key_binds(),
shortcuts_config: flags.shortcuts_config,
key_binds,
app_themes,
font_names,
font_size_names,
@ -1601,6 +1826,13 @@ impl Application for App {
color_scheme_tab_model: widget::segmented_button::Model::default(),
profile_expanded: None,
show_advanced_font_settings: false,
shortcut_capture: None,
shortcut_conflict: None,
shortcut_conflict_overlay_restore: None,
shortcut_search_focus: Cell::new(true),
shortcut_search_id: widget::Id::unique(),
shortcut_search_regex: None,
shortcut_search_value: String::new(),
modifiers: Modifiers::empty(),
#[cfg(feature = "password_manager")]
password_mgr: Default::default(),
@ -1615,12 +1847,20 @@ impl Application for App {
//TODO: currently the first escape unfocuses, and the second calls this function
fn on_escape(&mut self) -> Task<Message> {
if self.core.window.show_context {
// Close context drawer if open
self.core.window.show_context = false;
#[cfg(feature = "password_manager")]
if self.context_page == ContextPage::PasswordManager {
self.password_mgr.clear();
// Handle keyboard shortcut page escape
if let ContextPage::KeyboardShortcuts = self.context_page {
// Cancel shortcut capture
if self.shortcut_capture.take().is_some() {
return Task::none();
}
// Cancel shortcut conflict dialog
if self.shortcut_conflict.take().is_some() {
return Task::none();
}
}
return self.update(Message::ToggleContextPage(self.context_page));
} else if self.find {
// Close find if open
self.find = false;
@ -1882,9 +2122,15 @@ impl Application for App {
}
Message::Config(config) => {
if config != self.config {
let shortcuts_changed = config.shortcuts_custom != self.config.shortcuts_custom;
log::info!("update config");
//TODO: update syntax theme by clearing tabs, only if needed
self.config = config;
if shortcuts_changed {
self.shortcuts_config =
shortcuts::ShortcutsConfig::new(self.config.shortcuts_custom.clone());
self.key_binds = key_binds(&self.shortcuts_config);
}
return self.update_config();
}
}
@ -2126,6 +2372,44 @@ impl Application for App {
config_set!(focus_follow_mouse, focus_follow_mouse);
}
Message::Key(modifiers, key) => {
// Hard-coded keys
match key {
Key::Named(Named::Copy) => {
return self.update(Message::Copy(None));
}
Key::Named(Named::Paste) => {
return self.update(Message::Paste(None));
}
Key::Named(Named::Escape) => {
// Handled by on_escape
return Task::none();
}
_ => {}
}
// Handle shortcut capture
if let Some(action) = self.shortcut_capture {
if let Some(binding) = shortcuts::binding_from_key(modifiers, key) {
self.shortcut_capture = None;
if let Some(existing_action) =
self.shortcuts_config.action_for_binding(&binding)
{
if existing_action != action {
self.begin_shortcut_conflict(ShortcutConflict {
binding,
existing_action,
new_action: action,
});
return Task::none();
}
return Task::none();
}
self.apply_shortcut_binding(binding, action);
}
return Task::none();
}
// Handle configurable keys
for (key_bind, action) in &self.key_binds {
if key_bind.matches(modifiers, &key) {
return self.update(action.message(None));
@ -2161,6 +2445,59 @@ impl Application for App {
self.pane_model.set_focus(pane);
return self.update_focus();
}
Message::ShortcutCaptureCancel => {
self.shortcut_capture = None;
}
Message::ShortcutCaptureStart(action) => {
self.shortcut_capture = Some(action);
}
Message::ShortcutConflictCancel => {
self.clear_shortcut_conflict();
}
Message::ShortcutConflictReplace => {
if let Some(conflict) = self.shortcut_conflict.clone() {
self.apply_shortcut_binding(conflict.binding, conflict.new_action);
}
self.clear_shortcut_conflict();
}
Message::ShortcutRemove(binding, source) => {
match source {
shortcuts::BindingSource::Default => {
self.shortcuts_config
.custom
.0
.insert(binding, shortcuts::KeyBindAction::Disable);
}
shortcuts::BindingSource::Custom => {
self.shortcuts_config.custom.0.remove(&binding);
}
}
self.save_shortcuts_custom();
}
Message::ShortcutReset(reset_action) => {
self.shortcuts_config.reset_action(reset_action);
self.save_shortcuts_custom();
}
Message::ShortcutSearch(search) => {
self.shortcut_search_focus.set(true);
self.shortcut_search_regex = None;
if !search.is_empty() {
let pattern = regex::escape(&search);
match regex::RegexBuilder::new(&pattern)
.case_insensitive(true)
.build()
{
Ok(regex) => {
self.shortcut_search_regex = Some(regex);
}
Err(err) => {
log::warn!("failed to parse regex {:?}: {}", pattern, err);
}
};
}
self.shortcut_search_value = search;
return self.update_focus();
}
Message::Opacity(opacity) => {
config_set!(opacity, cmp::min(100, opacity));
}
@ -2673,6 +3010,19 @@ impl Application for App {
self.core.window.show_context = !self.core.window.show_context;
self.pane_model.update_terminal_focus();
if let ContextPage::KeyboardShortcuts = context_page {
self.shortcut_page_toggle();
}
#[cfg(feature = "password_manager")]
if ContextPage::PasswordManager == context_page {
if self.core.window.show_context {
self.password_mgr.pane = Some(self.pane_model.focused());
return self.password_mgr.refresh_password_list();
} else {
self.password_mgr.clear();
}
}
return self.update_focus();
} else {
self.context_page = context_page;
@ -2705,14 +3055,15 @@ impl Application for App {
});
}
if let ContextPage::KeyboardShortcuts = context_page {
self.shortcut_page_toggle();
return self.update_focus();
}
#[cfg(feature = "password_manager")]
if ContextPage::PasswordManager == context_page {
if self.core.window.show_context {
self.password_mgr.pane = Some(self.pane_model.focused());
return self.password_mgr.refresh_password_list();
} else {
self.password_mgr.clear();
}
self.password_mgr.pane = Some(self.pane_model.focused());
return self.password_mgr.refresh_password_list();
}
}
Message::UpdateDefaultProfile((default, profile_id)) => {
@ -2758,6 +3109,20 @@ impl Application for App {
cosmic::app::Action::Surface(a),
));
}
Message::ReorderTab(
pane,
ReorderEvent {
dragged,
target,
position,
},
) => {
let Some(p) = self.pane_model.panes.get_mut(pane) else {
log::error!("Failed to find reordered tab model.");
return Task::none();
};
_ = p.reorder(dragged, target, position);
}
}
Task::none()
@ -2779,6 +3144,11 @@ impl Application for App {
Message::ToggleContextPage(ContextPage::ColorSchemes(color_scheme_kind)),
)
.title(fl!("color-schemes")),
ContextPage::KeyboardShortcuts => context_drawer::context_drawer(
self.keyboard_shortcuts(),
Message::ToggleContextPage(ContextPage::KeyboardShortcuts),
)
.title(fl!("keyboard-shortcuts")),
ContextPage::Profiles => context_drawer::context_drawer(
self.profiles(),
Message::ToggleContextPage(ContextPage::Profiles),
@ -2798,6 +3168,34 @@ impl Application for App {
})
}
fn dialog(&self) -> Option<Element<'_, Message>> {
let conflict = self.shortcut_conflict.as_ref()?;
let binding = shortcuts::binding_display(&conflict.binding);
let existing = shortcuts::action_label(conflict.existing_action);
let new_action = shortcuts::action_label(conflict.new_action);
let body = fl!(
"shortcut-replace-body",
binding = binding.as_str(),
existing = existing.as_str(),
new_action = new_action.as_str()
);
Some(
widget::dialog()
.title(fl!("shortcut-replace-title"))
.body(body)
.primary_action(
widget::button::suggested(fl!("replace"))
.on_press(Message::ShortcutConflictReplace),
)
.secondary_action(
widget::button::standard(fl!("cancel"))
.on_press(Message::ShortcutConflictCancel),
)
.into(),
)
}
fn header_start(&self) -> Vec<Element<'_, Self::Message>> {
vec![menu_bar(&self.core, &self.config, &self.key_binds)]
}
@ -2830,6 +3228,9 @@ impl Application for App {
tab_column = tab_column.push(
widget::container(
widget::tab_bar::horizontal(tab_model)
.enable_tab_drag(String::from("x-cosmic-term/tab"))
.on_reorder(move |event| Message::ReorderTab(pane, event))
.tab_drag_threshold(25.)
.button_height(32)
.button_spacing(space_xxs)
.on_activate(Message::TabActivate)
@ -2848,7 +3249,7 @@ impl Application for App {
.cloned()
.unwrap_or_else(widget::Id::unique);
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
let mut terminal_box = terminal_box(terminal)
let mut terminal_box = terminal_box(terminal, &self.key_binds)
.id(terminal_id)
.disabled(self.core.window.show_context)
.on_context_menu(move |menu_state| Message::TabContextMenu(pane, menu_state))

View file

@ -204,7 +204,7 @@ pub fn menu_bar<'a>(
responsive_menu_bar()
.item_height(ItemHeight::Dynamic(40))
.item_width(ItemWidth::Uniform(240))
.item_width(ItemWidth::Uniform(320))
.spacing(4.0)
.into_element(
core,
@ -265,6 +265,11 @@ pub fn menu_bar<'a>(
None,
Action::ColorSchemes(config.color_scheme_kind()),
),
MenuItem::Button(
fl!("menu-keyboard-shortcuts"),
None,
Action::KeyboardShortcuts,
),
MenuItem::Button(fl!("menu-settings"), None, Action::Settings),
#[cfg(feature = "password_manager")]
MenuItem::Button(

557
src/shortcuts.rs Normal file
View file

@ -0,0 +1,557 @@
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::widget::menu::key_bind::{KeyBind, Modifier};
use cosmic::{
iced::keyboard::{Key, Modifiers},
iced_core::keyboard::key::Named,
};
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, HashMap};
use crate::{Action, fl};
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub enum ModifierName {
Ctrl,
Shift,
Alt,
Super,
}
impl ModifierName {
fn to_modifier(self) -> Modifier {
match self {
Self::Ctrl => Modifier::Ctrl,
Self::Shift => Modifier::Shift,
Self::Alt => Modifier::Alt,
Self::Super => Modifier::Super,
}
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Binding {
pub modifiers: Vec<ModifierName>,
pub key: String,
}
impl Binding {
fn to_key_bind(&self) -> Option<KeyBind> {
let key = key_from_string(&self.key)?;
let mut modifiers = Vec::new();
for modifier in [
ModifierName::Ctrl,
ModifierName::Shift,
ModifierName::Alt,
ModifierName::Super,
] {
if self.modifiers.contains(&modifier) {
modifiers.push(modifier.to_modifier());
}
}
Some(KeyBind { modifiers, key })
}
}
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub enum KeyBindAction {
Disable,
ClearScrollback,
Copy,
CopyOrSigint,
Find,
PaneFocusDown,
PaneFocusLeft,
PaneFocusRight,
PaneFocusUp,
PaneSplitHorizontal,
PaneSplitVertical,
PaneToggleMaximized,
Paste,
PastePrimary,
#[cfg_attr(not(feature = "password_manager"), allow(dead_code))]
PasswordManager,
SelectAll,
Settings,
TabActivate0,
TabActivate1,
TabActivate2,
TabActivate3,
TabActivate4,
TabActivate5,
TabActivate6,
TabActivate7,
TabActivate8,
TabClose,
TabNew,
TabNext,
TabPrev,
ToggleFullscreen,
WindowClose,
WindowNew,
ZoomIn,
ZoomOut,
ZoomReset,
}
impl KeyBindAction {
fn to_action(self) -> Option<Action> {
match self {
Self::Disable => None,
Self::ClearScrollback => Some(Action::ClearScrollback),
Self::Copy => Some(Action::Copy),
Self::CopyOrSigint => Some(Action::CopyOrSigint),
Self::Find => Some(Action::Find),
Self::PaneFocusDown => Some(Action::PaneFocusDown),
Self::PaneFocusLeft => Some(Action::PaneFocusLeft),
Self::PaneFocusRight => Some(Action::PaneFocusRight),
Self::PaneFocusUp => Some(Action::PaneFocusUp),
Self::PaneSplitHorizontal => Some(Action::PaneSplitHorizontal),
Self::PaneSplitVertical => Some(Action::PaneSplitVertical),
Self::PaneToggleMaximized => Some(Action::PaneToggleMaximized),
Self::Paste => Some(Action::Paste),
Self::PastePrimary => Some(Action::PastePrimary),
Self::SelectAll => Some(Action::SelectAll),
Self::Settings => Some(Action::Settings),
Self::TabActivate0 => Some(Action::TabActivate0),
Self::TabActivate1 => Some(Action::TabActivate1),
Self::TabActivate2 => Some(Action::TabActivate2),
Self::TabActivate3 => Some(Action::TabActivate3),
Self::TabActivate4 => Some(Action::TabActivate4),
Self::TabActivate5 => Some(Action::TabActivate5),
Self::TabActivate6 => Some(Action::TabActivate6),
Self::TabActivate7 => Some(Action::TabActivate7),
Self::TabActivate8 => Some(Action::TabActivate8),
Self::TabClose => Some(Action::TabClose),
Self::TabNew => Some(Action::TabNew),
Self::TabNext => Some(Action::TabNext),
Self::TabPrev => Some(Action::TabPrev),
Self::ToggleFullscreen => Some(Action::ToggleFullscreen),
Self::WindowClose => Some(Action::WindowClose),
Self::WindowNew => Some(Action::WindowNew),
Self::ZoomIn => Some(Action::ZoomIn),
Self::ZoomOut => Some(Action::ZoomOut),
Self::ZoomReset => Some(Action::ZoomReset),
Self::PasswordManager => {
#[cfg(feature = "password_manager")]
{
Some(Action::PasswordManager)
}
#[cfg(not(feature = "password_manager"))]
{
None
}
}
}
}
}
#[derive(Clone, Debug, Default, Deserialize, Eq, PartialEq, Serialize)]
#[serde(transparent)]
pub struct Shortcuts(pub BTreeMap<Binding, KeyBindAction>);
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum BindingSource {
Default,
Custom,
}
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct ResolvedBinding {
pub binding: Binding,
pub source: BindingSource,
}
#[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)]
pub struct ShortcutsConfig {
defaults: Shortcuts,
pub custom: Shortcuts,
}
impl ShortcutsConfig {
pub fn new(custom: Shortcuts) -> Self {
Self {
defaults: fallback_shortcuts(),
custom,
}
}
pub fn key_binds(&self) -> HashMap<KeyBind, Action> {
let mut binds = HashMap::new();
insert_shortcuts(&self.defaults, &mut binds, false);
insert_shortcuts(&self.custom, &mut binds, true);
binds
}
pub fn bindings_for_action(&self, action: KeyBindAction) -> (Vec<ResolvedBinding>, bool) {
let mut bindings = Vec::new();
let mut changed = false;
for (binding, default_action) in &self.defaults.0 {
if *default_action != action {
continue;
}
match self.custom.0.get(binding) {
Some(KeyBindAction::Disable) => {
changed = true;
}
Some(custom_action) => {
if *custom_action == action {
bindings.push(ResolvedBinding {
binding: binding.clone(),
source: BindingSource::Custom,
});
changed = true;
}
}
None => bindings.push(ResolvedBinding {
binding: binding.clone(),
source: BindingSource::Default,
}),
}
}
for (binding, custom_action) in &self.custom.0 {
if *custom_action == action
&& !bindings.iter().any(|resolved| resolved.binding == *binding)
{
bindings.push(ResolvedBinding {
binding: binding.clone(),
source: BindingSource::Custom,
});
changed = true;
}
}
(bindings, changed)
}
pub fn action_for_binding(&self, binding: &Binding) -> Option<KeyBindAction> {
if let Some(action) = self.custom.0.get(binding) {
if *action == KeyBindAction::Disable {
return None;
}
return Some(*action);
}
self.defaults.0.get(binding).copied()
}
pub fn reset_action(&mut self, reset_action: KeyBindAction) {
self.custom.0.retain(|binding, action| {
if *action == reset_action {
// Remove any matching bindings
return false;
}
if let Some(default_action) = self.defaults.0.get(binding) {
if *default_action == reset_action {
// Remove binding that overrode a default
return false;
}
}
true
});
}
}
pub fn action_label(action: KeyBindAction) -> String {
match action {
KeyBindAction::Disable => fl!("disable"),
KeyBindAction::ClearScrollback => fl!("clear-scrollback"),
KeyBindAction::Copy => fl!("copy"),
KeyBindAction::CopyOrSigint => fl!("copy-or-sigint"),
KeyBindAction::Find => fl!("find"),
KeyBindAction::PaneFocusDown => fl!("focus-pane-down"),
KeyBindAction::PaneFocusLeft => fl!("focus-pane-left"),
KeyBindAction::PaneFocusRight => fl!("focus-pane-right"),
KeyBindAction::PaneFocusUp => fl!("focus-pane-up"),
KeyBindAction::PaneSplitHorizontal => fl!("split-horizontal"),
KeyBindAction::PaneSplitVertical => fl!("split-vertical"),
KeyBindAction::PaneToggleMaximized => fl!("pane-toggle-maximize"),
KeyBindAction::Paste => fl!("paste"),
KeyBindAction::PastePrimary => fl!("paste-primary"),
KeyBindAction::PasswordManager => fl!("password-manager"),
KeyBindAction::SelectAll => fl!("select-all"),
KeyBindAction::Settings => fl!("settings"),
KeyBindAction::TabActivate0 => fl!("tab-activate", number = 1),
KeyBindAction::TabActivate1 => fl!("tab-activate", number = 2),
KeyBindAction::TabActivate2 => fl!("tab-activate", number = 3),
KeyBindAction::TabActivate3 => fl!("tab-activate", number = 4),
KeyBindAction::TabActivate4 => fl!("tab-activate", number = 5),
KeyBindAction::TabActivate5 => fl!("tab-activate", number = 6),
KeyBindAction::TabActivate6 => fl!("tab-activate", number = 7),
KeyBindAction::TabActivate7 => fl!("tab-activate", number = 8),
KeyBindAction::TabActivate8 => fl!("tab-activate", number = 9),
KeyBindAction::TabClose => fl!("close-tab"),
KeyBindAction::TabNew => fl!("new-tab"),
KeyBindAction::TabNext => fl!("next-tab"),
KeyBindAction::TabPrev => fl!("previous-tab"),
KeyBindAction::ToggleFullscreen => fl!("toggle-fullscreen"),
KeyBindAction::WindowClose => fl!("close-window"),
KeyBindAction::WindowNew => fl!("new-window"),
KeyBindAction::ZoomIn => fl!("zoom-in"),
KeyBindAction::ZoomOut => fl!("zoom-out"),
KeyBindAction::ZoomReset => fl!("zoom-reset"),
}
}
pub struct ShortcutGroup {
pub title: String,
pub actions: Vec<KeyBindAction>,
}
pub fn shortcut_groups() -> Vec<ShortcutGroup> {
let mut groups = Vec::new();
groups.push(ShortcutGroup {
title: fl!("shortcut-group-clipboard"),
actions: vec![
KeyBindAction::SelectAll,
KeyBindAction::Copy,
KeyBindAction::CopyOrSigint,
KeyBindAction::Paste,
KeyBindAction::PastePrimary,
KeyBindAction::Find,
],
});
groups.push(ShortcutGroup {
title: fl!("shortcut-group-tabs"),
actions: vec![
KeyBindAction::TabNew,
KeyBindAction::TabClose,
KeyBindAction::TabNext,
KeyBindAction::TabPrev,
KeyBindAction::TabActivate0,
KeyBindAction::TabActivate1,
KeyBindAction::TabActivate2,
KeyBindAction::TabActivate3,
KeyBindAction::TabActivate4,
KeyBindAction::TabActivate5,
KeyBindAction::TabActivate6,
KeyBindAction::TabActivate7,
KeyBindAction::TabActivate8,
],
});
groups.push(ShortcutGroup {
title: fl!("splits"),
actions: vec![
KeyBindAction::PaneSplitHorizontal,
KeyBindAction::PaneSplitVertical,
KeyBindAction::PaneToggleMaximized,
KeyBindAction::PaneFocusLeft,
KeyBindAction::PaneFocusRight,
KeyBindAction::PaneFocusUp,
KeyBindAction::PaneFocusDown,
],
});
groups.push(ShortcutGroup {
title: fl!("shortcut-group-window"),
actions: vec![
KeyBindAction::WindowNew,
KeyBindAction::WindowClose,
KeyBindAction::ToggleFullscreen,
KeyBindAction::Settings,
],
});
groups.push(ShortcutGroup {
title: fl!("shortcut-group-zoom"),
actions: vec![
KeyBindAction::ZoomIn,
KeyBindAction::ZoomOut,
KeyBindAction::ZoomReset,
],
});
let mut other_actions = vec![KeyBindAction::ClearScrollback];
#[cfg(feature = "password_manager")]
other_actions.push(KeyBindAction::PasswordManager);
groups.push(ShortcutGroup {
title: fl!("shortcut-group-other"),
actions: other_actions,
});
groups
}
pub fn binding_display(binding: &Binding) -> String {
binding
.to_key_bind()
.map(|key_bind| key_bind.to_string())
.unwrap_or_else(|| binding.key.clone())
}
pub fn binding_from_key(modifiers: Modifiers, key: Key) -> Option<Binding> {
if is_modifier_only_key(&key) {
return None;
}
let key = key_to_string(&key)?;
let mut binding_modifiers = Vec::new();
if modifiers.control() {
binding_modifiers.push(ModifierName::Ctrl);
}
if modifiers.shift() {
binding_modifiers.push(ModifierName::Shift);
}
if modifiers.alt() {
binding_modifiers.push(ModifierName::Alt);
}
if modifiers.logo() {
binding_modifiers.push(ModifierName::Super);
}
Some(Binding {
modifiers: binding_modifiers,
key,
})
}
fn insert_shortcuts(
shortcuts: &Shortcuts,
binds: &mut HashMap<KeyBind, Action>,
allow_disable: bool,
) {
for (binding, action) in &shortcuts.0 {
let key_bind = match binding.to_key_bind() {
Some(key_bind) => key_bind,
None => {
log::warn!("invalid key binding: {:?}", binding);
continue;
}
};
if allow_disable && *action == KeyBindAction::Disable {
binds.remove(&key_bind);
continue;
}
let Some(action) = action.to_action() else {
log::warn!("unsupported shortcut action: {:?}", action);
continue;
};
binds.insert(key_bind, action);
}
}
fn fallback_shortcuts() -> Shortcuts {
let mut shortcuts = BTreeMap::new();
macro_rules! bind {
([$($modifier:ident),* $(,)?], $key:expr, $action:ident) => {{
shortcuts.insert(
Binding {
modifiers: vec![$(ModifierName::$modifier),*],
key: $key.to_string(),
},
KeyBindAction::$action,
);
}};
}
// Standard key bindings
bind!([Ctrl, Shift], "A", SelectAll);
bind!([Ctrl, Shift], "C", Copy);
bind!([Ctrl], "c", CopyOrSigint);
bind!([Ctrl, Shift], "F", Find);
bind!([Ctrl, Shift], "N", WindowNew);
bind!([Ctrl, Shift], "Q", WindowClose);
bind!([Ctrl, Shift], "T", TabNew);
bind!([Ctrl, Shift], "V", Paste);
bind!([Shift], "Insert", PastePrimary);
bind!([Ctrl, Shift], "W", TabClose);
bind!([Ctrl], ",", Settings);
bind!([], "F11", ToggleFullscreen);
// Ctrl+Alt+D splits horizontally, Ctrl+Alt+R splits vertically, Ctrl+Shift+X maximizes split
//TODO: Adjust bindings as desired by UX
bind!([Ctrl, Alt], "d", PaneSplitHorizontal);
bind!([Ctrl, Alt], "r", PaneSplitVertical);
bind!([Ctrl, Shift], "X", PaneToggleMaximized);
#[cfg(feature = "password_manager")]
bind!([Ctrl, Alt], "p", PasswordManager);
// Ctrl+Tab and Ctrl+Shift+Tab cycle through tabs
// Ctrl+Tab is not a special key for terminals and is free to use
bind!([Ctrl], "Tab", TabNext);
bind!([Ctrl, Shift], "Tab", TabPrev);
// Ctrl+Shift+# activates tabs by index
bind!([Ctrl, Shift], "1", TabActivate0);
bind!([Ctrl, Shift], "2", TabActivate1);
bind!([Ctrl, Shift], "3", TabActivate2);
bind!([Ctrl, Shift], "4", TabActivate3);
bind!([Ctrl, Shift], "5", TabActivate4);
bind!([Ctrl, Shift], "6", TabActivate5);
bind!([Ctrl, Shift], "7", TabActivate6);
bind!([Ctrl, Shift], "8", TabActivate7);
bind!([Ctrl, Shift], "9", TabActivate8);
// Ctrl+0, Ctrl+-, and Ctrl+= are not special keys for terminals and are free to use
bind!([Ctrl], "0", ZoomReset);
bind!([Ctrl], "-", ZoomOut);
bind!([Ctrl], "=", ZoomIn);
bind!([Ctrl], "+", ZoomIn);
// Ctrl+Arrows and Ctrl+HJKL move between splits
bind!([Ctrl, Shift], "ArrowLeft", PaneFocusLeft);
bind!([Ctrl, Shift], "H", PaneFocusLeft);
bind!([Ctrl, Shift], "ArrowDown", PaneFocusDown);
bind!([Ctrl, Shift], "J", PaneFocusDown);
bind!([Ctrl, Shift], "ArrowUp", PaneFocusUp);
bind!([Ctrl, Shift], "K", PaneFocusUp);
bind!([Ctrl, Shift], "ArrowRight", PaneFocusRight);
bind!([Ctrl, Shift], "L", PaneFocusRight);
// CTRL+Alt+L clears the scrollback.
bind!([Ctrl, Alt], "L", ClearScrollback);
Shortcuts(shortcuts)
}
fn key_from_string(value: &str) -> Option<Key> {
match value {
"Insert" => Some(Key::Named(Named::Insert)),
"Tab" => Some(Key::Named(Named::Tab)),
"F11" => Some(Key::Named(Named::F11)),
"ArrowLeft" | "Left" => Some(Key::Named(Named::ArrowLeft)),
"ArrowRight" | "Right" => Some(Key::Named(Named::ArrowRight)),
"ArrowUp" | "Up" => Some(Key::Named(Named::ArrowUp)),
"ArrowDown" | "Down" => Some(Key::Named(Named::ArrowDown)),
"Space" | "space" => Some(Key::Character(" ".into())),
_ if !value.is_empty() => Some(Key::Character(value.into())),
_ => None,
}
}
fn key_to_string(key: &Key) -> Option<String> {
match key {
Key::Character(c) => {
if c == " " {
Some("Space".to_string())
} else if c.len() == 1 && c.chars().all(|ch| ch.is_ascii_alphabetic()) {
Some(c.to_uppercase())
} else {
Some(c.to_string())
}
}
Key::Named(named) => Some(format!("{named:?}")),
_ => None,
}
}
fn is_modifier_only_key(key: &Key) -> bool {
matches!(
key,
Key::Named(
Named::Alt
| Named::AltGraph
| Named::CapsLock
| Named::Control
| Named::Fn
| Named::FnLock
| Named::NumLock
| Named::ScrollLock
| Named::Shift
| Named::Symbol
| Named::SymbolLock
| Named::Meta
| Named::Hyper
| Named::Super
)
)
}

View file

@ -246,6 +246,7 @@ pub struct Terminal {
pub url_regex_search: RegexSearch,
pub regex_matches: Vec<alacritty_terminal::term::search::Match>,
pub active_regex_match: Option<alacritty_terminal::term::search::Match>,
pub active_hyperlink_id: Option<String>,
bold_font_weight: Weight,
buffer: Arc<Buffer>,
is_focused: bool,
@ -335,6 +336,7 @@ impl Terminal {
Ok(Self {
active_regex_match: None,
active_hyperlink_id: None,
url_regex_search: url_regex_search(),
regex_matches: Vec::new(),
bold_font_weight: Weight(bold_font_weight),
@ -887,6 +889,28 @@ impl Terminal {
flags |= Flags::UNDERLINE;
}
}
if let Some(active_id) = &self.active_hyperlink_id {
let mut matches_active = indexed
.cell
.hyperlink()
.is_some_and(|link| link.id() == active_id);
if !matches_active
&& indexed.cell.flags.intersects(
Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER,
)
&& indexed.point.column.0 > 0
{
matches_active = grid[Point::new(
indexed.point.line,
Column(indexed.point.column.0 - 1),
)]
.hyperlink()
.is_some_and(|link| link.id() == active_id);
}
if matches_active {
flags |= Flags::UNDERLINE;
}
}
let metadata = Metadata::new(bg, fg)
.with_flags(flags)

View file

@ -46,8 +46,8 @@ use std::{
};
use crate::{
Action, Terminal, TerminalScroll, key_bind::key_binds, menu::MenuState,
mouse_reporter::MouseReporter, terminal::Metadata,
Action, Terminal, TerminalScroll, menu::MenuState, mouse_reporter::MouseReporter,
terminal::Metadata,
};
const AUTOSCROLL_INTERVAL: Duration = Duration::from_millis(100);
@ -122,7 +122,7 @@ pub struct TerminalBox<'a, Message> {
on_open_hyperlink: Option<Box<dyn Fn(String) -> Message + 'a>>,
on_window_focused: Option<Box<dyn Fn() -> Message + 'a>>,
on_window_unfocused: Option<Box<dyn Fn() -> Message + 'a>>,
key_binds: HashMap<KeyBind, Action>,
key_binds: &'a HashMap<KeyBind, Action>,
sharp_corners: bool,
disabled: bool,
}
@ -131,7 +131,7 @@ impl<'a, Message> TerminalBox<'a, Message>
where
Message: Clone,
{
pub fn new(terminal: &'a Mutex<Terminal>) -> Self {
pub fn new(terminal: &'a Mutex<Terminal>, key_binds: &'a HashMap<KeyBind, Action>) -> Self {
Self {
terminal,
id: None,
@ -145,7 +145,7 @@ where
opacity: None,
mouse_inside_boundary: None,
on_middle_click: None,
key_binds: key_binds(),
key_binds,
on_open_hyperlink: None,
on_window_focused: None,
on_window_unfocused: None,
@ -236,11 +236,14 @@ where
}
}
pub fn terminal_box<Message>(terminal: &Mutex<Terminal>) -> TerminalBox<'_, Message>
pub fn terminal_box<'a, Message>(
terminal: &'a Mutex<Terminal>,
key_binds: &'a HashMap<KeyBind, Action>,
) -> TerminalBox<'a, Message>
where
Message: Clone,
{
TerminalBox::new(terminal)
TerminalBox::new(terminal, key_binds)
}
impl<'a, Message> Widget<Message, cosmic::Theme, Renderer> for TerminalBox<'a, Message>
@ -336,11 +339,7 @@ where
let location = terminal
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
if terminal
.regex_matches
.iter()
.any(|bounds| bounds.contains(&location))
{
if get_hyperlink(&terminal, location).is_some() {
return mouse::Interaction::Pointer;
}
}
@ -724,66 +723,75 @@ where
state.scrollbar_rect.set(Rectangle::default())
}
// Draw cursor
// Draw cursor (only when not scrolled, as cursor is at bottom of active area)
{
let cursor = terminal.term.lock().renderable_content().cursor;
let col = cursor.point.column.0;
let line = cursor.point.line.0;
let color = terminal.term.lock().colors()[NamedColor::Cursor]
.or(terminal.colors()[NamedColor::Cursor])
.map(|rgb| Color::from_rgb8(rgb.r, rgb.g, rgb.b))
.unwrap_or(Color::WHITE); // TODO default color from theme?
let width = terminal.size().cell_width;
let height = terminal.size().cell_height;
let top_left = view_position
+ Vector::new((col as f32 * width).floor(), (line as f32 * height).floor());
match cursor.shape {
CursorShape::Beam => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(1.0, height)),
..Default::default()
};
renderer.fill_quad(quad, color);
}
CursorShape::Underline => {
let quad = Quad {
bounds: Rectangle::new(
view_position
+ Vector::new(
(col as f32 * width).floor(),
((line + 1) as f32 * height).floor(),
),
Size::new(width, 1.0),
),
..Default::default()
};
renderer.fill_quad(quad, color);
}
CursorShape::Block if !state.is_focused => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(width, height)),
border: Border {
width: 1.0,
color,
let term = terminal.term.lock();
let display_offset = term.grid().display_offset();
let cursor = term.renderable_content().cursor;
drop(term);
// Skip drawing cursor when scrolled - the cursor is below the visible viewport
if display_offset > 0 {
// Cursor is off-screen when scrolled up
} else {
let col = cursor.point.column.0;
let line = cursor.point.line.0;
let color = terminal.term.lock().colors()[NamedColor::Cursor]
.or(terminal.colors()[NamedColor::Cursor])
.map(|rgb| Color::from_rgb8(rgb.r, rgb.g, rgb.b))
.unwrap_or(Color::WHITE); // TODO default color from theme?
let width = terminal.size().cell_width;
let height = terminal.size().cell_height;
let top_left = view_position
+ Vector::new((col as f32 * width).floor(), (line as f32 * height).floor());
match cursor.shape {
CursorShape::Beam => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(1.0, height)),
..Default::default()
},
..Default::default()
};
renderer.fill_quad(quad, Color::TRANSPARENT);
}
CursorShape::HollowBlock => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(width, height)),
border: Border {
width: 1.0,
color,
};
renderer.fill_quad(quad, color);
}
CursorShape::Underline => {
let quad = Quad {
bounds: Rectangle::new(
view_position
+ Vector::new(
(col as f32 * width).floor(),
((line + 1) as f32 * height).floor(),
),
Size::new(width, 1.0),
),
..Default::default()
},
..Default::default()
};
renderer.fill_quad(quad, Color::TRANSPARENT);
};
renderer.fill_quad(quad, color);
}
CursorShape::Block if !state.is_focused => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(width, height)),
border: Border {
width: 1.0,
color,
..Default::default()
},
..Default::default()
};
renderer.fill_quad(quad, Color::TRANSPARENT);
}
CursorShape::HollowBlock => {
let quad = Quad {
bounds: Rectangle::new(top_left, Size::new(width, height)),
border: Border {
width: 1.0,
color,
..Default::default()
},
..Default::default()
};
renderer.fill_quad(quad, Color::TRANSPARENT);
}
CursorShape::Block | CursorShape::Hidden => {} // Block is handled seperately
}
CursorShape::Block | CursorShape::Hidden => {} // Block is handled seperately
}
}
@ -1002,12 +1010,15 @@ where
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
state.modifiers = modifiers;
if modifiers.contains(Modifiers::CTRL) || terminal.active_regex_match.is_some() {
if modifiers.contains(Modifiers::CTRL)
|| terminal.active_regex_match.is_some()
|| terminal.active_hyperlink_id.is_some()
{
//Might need to update the url regex highlight,
//so we need to calculate the mouse position
let location = if let Some(p) = cursor_position.position() {
let x = (p.x - layout.bounds().x) - self.padding.left;
let y = (p.y - layout.bounds().y) - self.padding.top;
let location = if let Some(p) = cursor_position.position_in(layout.bounds()) {
let x = p.x - self.padding.left;
let y = p.y - self.padding.top;
//TODO: better calculation of position
let col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
@ -1145,18 +1156,30 @@ where
} else {
TermSide::Right
};
let selection = match click_kind {
ClickKind::Single => {
Selection::new(SelectionType::Simple, location, side)
// Check if shift is pressed and there's an existing selection to extend
if state.modifiers.shift() {
let mut term = terminal.term.lock();
if let Some(ref mut selection) = term.selection {
selection.update(location, side);
} else {
term.selection = Some(Selection::new(
SelectionType::Simple,
location,
side,
));
}
ClickKind::Double => {
Selection::new(SelectionType::Semantic, location, side)
}
ClickKind::Triple => {
Selection::new(SelectionType::Lines, location, side)
}
};
{
} else {
let selection = match click_kind {
ClickKind::Single => {
Selection::new(SelectionType::Simple, location, side)
}
ClickKind::Double => {
Selection::new(SelectionType::Semantic, location, side)
}
ClickKind::Triple => {
Selection::new(SelectionType::Lines, location, side)
}
};
let mut term = terminal.term.lock();
term.selection = Some(selection);
}
@ -1304,29 +1327,38 @@ where
self.mouse_inside_boundary = Some(mouse_is_inside);
}
}
if let Some(p) = cursor_position.position() {
if let Some(p_global) = cursor_position.position() {
let bounds = layout.bounds();
let x = (p.x - bounds.x) - self.padding.left;
let y = (p.y - bounds.y) - self.padding.top;
//TODO: better calculation of position
let col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
let location = terminal
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
update_active_regex_match(
&mut terminal,
Some(location),
Some(&state.modifiers),
);
let col_row_opt = if let Some(p) = cursor_position.position_in(bounds) {
let x = p.x - self.padding.left;
let y = p.y - self.padding.top;
//TODO: better calculation of position
let col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
let location = terminal.viewport_to_point(TermPoint::new(
row as usize,
TermColumn(col as usize),
));
update_active_regex_match(
&mut terminal,
Some(location),
Some(&state.modifiers),
);
Some((col, row))
} else {
None
};
if is_mouse_mode {
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
if let Some((col, row)) = col_row_opt {
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
}
} else {
let handled_buffer_drag = update_buffer_drag(
state,
&mut terminal,
buffer_size,
p,
p_global,
bounds,
self.padding,
0.0,
@ -1338,6 +1370,7 @@ where
start_scroll,
}) = state.dragging.as_mut()
{
let y = p_global.y - bounds.y - self.padding.top;
let start_y = *start_y;
let start_scroll = *start_scroll;
let scroll_offset = terminal.with_buffer(|buffer| {
@ -1352,9 +1385,9 @@ where
state.autoscroll.stop();
} else {
if state.autoscroll.is_active() {
state.autoscroll.update_pointer(p);
state.autoscroll.update_pointer(p_global);
} else {
state.autoscroll.start(p);
state.autoscroll.start(p_global);
}
shell.request_redraw(RedrawRequest::NextFrame);
}
@ -1367,8 +1400,8 @@ where
Event::Mouse(MouseEvent::WheelScrolled { delta }) => {
if let Some(p) = cursor_position.position_in(layout.bounds()) {
if is_mouse_mode {
let x = (p.x - layout.bounds().x) - self.padding.left;
let y = (p.y - layout.bounds().y) - self.padding.top;
let x = p.x - self.padding.left;
let y = p.y - self.padding.top;
//TODO: better calculation of position
let col = x / terminal.size().cell_width;
let row = y / terminal.size().cell_height;
@ -1442,6 +1475,9 @@ fn get_hyperlink(
terminal: &std::sync::MutexGuard<'_, Terminal>,
location: TermPoint,
) -> Option<String> {
if let Some(link) = osc8_hyperlink_at(terminal, location) {
return Some(link.uri().to_string());
}
if let Some(match_) = terminal
.regex_matches
.iter()
@ -1454,6 +1490,37 @@ fn get_hyperlink(
}
}
fn get_hyperlink_id(
terminal: &std::sync::MutexGuard<'_, Terminal>,
location: TermPoint,
) -> Option<String> {
osc8_hyperlink_at(terminal, location).map(|link| link.id().to_string())
}
fn osc8_hyperlink_at(
terminal: &std::sync::MutexGuard<'_, Terminal>,
location: TermPoint,
) -> Option<alacritty_terminal::term::cell::Hyperlink> {
let term = terminal.term.lock();
if location.line >= term.screen_lines() || location.column.0 >= term.columns() {
return None;
}
let grid = term.grid();
let cell = &grid[location];
if let Some(link) = cell.hyperlink() {
return Some(link);
}
if cell
.flags
.intersects(Flags::WIDE_CHAR_SPACER | Flags::LEADING_WIDE_CHAR_SPACER)
&& location.column.0 > 0
{
let left = TermPoint::new(location.line, TermColumn(location.column.0 - 1));
return grid[left].hyperlink();
}
None
}
fn update_active_regex_match(
terminal: &mut std::sync::MutexGuard<'_, Terminal>,
location: Option<TermPoint>,
@ -1466,6 +1533,9 @@ fn update_active_regex_match(
return;
}
let allow_hyperlink = modifiers
.map(|mods| mods.contains(Modifiers::CTRL))
.unwrap_or(false);
//Require CTRL for keyboard and mouse interaction
if let Some(modifiers) = modifiers {
if !modifiers.contains(Modifiers::CTRL) {
@ -1473,16 +1543,37 @@ fn update_active_regex_match(
terminal.active_regex_match = None;
terminal.needs_update = true;
}
if terminal.active_hyperlink_id.is_some() {
terminal.active_hyperlink_id = None;
terminal.needs_update = true;
}
return;
}
} else if terminal.active_hyperlink_id.is_some() {
terminal.active_hyperlink_id = None;
terminal.needs_update = true;
}
let Some(location) = location else {
if terminal.active_regex_match.is_some() {
terminal.active_regex_match = None;
terminal.needs_update = true;
}
if terminal.active_hyperlink_id.is_some() {
terminal.active_hyperlink_id = None;
terminal.needs_update = true;
}
return;
};
if allow_hyperlink {
let next_hyperlink_id = get_hyperlink_id(terminal, location);
if terminal.active_hyperlink_id != next_hyperlink_id {
terminal.active_hyperlink_id = next_hyperlink_id;
terminal.needs_update = true;
}
} else if terminal.active_hyperlink_id.is_some() {
terminal.active_hyperlink_id = None;
terminal.needs_update = true;
}
if let Some(match_) = terminal
.regex_matches
.iter()