Merge branch 'master' into new-tab-current-dir-with-config
This commit is contained in:
commit
f3af51df61
22 changed files with 2532 additions and 2208 deletions
40
.github/workflows/rust-checks.yml
vendored
40
.github/workflows/rust-checks.yml
vendored
|
|
@ -24,3 +24,43 @@ jobs:
|
||||||
|
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: cargo fmt --all -- --check
|
run: cargo fmt --all -- --check
|
||||||
|
|
||||||
|
clippy:
|
||||||
|
name: Clippy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y pkg-config libxkbcommon-dev libfontconfig1-dev libfreetype6-dev libglvnd-dev libinput-dev libvulkan-dev libwayland-dev libx11-dev libxcursor-dev libxi-dev libxrandr-dev libasound2-dev libdbus-1-dev
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: clippy
|
||||||
|
|
||||||
|
- name: Run Clippy
|
||||||
|
run: cargo clippy --all-targets --all-features -- -D warnings
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install system dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y pkg-config libxkbcommon-dev libfontconfig1-dev libfreetype6-dev libglvnd-dev libinput-dev libvulkan-dev libwayland-dev libx11-dev libxcursor-dev libxi-dev libxrandr-dev libasound2-dev libdbus-1-dev
|
||||||
|
|
||||||
|
- name: Install Rust
|
||||||
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
with:
|
||||||
|
components: clippy
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
run: cargo test --all-targets --all-features
|
||||||
|
|
|
||||||
3321
Cargo.lock
generated
3321
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
14
Cargo.toml
14
Cargo.toml
|
|
@ -1,10 +1,10 @@
|
||||||
[package]
|
[package]
|
||||||
name = "cosmic-term"
|
name = "cosmic-term"
|
||||||
version = "1.0.8"
|
version = "1.0.11"
|
||||||
authors = ["Jeremy Soller <jeremy@system76.com>"]
|
authors = ["Jeremy Soller <jeremy@system76.com>"]
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
license = "GPL-3.0-only"
|
license = "GPL-3.0-only"
|
||||||
rust-version = "1.85"
|
rust-version = "1.90"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
alacritty_terminal = "0.25.1"
|
alacritty_terminal = "0.25.1"
|
||||||
|
|
@ -47,7 +47,7 @@ features = ["monospace_fallback", "shape-run-cache"]
|
||||||
git = "https://github.com/pop-os/libcosmic.git"
|
git = "https://github.com/pop-os/libcosmic.git"
|
||||||
default-features = false
|
default-features = false
|
||||||
#TODO: a11y feature crashes file chooser dialog
|
#TODO: a11y feature crashes file chooser dialog
|
||||||
features = ["about", "multi-window", "tokio", "winit", "surface-message"]
|
features = ["about", "autosize", "multi-window", "tokio", "winit", "surface-message"]
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
fork = "0.4"
|
fork = "0.4"
|
||||||
|
|
@ -67,7 +67,7 @@ inherits = "release"
|
||||||
debug = true
|
debug = true
|
||||||
|
|
||||||
|
|
||||||
# [patch.'https://github.com/pop-os/libcosmic']
|
#[patch.'https://github.com/pop-os/libcosmic']
|
||||||
# libcosmic = { path = "../libcosmic" }
|
#libcosmic = { path = "../libcosmic" }
|
||||||
# cosmic-config = { path = "../libcosmic/cosmic-config" }
|
#cosmic-config = { path = "../libcosmic/cosmic-config" }
|
||||||
# cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
#cosmic-theme = { path = "../libcosmic/cosmic-theme" }
|
||||||
|
|
|
||||||
12
debian/changelog
vendored
12
debian/changelog
vendored
|
|
@ -1,3 +1,15 @@
|
||||||
|
cosmic-term (1.0.11) noble; urgency=medium
|
||||||
|
|
||||||
|
* Epoch 1.0.11 version update
|
||||||
|
|
||||||
|
-- Jeremy Soller <jeremy@system76.com> Tue, 14 Apr 2026 11:11:05 -0600
|
||||||
|
|
||||||
|
cosmic-term (1.0.9) noble; urgency=medium
|
||||||
|
|
||||||
|
* Epoch 1.0.9 version update
|
||||||
|
|
||||||
|
-- Jeremy Soller <jeremy@system76.com> Mon, 06 Apr 2026 15:10:35 -0600
|
||||||
|
|
||||||
cosmic-term (1.0.8) noble; urgency=medium
|
cosmic-term (1.0.8) noble; urgency=medium
|
||||||
|
|
||||||
* Epoch 1.0.8 version update
|
* Epoch 1.0.8 version update
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ tab-title-description = تجاوز عنوان اللسان المبدئي
|
||||||
add-profile = أضف ملف تعريف
|
add-profile = أضف ملف تعريف
|
||||||
new-profile = ملف تعريف جديد
|
new-profile = ملف تعريف جديد
|
||||||
make-default = اجعله المبدئي
|
make-default = اجعله المبدئي
|
||||||
working-directory = مجلد العمل
|
working-directory = المجلَّد الحالي
|
||||||
hold = التعليق
|
hold = التعليق
|
||||||
remain-open = البقاء مفتوحًا بعد خروج العملية الفرعية.
|
remain-open = البقاء مفتوحًا بعد خروج العملية الفرعية.
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ shortcut-group-clipboard = الحافظة
|
||||||
shortcut-group-other = أخرى
|
shortcut-group-other = أخرى
|
||||||
shortcut-group-tabs = ألسنة
|
shortcut-group-tabs = ألسنة
|
||||||
shortcut-group-window = نافذة
|
shortcut-group-window = نافذة
|
||||||
shortcut-group-zoom = كبِّر
|
shortcut-group-zoom = تكبير
|
||||||
shortcut-replace-body = عُيِّن { $binding } بالفعل لـ { $existing }. أتريد استبداله بـ { $new_action }؟
|
shortcut-replace-body = عُيِّن { $binding } بالفعل لـ { $existing }. أتريد استبداله بـ { $new_action }؟
|
||||||
shortcut-replace-title = استبدل الاختصار؟
|
shortcut-replace-title = استبدل الاختصار؟
|
||||||
tab-activate = نشّط لسان { $number }
|
tab-activate = نشّط لسان { $number }
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ default-font-stretch = Šířka písma
|
||||||
default-font-weight = Normální tloušťka písma
|
default-font-weight = Normální tloušťka písma
|
||||||
default-dim-font-weight = Tenká tloušťka písma
|
default-dim-font-weight = Tenká tloušťka písma
|
||||||
default-bold-font-weight = Tučná tloušťka písma
|
default-bold-font-weight = Tučná tloušťka písma
|
||||||
use-bright-bold = Zvýraznit tučný text
|
use-bright-bold = Světlejší tučný text
|
||||||
splits = Rozdělení
|
splits = Rozdělení
|
||||||
focus-follow-mouse = Zaměření psaní sleduje myš
|
focus-follow-mouse = Zaměření psaní sleduje myš
|
||||||
advanced = Pokročilé
|
advanced = Pokročilé
|
||||||
|
|
@ -86,7 +86,7 @@ disable = Zakázat
|
||||||
keyboard-shortcuts = Klávesové zkratky
|
keyboard-shortcuts = Klávesové zkratky
|
||||||
menu-keyboard-shortcuts = Klávesové zkratky...
|
menu-keyboard-shortcuts = Klávesové zkratky...
|
||||||
no-shortcuts = Žádné zkratky
|
no-shortcuts = Žádné zkratky
|
||||||
password-manager = Manažer hesel
|
password-manager = Správce hesel
|
||||||
replace = Nahradit
|
replace = Nahradit
|
||||||
reset-to-default = Obnovit výchozí
|
reset-to-default = Obnovit výchozí
|
||||||
shortcut-group-clipboard = Schránka
|
shortcut-group-clipboard = Schránka
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ new-profile = Neues Profil
|
||||||
make-default = Als Standard festlegen
|
make-default = Als Standard festlegen
|
||||||
working-directory = Arbeitsverzeichnis
|
working-directory = Arbeitsverzeichnis
|
||||||
hold = Halten
|
hold = Halten
|
||||||
remain-open = Nach Beendigung des Kindprozesses offen bleiben.
|
remain-open = Nach Beendigung des untergeordneten Prozesses geöffnet lassen.
|
||||||
|
|
||||||
## Einstellungen
|
## Einstellungen
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ settings = Einstellungen
|
||||||
|
|
||||||
appearance = Aussehen
|
appearance = Aussehen
|
||||||
theme = Thema
|
theme = Thema
|
||||||
match-desktop = An System anpassen
|
match-desktop = An Desktop anpassen
|
||||||
dark = Dunkel
|
dark = Dunkel
|
||||||
light = Hell
|
light = Hell
|
||||||
syntax-dark = Dunkles Farbschema
|
syntax-dark = Dunkles Farbschema
|
||||||
|
|
@ -67,7 +67,7 @@ focus-follow-mouse = Tippfokus folgt Maus
|
||||||
|
|
||||||
advanced = Erweitert
|
advanced = Erweitert
|
||||||
show-headerbar = Kopfzeile anzeigen
|
show-headerbar = Kopfzeile anzeigen
|
||||||
show-header-description = Kopfzeile über das Rechtsklickmenü einblenden.
|
show-header-description = Kopfzeile über das Rechtsklick-Menü aufzeigen
|
||||||
# Suchen
|
# Suchen
|
||||||
find-placeholder = Suchen...
|
find-placeholder = Suchen...
|
||||||
find-previous = Vorherigen suchen
|
find-previous = Vorherigen suchen
|
||||||
|
|
@ -141,3 +141,9 @@ type-to-search = Zum Suchen tippen...
|
||||||
close-window = Fenster schließen
|
close-window = Fenster schließen
|
||||||
copy-or-sigint = Kopieren oder SIGINT
|
copy-or-sigint = Kopieren oder SIGINT
|
||||||
toggle-fullscreen = Vollbild umschalten
|
toggle-fullscreen = Vollbild umschalten
|
||||||
|
shortcut-group-zoom = Zoom
|
||||||
|
comment = Terminalemulator für den COSMIC Desktop
|
||||||
|
paste-primary = Primär einfügen
|
||||||
|
add-another-keybinding = Weitere Tastenbelegung hinzufügen
|
||||||
|
shortcut-replace-body = { $binding } ist bereits { $existing } zugeordnet. Durch { $new_action } ersetzen?
|
||||||
|
keywords = Befehl;Shell;Terminal;CLI;
|
||||||
|
|
|
||||||
0
i18n/eu/cosmic_term.ftl
Normal file
0
i18n/eu/cosmic_term.ftl
Normal file
|
|
@ -14,7 +14,7 @@ rename = Nimeä uudelleen
|
||||||
export = Vie
|
export = Vie
|
||||||
delete = Poista
|
delete = Poista
|
||||||
import = Tuo
|
import = Tuo
|
||||||
import-errors = Tuo virheet
|
import-errors = Tuotaessa tapahtuneet virheet
|
||||||
|
|
||||||
## Profiles
|
## Profiles
|
||||||
|
|
||||||
|
|
@ -26,9 +26,9 @@ tab-title-description = Ylikirjoita välilehden oletusotsikko
|
||||||
add-profile = Lisää profiili
|
add-profile = Lisää profiili
|
||||||
new-profile = Uusi profiili
|
new-profile = Uusi profiili
|
||||||
make-default = Aseta oletukseksi
|
make-default = Aseta oletukseksi
|
||||||
working-directory = Työkansio
|
working-directory = Työhakemisto
|
||||||
hold = Pidä
|
hold = Pidä
|
||||||
remain-open = Pysy auki lapsiprosessin sulkeutumisen jälkeen.
|
remain-open = Pysy avoinna lapsiprosessin sulkeutumisen jälkeen.
|
||||||
|
|
||||||
## Settings
|
## Settings
|
||||||
|
|
||||||
|
|
@ -38,13 +38,13 @@ settings = Asetukset
|
||||||
|
|
||||||
appearance = Ulkoasu
|
appearance = Ulkoasu
|
||||||
theme = Teema
|
theme = Teema
|
||||||
match-desktop = Sovita työpöydän kanssa
|
match-desktop = Sovita työpöytään
|
||||||
dark = Tumma
|
dark = Tumma
|
||||||
light = Vaalea
|
light = Vaalea
|
||||||
syntax-dark = Tumma väriteema
|
syntax-dark = Tumma väriteema
|
||||||
syntax-light = Vaalea väriteema
|
syntax-light = Vaalea väriteema
|
||||||
default-zoom-step = Zoomausaskeleet
|
default-zoom-step = Zoomauksen askeleet
|
||||||
opacity = Taustan läpinäkyvyys
|
opacity = Taustan peittävyys
|
||||||
|
|
||||||
### Font
|
### Font
|
||||||
|
|
||||||
|
|
@ -52,11 +52,11 @@ font = Fontti
|
||||||
advanced-font-settings = Fontin lisäasetukset
|
advanced-font-settings = Fontin lisäasetukset
|
||||||
default-font = Fontti
|
default-font = Fontti
|
||||||
default-font-size = Fontin koko
|
default-font-size = Fontin koko
|
||||||
default-font-stretch = Kirjasimen venyvyys
|
default-font-stretch = Fontin venyvyys
|
||||||
default-font-weight = Oletuskirjasimen paino
|
default-font-weight = Fontin normaalipaino
|
||||||
default-dim-font-weight = Kirjasimen painon himmennys
|
default-dim-font-weight = Himmennetyn fontin paino
|
||||||
default-bold-font-weight = Paksun kirjasimen paino
|
default-bold-font-weight = Lihavoidun fontin paino
|
||||||
use-bright-bold = Näytä paksu kirjasin kirkkaana
|
use-bright-bold = Näytä lihavoitu teksti kirkkaampana
|
||||||
|
|
||||||
### Splits
|
### Splits
|
||||||
|
|
||||||
|
|
@ -67,7 +67,7 @@ focus-follow-mouse = Kirjoituksen kohdistus seuraa hiirtä
|
||||||
|
|
||||||
advanced = Lisäasetukset
|
advanced = Lisäasetukset
|
||||||
show-headerbar = Näytä otsake
|
show-headerbar = Näytä otsake
|
||||||
show-header-description = Paljasta otsake hiiren oikean painikkeen valikosta.
|
show-header-description = Paljasta otsake hiiren oikean painikkeen valikosta
|
||||||
|
|
||||||
# Find
|
# Find
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ next-tab = Seuraava välilehti
|
||||||
previous-tab = Edellinen välilehti
|
previous-tab = Edellinen välilehti
|
||||||
split-horizontal = Halkaise näkymä vaakasuunnassa
|
split-horizontal = Halkaise näkymä vaakasuunnassa
|
||||||
split-vertical = Halkaise näkymä pystysuunnassa
|
split-vertical = Halkaise näkymä pystysuunnassa
|
||||||
pane-toggle-maximize = Maksimointi päälle tai pois päältä
|
pane-toggle-maximize = Suurennus päällä tai pois
|
||||||
menu-color-schemes = Väriteemat…
|
menu-color-schemes = Väriteemat…
|
||||||
menu-settings = Asetukset…
|
menu-settings = Asetukset…
|
||||||
menu-about = Tietoa COSMICin päätteestä…
|
menu-about = Tietoa COSMICin päätteestä…
|
||||||
|
|
@ -134,3 +134,18 @@ menu-keyboard-shortcuts = Pikanäppäimet…
|
||||||
tab-activate = Aktivoi välilehti { $number }
|
tab-activate = Aktivoi välilehti { $number }
|
||||||
type-to-search = Etsi kirjoittamalla…
|
type-to-search = Etsi kirjoittamalla…
|
||||||
password-manager = Salasanahallinta
|
password-manager = Salasanahallinta
|
||||||
|
reset-to-default = Palauta oletukseksi
|
||||||
|
menu-password-manager = Salasanat…
|
||||||
|
add-another-keybinding = Lisää toinen näppäinsidos
|
||||||
|
focus-pane-down = Kohdista alempaan ruutuun
|
||||||
|
focus-pane-left = Kohdista vasemmanpuoleiseen ruutuun
|
||||||
|
focus-pane-right = Kohdista oikeanpuoleiseen ruutuun
|
||||||
|
focus-pane-up = Kohdista ylempään ruutuun
|
||||||
|
paste-primary = Liitä ensisijainen
|
||||||
|
shortcut-capture-hint = Paina näppäinyhdistelmää
|
||||||
|
shortcut-replace-body = { $binding } on jo kytketty toimintoon { $existing }. Korvataanko se toiminnolla { $new_action }?
|
||||||
|
shortcut-replace-title = Korvataanko pikanäppäin?
|
||||||
|
copy-or-sigint = Kopioi tai SIGINT
|
||||||
|
shortcut-group-zoom = Lähennä
|
||||||
|
toggle-fullscreen = Koko näyttö päällä tai pois
|
||||||
|
shortcut-group-other = Muut
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ default-font = Betűtípus
|
||||||
default-font-size = Betűméret
|
default-font-size = Betűméret
|
||||||
default-font-stretch = Betűszélesség
|
default-font-stretch = Betűszélesség
|
||||||
default-font-weight = Normál betűsúly
|
default-font-weight = Normál betűsúly
|
||||||
default-dim-font-weight = Halvány betűsúly
|
default-dim-font-weight = Vékony betűsúly
|
||||||
default-bold-font-weight = Félkövér betűsúly
|
default-bold-font-weight = Félkövér betűsúly
|
||||||
use-bright-bold = Félkövér szöveg világosítása
|
use-bright-bold = Félkövér szöveg világosítása
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,107 @@
|
||||||
|
cancel = Sefsex
|
||||||
|
name = Isem
|
||||||
|
delete = kkes
|
||||||
|
rename = Snifel isem
|
||||||
|
quit = Tuffɣa
|
||||||
|
support = Tallalt
|
||||||
|
repository = Asarsay
|
||||||
|
settings = Iɣewwaṛen
|
||||||
|
appearance = Timeẓri
|
||||||
|
theme = Asentel
|
||||||
|
dark = Aɣmayan
|
||||||
|
light = Aceɛlal
|
||||||
|
paste = Senteḍ
|
||||||
|
select-all = Fren akk
|
||||||
|
view = Wali
|
||||||
|
menu-settings = Iɣewwaṛen…
|
||||||
|
match-desktop = Amṣada d tnarit
|
||||||
|
file = Afaylu
|
||||||
|
new-window = Asfaylu amaynut
|
||||||
|
edit = Ẓreg
|
||||||
|
copy = Nɣel
|
||||||
|
default-zoom-step = Isurifen n usemɣer
|
||||||
|
find = Af-d
|
||||||
|
find-placeholder = Af-d…
|
||||||
|
find-previous = Af-d uzwir
|
||||||
|
find-next = Af-d uḍfir
|
||||||
|
replace = Semselsi
|
||||||
|
keyboard-shortcuts = Inegzumen n unasiw
|
||||||
|
menu-keyboard-shortcuts = Inegzumen n unasiw…
|
||||||
|
new-tab = Iccer amaynut
|
||||||
|
close-tab = Mdel iccer
|
||||||
|
import = Kter
|
||||||
|
export = Sifeḍ
|
||||||
|
reset-to-default = Ales awennez ɣer umezwer
|
||||||
|
type-to-search = Aru iwakken ad tnadiḍ…
|
||||||
|
add-another-keybinding = Rnu yiwen n unegzum n unasiw nniḍen
|
||||||
|
font = Tasefsit
|
||||||
|
default-font = Tasefsit
|
||||||
|
password-input = Awal uffir
|
||||||
|
password-input-description = Aglam
|
||||||
|
close-window = Mdel asfaylu
|
||||||
|
copy-or-sigint = Nɣel neɣ SIGINT
|
||||||
|
disable = Kkes armad
|
||||||
|
no-shortcuts = Ulac inegzumen
|
||||||
|
password-manager = Amsefrak n wawal n uɛeddi
|
||||||
|
shortcut-group-other = Ayen nniḍen
|
||||||
|
shortcut-group-tabs = Iccaren
|
||||||
|
shortcut-group-window = Asfaylu
|
||||||
|
shortcut-replace-title = Semselsi anegzum?
|
||||||
|
toggle-fullscreen = Qluqel ɣer ugdil aččuran
|
||||||
|
shortcut-group-clipboard = Tacfawit
|
||||||
|
shortcut-group-zoom = Asimɣeṛ
|
||||||
|
show-header-description = Err-d inixef seg wumuɣ n usiti ayeffus
|
||||||
|
new-terminal = Ixf amaynut
|
||||||
|
color-schemes = Azenziɣ n yiniten
|
||||||
|
import-errors = Kter tuccḍiwin
|
||||||
|
profiles = imaɣnuten
|
||||||
|
command-line = Izirig n tladna
|
||||||
|
tab-title = Azwel n yiccer
|
||||||
|
tab-title-description = Snifel azwel n yiccer amezwer
|
||||||
|
add-profile = Rnu amaɣnu
|
||||||
|
new-profile = Amaɣnu amaynut
|
||||||
|
make-default = Err-it d amezwer
|
||||||
|
working-directory = Akaram n umahil
|
||||||
|
hold = Ṭṭef
|
||||||
|
syntax-dark = Azenziɣ n yini aɣmayan
|
||||||
|
syntax-light = Azenziɣ n yini aceɛlal
|
||||||
|
opacity = Tiḍullest n ugilal
|
||||||
|
advanced-font-settings = Iɣewwaṛen inaẓiyen n tsefsit
|
||||||
|
default-font-size = Tiddi n tsefsit
|
||||||
|
default-font-stretch = Ajbad n tsefsit
|
||||||
|
default-font-weight = Taẓeyt n tsefsit tamagnut
|
||||||
|
default-dim-font-weight = Taẓeyt n tsefsit tafessast
|
||||||
|
default-bold-font-weight = Taẓeyt n tsefsit n tira tazurant
|
||||||
|
use-bright-bold = Err aḍris azuran yettfeǧǧiǧ
|
||||||
|
show-headerbar = Sken inixef
|
||||||
|
profile = Amaɣnu
|
||||||
|
menu-profiles = imaɣnuten…
|
||||||
|
remain-open = Qqim teldiḍ deffir n tuffɣa n ukala aqrur.
|
||||||
|
focus-follow-mouse = Asaḍas n tira yettḍafar taɣerdayt
|
||||||
|
advanced = Leqqayen
|
||||||
|
clear-scrollback = Sfeḍ adrurem ɣer deffir
|
||||||
|
open-link = Ldi aseɣwen
|
||||||
|
zoom-in = Aḍris ahrawan
|
||||||
|
zoom-reset = Tiddi n uḍris amezwer
|
||||||
|
zoom-out = Aḍris wezzilen ugar
|
||||||
|
next-tab = Iccer uḍfir
|
||||||
|
previous-tab = Iccer uzwir
|
||||||
|
split-horizontal = Ẓun s wudem aglawan
|
||||||
|
split-vertical = Ẓun s wudem ubdid
|
||||||
|
pane-toggle-maximize = Qluqel asemɣer
|
||||||
|
menu-about = Ɣef ixf COSMIC…
|
||||||
|
menu-password-manager = Awalen uffiren...
|
||||||
|
passwords-title = Awalen uffiren
|
||||||
|
add-password = Rnu awal uffir
|
||||||
|
splits = Tiẓunin
|
||||||
|
menu-color-schemes = Azenziɣ n yini...
|
||||||
|
comment = Amtellal n yixef i tnarit COSMIC
|
||||||
|
keywords = Taladna; Ajeɣlal; Ixf; CLI;
|
||||||
|
focus-pane-down = Err asaḍas ɣer ugalis ukessar
|
||||||
|
focus-pane-left = Err asaḍas ɣer ugalis uzelmaḍ
|
||||||
|
focus-pane-right = Err asaḍas ɣer ugalis uyeffus
|
||||||
|
focus-pane-up = Err asaḍas ɣer ugalis uksawen
|
||||||
|
paste-primary = Senṭeḍ agejdan
|
||||||
|
shortcut-capture-hint = Sit ɣef usuddes n tqeffalin
|
||||||
|
tab-activate = Sermed iccer { $number }
|
||||||
|
copy-link = Nɣel aseɣwen
|
||||||
|
|
@ -51,7 +51,7 @@ default-dim-font-weight = 희미한 글꼴 굵기
|
||||||
advanced = 고급
|
advanced = 고급
|
||||||
use-bright-bold = 굵은 텍스트를 더 밝게 표시
|
use-bright-bold = 굵은 텍스트를 더 밝게 표시
|
||||||
default-bold-font-weight = 굵은 글꼴 굵기
|
default-bold-font-weight = 굵은 글꼴 굵기
|
||||||
show-header-description = 오른쪽 클릭 메뉴를 통해 헤더를 나타냅니다.
|
show-header-description = 우클릭 메뉴를 통해 헤더를 나타냅니다
|
||||||
password-input-description = 설명
|
password-input-description = 설명
|
||||||
default-font = 글꼴
|
default-font = 글꼴
|
||||||
paste = 붙여넣기
|
paste = 붙여넣기
|
||||||
|
|
@ -78,3 +78,19 @@ find = 찾기
|
||||||
profile = 프로필
|
profile = 프로필
|
||||||
new-tab = 새 탭
|
new-tab = 새 탭
|
||||||
comment = COSMIC 데스크톱용 터미널 에뮬레이터
|
comment = COSMIC 데스크톱용 터미널 에뮬레이터
|
||||||
|
menu-keyboard-shortcuts = 단축키...
|
||||||
|
keywords = 명령어;셸;터미널;CLI;
|
||||||
|
cancel = 취소
|
||||||
|
close-window = 창 닫기
|
||||||
|
disable = 비활성화
|
||||||
|
keyboard-shortcuts = 단축키
|
||||||
|
password-manager = 암호 관리자
|
||||||
|
replace = 대체
|
||||||
|
shortcut-group-clipboard = 클립보드
|
||||||
|
shortcut-group-tabs = 탭
|
||||||
|
shortcut-group-window = 창
|
||||||
|
shortcut-replace-title = 단축키를 대체할까요?
|
||||||
|
tab-activate = 활성 탭 { $number }
|
||||||
|
toggle-fullscreen = 전체 화면 전환
|
||||||
|
type-to-search = 입력하여 검색…
|
||||||
|
copy-link = 링크 복사
|
||||||
|
|
|
||||||
|
|
@ -71,3 +71,4 @@ syntax-light = Fargeskjema lyst
|
||||||
default-zoom-step = Zoom steg
|
default-zoom-step = Zoom steg
|
||||||
focus-follow-mouse = Skrivefokus følger musen
|
focus-follow-mouse = Skrivefokus følger musen
|
||||||
hold = Hold
|
hold = Hold
|
||||||
|
cancel = Avbryt
|
||||||
|
|
|
||||||
|
|
@ -113,10 +113,10 @@ pane-toggle-maximize = Alternar maximização
|
||||||
menu-color-schemes = Esquemas de cores...
|
menu-color-schemes = Esquemas de cores...
|
||||||
menu-settings = Configurações...
|
menu-settings = Configurações...
|
||||||
menu-about = Sobre o Terminal...
|
menu-about = Sobre o Terminal...
|
||||||
open-link = Abrir Link
|
open-link = Abrir link
|
||||||
menu-password-manager = Senhas...
|
menu-password-manager = Senhas...
|
||||||
passwords-title = Senhas
|
passwords-title = Senhas
|
||||||
add-password = Adicionar Senha
|
add-password = Adicionar senha
|
||||||
password-input = Senha
|
password-input = Senha
|
||||||
password-input-description = Descrição
|
password-input-description = Descrição
|
||||||
add-another-keybinding = Adicionar outra combinação de teclas
|
add-another-keybinding = Adicionar outra combinação de teclas
|
||||||
|
|
@ -124,15 +124,15 @@ cancel = Cancelar
|
||||||
close-window = Fechar janela
|
close-window = Fechar janela
|
||||||
copy-or-sigint = Copiar ou SIGINT
|
copy-or-sigint = Copiar ou SIGINT
|
||||||
disable = Desabilitar
|
disable = Desabilitar
|
||||||
focus-pane-down = Focar painel abaixo
|
focus-pane-down = Focar o quadro abaixo
|
||||||
focus-pane-left = Focar painel à esquerda
|
focus-pane-left = Focar o quadro à esquerda
|
||||||
focus-pane-right = Focar painel à direita
|
focus-pane-right = Focar o quadro à direita
|
||||||
focus-pane-up = Focar painel acima
|
focus-pane-up = Focar o quadro acima
|
||||||
keyboard-shortcuts = Atalhos de teclado
|
keyboard-shortcuts = Atalhos de teclado
|
||||||
menu-keyboard-shortcuts = Atalhos de teclado...
|
menu-keyboard-shortcuts = Atalhos de teclado...
|
||||||
no-shortcuts = Sem atalhos
|
no-shortcuts = Sem atalhos
|
||||||
password-manager = Gerenciador de senhas
|
password-manager = Gerenciador de senhas
|
||||||
paste-primary = Colar
|
paste-primary = Colar primário
|
||||||
replace = Substituir
|
replace = Substituir
|
||||||
reset-to-default = Restaurar padrão
|
reset-to-default = Restaurar padrão
|
||||||
shortcut-capture-hint = Pressione a combinação de teclas
|
shortcut-capture-hint = Pressione a combinação de teclas
|
||||||
|
|
@ -146,4 +146,4 @@ shortcut-replace-title = Substituir atalho?
|
||||||
tab-activate = Ativar aba { $number }
|
tab-activate = Ativar aba { $number }
|
||||||
toggle-fullscreen = Alternar para tela cheia
|
toggle-fullscreen = Alternar para tela cheia
|
||||||
type-to-search = Digite para pesquisar...
|
type-to-search = Digite para pesquisar...
|
||||||
copy-link = Copiar Link
|
copy-link = Copiar link
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ advanced = 高级
|
||||||
show-headerbar = 显示标题栏
|
show-headerbar = 显示标题栏
|
||||||
show-header-description = 右键菜单提供显示标题栏选项
|
show-header-description = 右键菜单提供显示标题栏选项
|
||||||
# Find
|
# Find
|
||||||
find-placeholder = 查找...
|
find-placeholder = 查找…
|
||||||
find-previous = 查找上一个
|
find-previous = 查找上一个
|
||||||
find-next = 查找下一个
|
find-next = 查找下一个
|
||||||
|
|
||||||
|
|
@ -82,7 +82,7 @@ file = 文件
|
||||||
new-tab = 新建标签
|
new-tab = 新建标签
|
||||||
new-window = 新建窗口
|
new-window = 新建窗口
|
||||||
profile = 配置
|
profile = 配置
|
||||||
menu-profiles = 配置文件...
|
menu-profiles = 配置文件…
|
||||||
close-tab = 关闭标签
|
close-tab = 关闭标签
|
||||||
quit = 退出
|
quit = 退出
|
||||||
|
|
||||||
|
|
@ -106,9 +106,9 @@ previous-tab = 上一个标签
|
||||||
split-horizontal = 水平分割
|
split-horizontal = 水平分割
|
||||||
split-vertical = 垂直分割
|
split-vertical = 垂直分割
|
||||||
pane-toggle-maximize = 切换最大化
|
pane-toggle-maximize = 切换最大化
|
||||||
menu-color-schemes = 配色方案...
|
menu-color-schemes = 配色方案…
|
||||||
menu-settings = 设置...
|
menu-settings = 设置…
|
||||||
menu-about = 关于 COSMIC 终端...
|
menu-about = 关于 COSMIC 终端…
|
||||||
repository = 仓库
|
repository = 仓库
|
||||||
support = 支持
|
support = 支持
|
||||||
open-link = 打开链接
|
open-link = 打开链接
|
||||||
|
|
@ -132,7 +132,7 @@ shortcut-group-clipboard = 剪切板
|
||||||
shortcut-group-other = 其他
|
shortcut-group-other = 其他
|
||||||
shortcut-group-tabs = 标签
|
shortcut-group-tabs = 标签
|
||||||
shortcut-group-zoom = 缩放
|
shortcut-group-zoom = 缩放
|
||||||
type-to-search = 输入即可搜索...
|
type-to-search = 输入即可搜索…
|
||||||
copy-or-sigint = 复制或 SIGINT
|
copy-or-sigint = 复制或 SIGINT
|
||||||
focus-pane-down = 聚焦下方窗格
|
focus-pane-down = 聚焦下方窗格
|
||||||
focus-pane-left = 聚焦左侧窗格
|
focus-pane-left = 聚焦左侧窗格
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
cosmic-terminal = COSMIC 終端機
|
cosmic-terminal = COSMIC 終端機
|
||||||
new-terminal = 新增 終端機
|
new-terminal = 新建終端機
|
||||||
|
|
||||||
# Context Pages
|
# Context Pages
|
||||||
|
|
||||||
|
|
@ -9,7 +9,7 @@ new-terminal = 新增 終端機
|
||||||
|
|
||||||
## Color schemes
|
## Color schemes
|
||||||
|
|
||||||
color-schemes = 主題
|
color-schemes = 配色方案
|
||||||
rename = 重命名
|
rename = 重命名
|
||||||
export = 匯出
|
export = 匯出
|
||||||
delete = 刪除
|
delete = 刪除
|
||||||
|
|
@ -38,36 +38,36 @@ settings = 設定
|
||||||
|
|
||||||
appearance = 外觀
|
appearance = 外觀
|
||||||
theme = 主題
|
theme = 主題
|
||||||
match-desktop = 配合桌面
|
match-desktop = 符合桌面
|
||||||
dark = 暗色
|
dark = 深色
|
||||||
light = 亮色
|
light = 淺色
|
||||||
syntax-dark = 暗色調
|
syntax-dark = 暗色調
|
||||||
syntax-light = 亮色調
|
syntax-light = 亮色調
|
||||||
default-zoom-step = 縮放步進
|
default-zoom-step = 縮放步進
|
||||||
opacity = 背景透明度
|
opacity = 背景不透明度
|
||||||
|
|
||||||
### Font
|
### Font
|
||||||
|
|
||||||
font = 字體
|
font = 字型
|
||||||
advanced-font-settings = 進階字體設定
|
advanced-font-settings = 進階字型設定
|
||||||
default-font = 字體
|
default-font = 字型
|
||||||
default-font-size = 字體大小
|
default-font-size = 字型大小
|
||||||
default-font-stretch = 字體延伸
|
default-font-stretch = 字型伸展
|
||||||
default-font-weight = 字體粗細
|
default-font-weight = 正常字型粗細
|
||||||
default-dim-font-weight = 淡色字體粗細
|
default-dim-font-weight = 黯淡字型粗細
|
||||||
default-bold-font-weight = 粗字體粗細
|
default-bold-font-weight = 粗體字型粗細
|
||||||
use-bright-bold = 使粗體字更亮
|
use-bright-bold = 使粗體文字更亮
|
||||||
|
|
||||||
### Splits
|
### Splits
|
||||||
|
|
||||||
splits = 終端介面分割
|
splits = 分割
|
||||||
focus-follow-mouse = 滑鼠點擊選擇輸入窗口
|
focus-follow-mouse = 輸入焦點追隨滑鼠
|
||||||
|
|
||||||
### Advanced
|
### Advanced
|
||||||
|
|
||||||
advanced = 進階
|
advanced = 進階
|
||||||
show-headerbar = 顯示標題列
|
show-headerbar = 顯示標題列
|
||||||
show-header-description = 右鍵選單提供標題列選項。
|
show-header-description = 右鍵選單提供標題列選項
|
||||||
# Find
|
# Find
|
||||||
find-placeholder = 尋找...
|
find-placeholder = 尋找...
|
||||||
find-previous = 上一個
|
find-previous = 上一個
|
||||||
|
|
@ -79,12 +79,12 @@ find-next = 下一個
|
||||||
## File
|
## File
|
||||||
|
|
||||||
file = 檔案
|
file = 檔案
|
||||||
new-tab = 新增分頁
|
new-tab = 新建分頁
|
||||||
new-window = 新增視窗
|
new-window = 新建視窗
|
||||||
profile = 設定檔
|
profile = 設定檔案
|
||||||
menu-profiles = 設定檔...
|
menu-profiles = 設定檔案...
|
||||||
close-tab = 關閉分頁
|
close-tab = 關閉分頁
|
||||||
quit = 結束
|
quit = 退出
|
||||||
|
|
||||||
## Edit
|
## Edit
|
||||||
|
|
||||||
|
|
@ -97,14 +97,53 @@ find = 尋找
|
||||||
## View
|
## View
|
||||||
|
|
||||||
view = 檢視
|
view = 檢視
|
||||||
zoom-in = 放大文字
|
zoom-in = 較大文字
|
||||||
zoom-reset = 重設文字大小
|
zoom-reset = 預設文字大小
|
||||||
zoom-out = 縮小文字
|
zoom-out = 較小文字
|
||||||
next-tab = 下個分頁
|
next-tab = 下個分頁
|
||||||
previous-tab = 上個分頁
|
previous-tab = 上個分頁
|
||||||
split-horizontal = 水平分割
|
split-horizontal = 水平分割
|
||||||
split-vertical = 垂直分割
|
split-vertical = 垂直分割
|
||||||
pane-toggle-maximize = 切換最大化
|
pane-toggle-maximize = 切換最大化
|
||||||
menu-color-schemes = 主題...
|
menu-color-schemes = 配色方案...
|
||||||
menu-settings = 設定...
|
menu-settings = 設定...
|
||||||
menu-about = 關於 COSMIC 終端機...
|
menu-about = 關於 COSMIC 終端機…
|
||||||
|
cancel = 取消
|
||||||
|
repository = 軟體庫源
|
||||||
|
support = 支援
|
||||||
|
keyboard-shortcuts = 鍵盤快速鍵
|
||||||
|
keywords = 指令;殼層;終端;指令行介面CLI;
|
||||||
|
add-another-keybinding = 添加另一個按鍵組合
|
||||||
|
close-window = 關閉視窗
|
||||||
|
copy-or-sigint = 複製或 SIGINT
|
||||||
|
disable = 停用
|
||||||
|
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 = 縮放
|
||||||
|
focus-pane-down = 聚焦下方窗格
|
||||||
|
focus-pane-left = 聚焦左側窗格
|
||||||
|
focus-pane-right = 聚焦右側窗格
|
||||||
|
focus-pane-up = 聚焦上方窗格
|
||||||
|
open-link = 開啟連結
|
||||||
|
menu-password-manager = 密碼…
|
||||||
|
passwords-title = 密碼
|
||||||
|
add-password = 添增密碼
|
||||||
|
password-input = 密碼
|
||||||
|
password-input-description = 描述
|
||||||
|
shortcut-replace-title = 取代快速鍵?
|
||||||
|
tab-activate = 啟用分頁 { $number }
|
||||||
|
toggle-fullscreen = 切換全螢幕
|
||||||
|
type-to-search = 輸入進行搜尋...
|
||||||
|
copy-link = 複製連結
|
||||||
|
shortcut-replace-body = { $binding } 已經分配至 { $existing }。 要取代它為 { $new_action }?
|
||||||
|
clear-scrollback = 清除捲動回朔
|
||||||
|
comment = COSMIC 桌面終端機模擬器
|
||||||
|
|
|
||||||
549
src/main.rs
549
src/main.rs
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
||||||
use cosmic::iced::clipboard::dnd::DndAction;
|
use cosmic::iced::clipboard::dnd::DndAction;
|
||||||
use cosmic::iced_core::keyboard::key::Named;
|
use cosmic::iced::core::keyboard::key::Named;
|
||||||
use cosmic::widget::menu::action::MenuAction;
|
use cosmic::widget::menu::action::MenuAction;
|
||||||
use cosmic::widget::menu::key_bind::KeyBind;
|
use cosmic::widget::menu::key_bind::KeyBind;
|
||||||
use cosmic::widget::pane_grid::Pane;
|
use cosmic::widget::pane_grid::Pane;
|
||||||
|
|
@ -177,11 +177,7 @@ fn main() -> Result<(), Box<dyn Error>> {
|
||||||
|
|
||||||
let shortcuts_config = shortcuts::ShortcutsConfig::new(config.shortcuts_custom.clone());
|
let shortcuts_config = shortcuts::ShortcutsConfig::new(config.shortcuts_custom.clone());
|
||||||
|
|
||||||
let shell = if let Some(shell_program) = shell_program_opt {
|
let shell = shell_program_opt.map(|shell_program| tty::Shell::new(shell_program, shell_args));
|
||||||
Some(tty::Shell::new(shell_program, shell_args))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
};
|
|
||||||
let startup_options = Some(tty::Options {
|
let startup_options = Some(tty::Options {
|
||||||
shell,
|
shell,
|
||||||
working_directory,
|
working_directory,
|
||||||
|
|
@ -367,7 +363,7 @@ pub enum Message {
|
||||||
ColorSchemeRename(ColorSchemeKind, ColorSchemeId, String),
|
ColorSchemeRename(ColorSchemeKind, ColorSchemeId, String),
|
||||||
ColorSchemeRenameSubmit,
|
ColorSchemeRenameSubmit,
|
||||||
ColorSchemeTabActivate(widget::segmented_button::Entity),
|
ColorSchemeTabActivate(widget::segmented_button::Entity),
|
||||||
Config(Config),
|
Config(Box<Config>),
|
||||||
Copy(Option<segmented_button::Entity>),
|
Copy(Option<segmented_button::Entity>),
|
||||||
CopyOrSigint(Option<segmented_button::Entity>),
|
CopyOrSigint(Option<segmented_button::Entity>),
|
||||||
CopyPrimary(Option<segmented_button::Entity>),
|
CopyPrimary(Option<segmented_button::Entity>),
|
||||||
|
|
@ -379,7 +375,7 @@ pub enum Message {
|
||||||
DefaultFontStretch(usize),
|
DefaultFontStretch(usize),
|
||||||
DefaultFontWeight(usize),
|
DefaultFontWeight(usize),
|
||||||
DefaultZoomStep(usize),
|
DefaultZoomStep(usize),
|
||||||
DialogMessage(DialogMessage),
|
DialogMessage(Box<DialogMessage>), // DialogMessage is huge, so we use a box to make the size of this enum smaller on the stack
|
||||||
Drop(Option<(pane_grid::Pane, segmented_button::Entity, DndDrop)>),
|
Drop(Option<(pane_grid::Pane, segmented_button::Entity, DndDrop)>),
|
||||||
Find(bool),
|
Find(bool),
|
||||||
FindNext,
|
FindNext,
|
||||||
|
|
@ -454,6 +450,7 @@ pub enum Message {
|
||||||
ZoomIn,
|
ZoomIn,
|
||||||
ZoomOut,
|
ZoomOut,
|
||||||
ZoomReset,
|
ZoomReset,
|
||||||
|
ContextMenuPopupClosed(window::Id),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||||
|
|
@ -524,6 +521,14 @@ pub struct App {
|
||||||
shortcut_search_regex: Option<regex::Regex>,
|
shortcut_search_regex: Option<regex::Regex>,
|
||||||
shortcut_search_value: String,
|
shortcut_search_value: String,
|
||||||
modifiers: Modifiers,
|
modifiers: Modifiers,
|
||||||
|
context_menu_popup: Option<(
|
||||||
|
window::Id,
|
||||||
|
pane_grid::Pane,
|
||||||
|
segmented_button::Entity,
|
||||||
|
Option<String>,
|
||||||
|
widget::Id,
|
||||||
|
cosmic::iced::Point,
|
||||||
|
)>,
|
||||||
#[cfg(feature = "password_manager")]
|
#[cfg(feature = "password_manager")]
|
||||||
password_mgr: password_manager::PasswordManager,
|
password_mgr: password_manager::PasswordManager,
|
||||||
}
|
}
|
||||||
|
|
@ -546,21 +551,19 @@ impl App {
|
||||||
.config
|
.config
|
||||||
.color_schemes(color_scheme_kind)
|
.color_schemes(color_scheme_kind)
|
||||||
.get(&color_scheme_id)
|
.get(&color_scheme_id)
|
||||||
{
|
&& self
|
||||||
if self
|
|
||||||
.themes
|
.themes
|
||||||
.insert(
|
.insert(
|
||||||
(color_scheme_name.clone(), color_scheme_kind),
|
(color_scheme_name.clone(), color_scheme_kind),
|
||||||
color_scheme.into(),
|
color_scheme.into(),
|
||||||
)
|
)
|
||||||
.is_some()
|
.is_some()
|
||||||
{
|
{
|
||||||
log::warn!(
|
log::warn!(
|
||||||
"custom {:?} color scheme {:?} replaces builtin one",
|
"custom {:?} color scheme {:?} replaces builtin one",
|
||||||
color_scheme_kind,
|
color_scheme_kind,
|
||||||
color_scheme_name
|
color_scheme_name
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -691,21 +694,21 @@ impl App {
|
||||||
// but only for the active pane/tab
|
// but only for the active pane/tab
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
for entity in tab_model.iter() {
|
for entity in tab_model.iter() {
|
||||||
if tab_model.is_active(entity) {
|
if tab_model.is_active(entity)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
let mut terminal = terminal.lock().unwrap();
|
{
|
||||||
let current_zoom_adj = terminal.zoom_adj();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
match zoom_message {
|
let current_zoom_adj = terminal.zoom_adj();
|
||||||
Message::ZoomIn => {
|
match zoom_message {
|
||||||
terminal.set_zoom_adj(current_zoom_adj.saturating_add(1))
|
Message::ZoomIn => {
|
||||||
}
|
terminal.set_zoom_adj(current_zoom_adj.saturating_add(1))
|
||||||
Message::ZoomOut => {
|
|
||||||
terminal.set_zoom_adj(current_zoom_adj.saturating_sub(1))
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
terminal.set_config(&self.config, &self.themes);
|
Message::ZoomOut => {
|
||||||
|
terminal.set_zoom_adj(current_zoom_adj.saturating_sub(1))
|
||||||
|
}
|
||||||
|
_ => {}
|
||||||
}
|
}
|
||||||
|
terminal.set_config(&self.config, &self.themes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -714,16 +717,16 @@ impl App {
|
||||||
|
|
||||||
fn save_color_schemes(&mut self, color_scheme_kind: ColorSchemeKind) -> Task<Message> {
|
fn save_color_schemes(&mut self, color_scheme_kind: ColorSchemeKind) -> Task<Message> {
|
||||||
// Optimized for just saving color_schemes
|
// Optimized for just saving color_schemes
|
||||||
if let Some(ref config_handler) = self.config_handler {
|
if let Some(ref config_handler) = self.config_handler
|
||||||
if let Err(err) = config_handler.set(
|
&& let Err(err) = config_handler.set(
|
||||||
match color_scheme_kind {
|
match color_scheme_kind {
|
||||||
ColorSchemeKind::Dark => "color_schemes_dark",
|
ColorSchemeKind::Dark => "color_schemes_dark",
|
||||||
ColorSchemeKind::Light => "color_schemes_light",
|
ColorSchemeKind::Light => "color_schemes_light",
|
||||||
},
|
},
|
||||||
self.config.color_schemes(color_scheme_kind),
|
self.config.color_schemes(color_scheme_kind),
|
||||||
) {
|
)
|
||||||
log::error!("failed to save config: {}", err);
|
{
|
||||||
}
|
log::error!("failed to save config: {}", err);
|
||||||
}
|
}
|
||||||
self.update_color_schemes();
|
self.update_color_schemes();
|
||||||
Task::none()
|
Task::none()
|
||||||
|
|
@ -746,16 +749,16 @@ impl App {
|
||||||
if self.find {
|
if self.find {
|
||||||
widget::text_input::focus(self.find_search_id.clone())
|
widget::text_input::focus(self.find_search_id.clone())
|
||||||
} else if self.core.window.show_context {
|
} else if self.core.window.show_context {
|
||||||
match self.context_page {
|
// Right now we only care about the KeyboardShortcuts context page, so we use a simple if.
|
||||||
ContextPage::KeyboardShortcuts => {
|
// In the future if we are to care about other conext pages, we could switch this to a match
|
||||||
if self.shortcut_search_focus.get() {
|
// statement instead to be cleaner.
|
||||||
self.shortcut_search_focus.set(false);
|
if self.context_page == ContextPage::KeyboardShortcuts
|
||||||
return widget::text_input::focus(self.shortcut_search_id.clone());
|
&& self.shortcut_search_focus.get()
|
||||||
}
|
{
|
||||||
}
|
self.shortcut_search_focus.set(false);
|
||||||
// TODO focus for other context pages?
|
return widget::text_input::focus(self.shortcut_search_id.clone());
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Task::none()
|
Task::none()
|
||||||
} else if let Some(terminal_id) = self.terminal_ids.get(&self.pane_model.focused()).cloned()
|
} else if let Some(terminal_id) = self.terminal_ids.get(&self.pane_model.focused()).cloned()
|
||||||
{
|
{
|
||||||
|
|
@ -950,7 +953,7 @@ impl App {
|
||||||
|
|
||||||
sections.push(
|
sections.push(
|
||||||
widget::row::with_children(vec![
|
widget::row::with_children(vec![
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
widget::button::standard(fl!("import"))
|
widget::button::standard(fl!("import"))
|
||||||
.on_press(Message::ColorSchemeImport(color_scheme_kind))
|
.on_press(Message::ColorSchemeImport(color_scheme_kind))
|
||||||
.into(),
|
.into(),
|
||||||
|
|
@ -1004,7 +1007,7 @@ impl App {
|
||||||
|
|
||||||
let mut groups = Vec::new();
|
let mut groups = Vec::new();
|
||||||
//TODO: fix text input focus going outside bounds
|
//TODO: fix text input focus going outside bounds
|
||||||
groups.push(widget::horizontal_space().into());
|
groups.push(widget::space::horizontal().into());
|
||||||
groups.push(
|
groups.push(
|
||||||
widget::text_input::search_input(fl!("type-to-search"), &self.shortcut_search_value)
|
widget::text_input::search_input(fl!("type-to-search"), &self.shortcut_search_value)
|
||||||
.id(self.shortcut_search_id.clone())
|
.id(self.shortcut_search_id.clone())
|
||||||
|
|
@ -1018,10 +1021,10 @@ impl App {
|
||||||
let mut found_actions = false;
|
let mut found_actions = false;
|
||||||
for action in group.actions {
|
for action in group.actions {
|
||||||
let action_label = shortcuts::action_label(action);
|
let action_label = shortcuts::action_label(action);
|
||||||
if let Some(regex) = &self.shortcut_search_regex {
|
if let Some(regex) = &self.shortcut_search_regex
|
||||||
if regex.find(&action_label).is_none() {
|
&& regex.find(&action_label).is_none()
|
||||||
continue;
|
{
|
||||||
}
|
continue;
|
||||||
}
|
}
|
||||||
found_actions = true;
|
found_actions = true;
|
||||||
|
|
||||||
|
|
@ -1270,7 +1273,7 @@ impl App {
|
||||||
])
|
])
|
||||||
.spacing(space_xxxs)
|
.spacing(space_xxxs)
|
||||||
.into(),
|
.into(),
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
widget::toggler(profile.drain_on_exit)
|
widget::toggler(profile.drain_on_exit)
|
||||||
.on_toggle(move |t| Message::ProfileHold(profile_id, t))
|
.on_toggle(move |t| Message::ProfileHold(profile_id, t))
|
||||||
.into(),
|
.into(),
|
||||||
|
|
@ -1293,7 +1296,7 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
let add_profile = widget::row::with_children(vec![
|
let add_profile = widget::row::with_children(vec![
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
widget::button::standard(fl!("add-profile"))
|
widget::button::standard(fl!("add-profile"))
|
||||||
.on_press(Message::ProfileNew)
|
.on_press(Message::ProfileNew)
|
||||||
.into(),
|
.into(),
|
||||||
|
|
@ -1557,13 +1560,13 @@ impl App {
|
||||||
self.startup_options.take().unwrap_or_default();
|
self.startup_options.take().unwrap_or_default();
|
||||||
let options = tty::Options {
|
let options = tty::Options {
|
||||||
shell: startup_options.shell.or_else(|| {
|
shell: startup_options.shell.or_else(|| {
|
||||||
if let Some(mut args) = shlex::split(&profile.command) {
|
if let Some(mut args) = shlex::split(&profile.command)
|
||||||
if !args.is_empty() {
|
&& !args.is_empty()
|
||||||
let command = args.remove(0);
|
{
|
||||||
return Some(tty::Shell::new(command, args));
|
let command = args.remove(0);
|
||||||
}
|
return Some(tty::Shell::new(command, args));
|
||||||
}
|
}
|
||||||
return None;
|
None
|
||||||
}),
|
}),
|
||||||
working_directory: startup_options
|
working_directory: startup_options
|
||||||
.working_directory
|
.working_directory
|
||||||
|
|
@ -1868,6 +1871,7 @@ impl Application for App {
|
||||||
shortcut_search_regex: None,
|
shortcut_search_regex: None,
|
||||||
shortcut_search_value: String::new(),
|
shortcut_search_value: String::new(),
|
||||||
modifiers: Modifiers::empty(),
|
modifiers: Modifiers::empty(),
|
||||||
|
context_menu_popup: None,
|
||||||
#[cfg(feature = "password_manager")]
|
#[cfg(feature = "password_manager")]
|
||||||
password_mgr: Default::default(),
|
password_mgr: Default::default(),
|
||||||
};
|
};
|
||||||
|
|
@ -1974,24 +1978,23 @@ impl Application for App {
|
||||||
.get(&color_scheme_id)
|
.get(&color_scheme_id)
|
||||||
.map(|color_scheme| color_scheme.name.clone()),
|
.map(|color_scheme| color_scheme.name.clone()),
|
||||||
None => Some(format!("COSMIC {:?}", color_scheme_kind)),
|
None => Some(format!("COSMIC {:?}", color_scheme_kind)),
|
||||||
} {
|
} && self.dialog_opt.is_none()
|
||||||
if self.dialog_opt.is_none() {
|
{
|
||||||
let (dialog, command) = Dialog::new(
|
let (dialog, command) = Dialog::new(
|
||||||
DialogSettings::new().kind(DialogKind::SaveFile {
|
DialogSettings::new().kind(DialogKind::SaveFile {
|
||||||
filename: format!("{}.ron", color_scheme_name),
|
filename: format!("{}.ron", color_scheme_name),
|
||||||
}),
|
}),
|
||||||
Message::DialogMessage,
|
|msg| Message::DialogMessage(Box::new(msg)),
|
||||||
move |result| {
|
move |result| {
|
||||||
Message::ColorSchemeExportResult(
|
Message::ColorSchemeExportResult(
|
||||||
color_scheme_kind,
|
color_scheme_kind,
|
||||||
color_scheme_id_opt,
|
color_scheme_id_opt,
|
||||||
result,
|
result,
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
self.dialog_opt = Some(dialog);
|
self.dialog_opt = Some(dialog);
|
||||||
return command;
|
return command;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::ColorSchemeExportResult(color_scheme_kind, color_scheme_id_opt, result) => {
|
Message::ColorSchemeExportResult(color_scheme_kind, color_scheme_id_opt, result) => {
|
||||||
|
|
@ -2079,7 +2082,7 @@ impl Application for App {
|
||||||
self.color_scheme_errors.clear();
|
self.color_scheme_errors.clear();
|
||||||
let (dialog, command) = Dialog::new(
|
let (dialog, command) = Dialog::new(
|
||||||
DialogSettings::new().kind(DialogKind::OpenMultipleFiles),
|
DialogSettings::new().kind(DialogKind::OpenMultipleFiles),
|
||||||
Message::DialogMessage,
|
|msg| Message::DialogMessage(Box::new(msg)),
|
||||||
move |result| Message::ColorSchemeImportResult(color_scheme_kind, result),
|
move |result| Message::ColorSchemeImportResult(color_scheme_kind, result),
|
||||||
);
|
);
|
||||||
self.dialog_opt = Some(dialog);
|
self.dialog_opt = Some(dialog);
|
||||||
|
|
@ -2133,15 +2136,13 @@ impl Application for App {
|
||||||
Message::ColorSchemeRenameSubmit => {
|
Message::ColorSchemeRenameSubmit => {
|
||||||
if let Some((color_scheme_kind, color_scheme_id, color_scheme_name)) =
|
if let Some((color_scheme_kind, color_scheme_id, color_scheme_name)) =
|
||||||
self.color_scheme_renaming.take()
|
self.color_scheme_renaming.take()
|
||||||
{
|
&& let Some(color_scheme) = self
|
||||||
if let Some(color_scheme) = self
|
|
||||||
.config
|
.config
|
||||||
.color_schemes_mut(color_scheme_kind)
|
.color_schemes_mut(color_scheme_kind)
|
||||||
.get_mut(&color_scheme_id)
|
.get_mut(&color_scheme_id)
|
||||||
{
|
{
|
||||||
color_scheme.name = color_scheme_name;
|
color_scheme.name = color_scheme_name;
|
||||||
return self.save_color_schemes(color_scheme_kind);
|
return self.save_color_schemes(color_scheme_kind);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::ColorSchemeTabActivate(entity) => {
|
Message::ColorSchemeTabActivate(entity) => {
|
||||||
|
|
@ -2155,11 +2156,11 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::Config(config) => {
|
Message::Config(config) => {
|
||||||
if config != self.config {
|
if *config != self.config {
|
||||||
let shortcuts_changed = config.shortcuts_custom != self.config.shortcuts_custom;
|
let shortcuts_changed = config.shortcuts_custom != self.config.shortcuts_custom;
|
||||||
log::info!("update config");
|
log::info!("update config");
|
||||||
//TODO: update syntax theme by clearing tabs, only if needed
|
//TODO: update syntax theme by clearing tabs, only if needed
|
||||||
self.config = config;
|
self.config = *config;
|
||||||
if shortcuts_changed {
|
if shortcuts_changed {
|
||||||
self.shortcuts_config =
|
self.shortcuts_config =
|
||||||
shortcuts::ShortcutsConfig::new(self.config.shortcuts_custom.clone());
|
shortcuts::ShortcutsConfig::new(self.config.shortcuts_custom.clone());
|
||||||
|
|
@ -2323,7 +2324,8 @@ impl Application for App {
|
||||||
},
|
},
|
||||||
Message::DialogMessage(dialog_message) => {
|
Message::DialogMessage(dialog_message) => {
|
||||||
if let Some(dialog) = &mut self.dialog_opt {
|
if let Some(dialog) = &mut self.dialog_opt {
|
||||||
return dialog.update(dialog_message);
|
// DialogMessage is boxed, so we need to dereference it before updating
|
||||||
|
return dialog.update(*dialog_message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Message::Drop(Some((pane, entity, data))) => {
|
Message::Drop(Some((pane, entity, data))) => {
|
||||||
|
|
@ -2362,13 +2364,13 @@ impl Application for App {
|
||||||
return self.update_focus();
|
return self.update_focus();
|
||||||
}
|
}
|
||||||
Message::FindNext => {
|
Message::FindNext => {
|
||||||
if !self.find_search_value.is_empty() {
|
if !self.find_search_value.is_empty()
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
&& let Some(tab_model) = self.pane_model.active()
|
||||||
let entity = tab_model.active();
|
{
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
let entity = tab_model.active();
|
||||||
let mut terminal = terminal.lock().unwrap();
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
terminal.search(&self.find_search_value, true);
|
let mut terminal = terminal.lock().unwrap();
|
||||||
}
|
terminal.search(&self.find_search_value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2376,13 +2378,13 @@ impl Application for App {
|
||||||
return self.update_focus();
|
return self.update_focus();
|
||||||
}
|
}
|
||||||
Message::FindPrevious => {
|
Message::FindPrevious => {
|
||||||
if !self.find_search_value.is_empty() {
|
if !self.find_search_value.is_empty()
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
&& let Some(tab_model) = self.pane_model.active()
|
||||||
let entity = tab_model.active();
|
{
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
let entity = tab_model.active();
|
||||||
let mut terminal = terminal.lock().unwrap();
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
terminal.search(&self.find_search_value, false);
|
let mut terminal = terminal.lock().unwrap();
|
||||||
}
|
terminal.search(&self.find_search_value, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2459,7 +2461,6 @@ impl Application for App {
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
let entity = tab_model.active();
|
let entity = tab_model.active();
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
// Update context menu position
|
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
if let Some(url) =
|
if let Some(url) =
|
||||||
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
||||||
|
|
@ -2478,14 +2479,12 @@ impl Application for App {
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
if let Some(tab_model) = self.pane_model.active() {
|
||||||
let entity = tab_model.active();
|
let entity = tab_model.active();
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
// Update context menu position
|
|
||||||
let mut terminal = terminal.lock().unwrap();
|
let mut terminal = terminal.lock().unwrap();
|
||||||
if let Some(url) =
|
if let Some(url) =
|
||||||
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
terminal.context_menu.as_ref().and_then(|m| m.link.as_ref())
|
||||||
|
&& let Err(err) = open::that_detached(url)
|
||||||
{
|
{
|
||||||
if let Err(err) = open::that_detached(url) {
|
log::warn!("failed to open {:?}: {}", url, err);
|
||||||
log::warn!("failed to open {:?}: {}", url, err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
terminal.context_menu = None;
|
terminal.context_menu = None;
|
||||||
terminal.active_regex_match = None;
|
terminal.active_regex_match = None;
|
||||||
|
|
@ -2847,54 +2846,124 @@ impl Application for App {
|
||||||
return self.update_title(None);
|
return self.update_title(None);
|
||||||
}
|
}
|
||||||
Message::TabContextAction(entity, action) => {
|
Message::TabContextAction(entity, action) => {
|
||||||
if let Some(tab_model) = self.pane_model.active() {
|
// Close context menu popup
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
let mut tasks = Vec::new();
|
||||||
// Close context menu
|
if let Some((_popup_id, _, _, _, _, _)) = self.context_menu_popup.take() {
|
||||||
{
|
#[cfg(feature = "wayland")]
|
||||||
let mut terminal = terminal.lock().unwrap();
|
if is_wayland() {
|
||||||
//Some actions need the menu_state,
|
tasks.push(cosmic::task::message(Message::Surface(
|
||||||
//so only clear the position for them.
|
cosmic::surface::action::destroy_popup(_popup_id),
|
||||||
match action {
|
)));
|
||||||
Action::LaunchUrlByMenu | Action::CopyUrlByMenu => {
|
}
|
||||||
if let Some(context_menu) = terminal.context_menu.as_mut() {
|
}
|
||||||
context_menu.position = None;
|
// Close terminal context menu state
|
||||||
}
|
if let Some(tab_model) = self.pane_model.active()
|
||||||
}
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
_ => {
|
{
|
||||||
terminal.context_menu = None;
|
let mut terminal = terminal.lock().unwrap();
|
||||||
}
|
//Some actions need the menu_state,
|
||||||
|
//so only clear the position for them.
|
||||||
|
match action {
|
||||||
|
Action::LaunchUrlByMenu | Action::CopyUrlByMenu => {
|
||||||
|
if let Some(context_menu) = terminal.context_menu.as_mut() {
|
||||||
|
context_menu.position = None;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Run action's message
|
_ => {
|
||||||
return self.update(action.message(Some(entity)));
|
terminal.context_menu = None;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
tasks.push(self.update(action.message(Some(entity))));
|
||||||
|
return cosmic::Task::batch(tasks);
|
||||||
}
|
}
|
||||||
Message::TabContextMenu(pane, menu_state) => {
|
Message::TabContextMenu(pane, menu_state) => {
|
||||||
// Close any existing context menues
|
#[allow(unused_mut)]
|
||||||
let panes: Vec<_> = self.pane_model.panes.iter().collect();
|
let mut tasks = Vec::new();
|
||||||
for (_pane, tab_model) in panes {
|
|
||||||
let entity = tab_model.active();
|
// Close existing context menu popup if any
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some((_popup_id, _, _, _, _, _)) = self.context_menu_popup.take() {
|
||||||
let mut terminal = terminal.lock().unwrap();
|
#[cfg(feature = "wayland")]
|
||||||
terminal.context_menu = None;
|
if is_wayland() {
|
||||||
|
tasks.push(cosmic::task::message(Message::Surface(
|
||||||
|
cosmic::surface::action::destroy_popup(_popup_id),
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Show the context menu on the correct pane / terminal
|
// Clear all terminal context_menu state
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
for (_, tab_model) in self.pane_model.panes.iter() {
|
||||||
let entity = tab_model.active();
|
for entity in tab_model.iter() {
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
// Update context menu position
|
let mut terminal = terminal.lock().unwrap();
|
||||||
let mut terminal = terminal.lock().unwrap();
|
terminal.context_menu = None;
|
||||||
terminal.context_menu = menu_state;
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift focus to the pane / terminal
|
if let Some(menu_state) = menu_state {
|
||||||
// with the context menu
|
if let Some(_position) = menu_state.position {
|
||||||
self.pane_model.set_focus(pane);
|
let local_position = menu_state.local_position.unwrap_or(_position);
|
||||||
return self.update_title(Some(pane));
|
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
||||||
|
let entity = tab_model.active();
|
||||||
|
let link = menu_state.link.clone();
|
||||||
|
let popup_id = window::Id::unique();
|
||||||
|
|
||||||
|
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||||
|
let mut terminal = terminal.lock().unwrap();
|
||||||
|
terminal.context_menu = Some(menu_state);
|
||||||
|
}
|
||||||
|
|
||||||
|
self.context_menu_popup = Some((
|
||||||
|
popup_id,
|
||||||
|
pane,
|
||||||
|
entity,
|
||||||
|
link,
|
||||||
|
widget::Id::unique(),
|
||||||
|
local_position,
|
||||||
|
));
|
||||||
|
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
|
if is_wayland() {
|
||||||
|
let main_window = self.core.main_window_id().unwrap();
|
||||||
|
let pos_x = _position.x as i32;
|
||||||
|
let pos_y = _position.y as i32;
|
||||||
|
|
||||||
|
tasks.push(cosmic::task::message(Message::Surface(
|
||||||
|
cosmic::surface::action::app_popup(move |_app: &mut Self| {
|
||||||
|
use cosmic::cctk::wayland_protocols::xdg::shell::client::xdg_positioner::{Anchor, Gravity};
|
||||||
|
use cosmic::iced::runtime::platform_specific::wayland::popup::{SctkPopupSettings, SctkPositioner};
|
||||||
|
|
||||||
|
SctkPopupSettings {
|
||||||
|
parent: main_window,
|
||||||
|
id: popup_id,
|
||||||
|
positioner: SctkPositioner {
|
||||||
|
size: None,
|
||||||
|
anchor_rect: cosmic::iced::Rectangle {
|
||||||
|
x: pos_x,
|
||||||
|
y: pos_y,
|
||||||
|
width: 1,
|
||||||
|
height: 1,
|
||||||
|
},
|
||||||
|
anchor: Anchor::None,
|
||||||
|
gravity: Gravity::BottomRight,
|
||||||
|
reactive: true,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
parent_size: None,
|
||||||
|
grab: true,
|
||||||
|
close_with_children: false,
|
||||||
|
input_zone: None,
|
||||||
|
}
|
||||||
|
}, None),
|
||||||
|
)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
self.pane_model.set_focus(pane);
|
||||||
|
}
|
||||||
|
|
||||||
|
return cosmic::Task::batch(tasks);
|
||||||
}
|
}
|
||||||
Message::TabNew => {
|
Message::TabNew => {
|
||||||
return self.create_and_focus_new_terminal(
|
return self.create_and_focus_new_terminal(
|
||||||
|
|
@ -2930,9 +2999,7 @@ impl Application for App {
|
||||||
let pos = tab_model
|
let pos = tab_model
|
||||||
.position(tab_model.active())
|
.position(tab_model.active())
|
||||||
.and_then(|i| (i as usize).checked_sub(1))
|
.and_then(|i| (i as usize).checked_sub(1))
|
||||||
.unwrap_or_else(|| {
|
.unwrap_or_else(|| tab_model.iter().count().saturating_sub(1));
|
||||||
tab_model.iter().count().checked_sub(1).unwrap_or_default()
|
|
||||||
});
|
|
||||||
|
|
||||||
let entity = tab_model.iter().nth(pos);
|
let entity = tab_model.iter().nth(pos);
|
||||||
if let Some(entity) = entity {
|
if let Some(entity) = entity {
|
||||||
|
|
@ -2971,13 +3038,13 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
TermEvent::ColorRequest(index, f) => {
|
TermEvent::ColorRequest(index, f) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
let terminal = terminal.lock().unwrap();
|
{
|
||||||
let rgb = terminal.colors()[index].unwrap_or_default();
|
let terminal = terminal.lock().unwrap();
|
||||||
let text = f(rgb);
|
let rgb = terminal.colors()[index].unwrap_or_default();
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
let text = f(rgb);
|
||||||
}
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TermEvent::CursorBlinkingChange => {
|
TermEvent::CursorBlinkingChange => {
|
||||||
|
|
@ -2987,11 +3054,11 @@ impl Application for App {
|
||||||
return self.update(Message::TabClose(Some(entity)));
|
return self.update(Message::TabClose(Some(entity)));
|
||||||
}
|
}
|
||||||
TermEvent::PtyWrite(text) => {
|
TermEvent::PtyWrite(text) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
let terminal = terminal.lock().unwrap();
|
{
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
let terminal = terminal.lock().unwrap();
|
||||||
}
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TermEvent::ResetTitle => {
|
TermEvent::ResetTitle => {
|
||||||
|
|
@ -3011,12 +3078,12 @@ impl Application for App {
|
||||||
return self.update_title(Some(pane));
|
return self.update_title(Some(pane));
|
||||||
}
|
}
|
||||||
TermEvent::TextAreaSizeRequest(f) => {
|
TermEvent::TextAreaSizeRequest(f) => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
let terminal = terminal.lock().unwrap();
|
{
|
||||||
let text = f(terminal.size().into());
|
let terminal = terminal.lock().unwrap();
|
||||||
terminal.input_no_scroll(text.into_bytes());
|
let text = f(terminal.size().into());
|
||||||
}
|
terminal.input_no_scroll(text.into_bytes());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TermEvent::Title(title) => {
|
TermEvent::Title(title) => {
|
||||||
|
|
@ -3035,11 +3102,11 @@ impl Application for App {
|
||||||
return self.update_title(Some(pane));
|
return self.update_title(Some(pane));
|
||||||
}
|
}
|
||||||
TermEvent::MouseCursorDirty | TermEvent::Wakeup => {
|
TermEvent::MouseCursorDirty | TermEvent::Wakeup => {
|
||||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
if let Some(tab_model) = self.pane_model.panes.get(pane)
|
||||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity)
|
||||||
let mut terminal = terminal.lock().unwrap();
|
{
|
||||||
terminal.needs_update = true;
|
let mut terminal = terminal.lock().unwrap();
|
||||||
}
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
TermEvent::ChildExit(_error_code) => {
|
TermEvent::ChildExit(_error_code) => {
|
||||||
|
|
@ -3175,6 +3242,22 @@ impl Application for App {
|
||||||
self.reset_terminal_panes_zoom();
|
self.reset_terminal_panes_zoom();
|
||||||
return self.update_config();
|
return self.update_config();
|
||||||
}
|
}
|
||||||
|
Message::ContextMenuPopupClosed(id) => {
|
||||||
|
if let Some((popup_id, pane, entity, _, _, _)) = &self.context_menu_popup
|
||||||
|
&& id == *popup_id
|
||||||
|
{
|
||||||
|
// Clear link underline on the terminal
|
||||||
|
if let Some(tab_model) = self.pane_model.panes.get(*pane)
|
||||||
|
&& let Some(terminal) = tab_model.data::<Mutex<Terminal>>(*entity)
|
||||||
|
{
|
||||||
|
let mut terminal = terminal.lock().unwrap();
|
||||||
|
terminal.context_menu = None;
|
||||||
|
terminal.active_regex_match = None;
|
||||||
|
terminal.needs_update = true;
|
||||||
|
}
|
||||||
|
self.context_menu_popup = None;
|
||||||
|
}
|
||||||
|
}
|
||||||
Message::Surface(a) => {
|
Message::Surface(a) => {
|
||||||
return cosmic::task::message(cosmic::Action::Cosmic(
|
return cosmic::task::message(cosmic::Action::Cosmic(
|
||||||
cosmic::app::Action::Surface(a),
|
cosmic::app::Action::Surface(a),
|
||||||
|
|
@ -3281,7 +3364,26 @@ impl Application for App {
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn on_close_requested(&self, id: window::Id) -> Option<Self::Message> {
|
||||||
|
if let Some((popup_id, _, _, _, _, _)) = &self.context_menu_popup
|
||||||
|
&& id == *popup_id
|
||||||
|
{
|
||||||
|
return Some(Message::ContextMenuPopupClosed(id));
|
||||||
|
}
|
||||||
|
None
|
||||||
|
}
|
||||||
|
|
||||||
fn view_window(&self, window_id: window::Id) -> Element<'_, Message> {
|
fn view_window(&self, window_id: window::Id) -> Element<'_, Message> {
|
||||||
|
if let Some((popup_id, _pane, entity, ref link, ref autosize_id, _)) =
|
||||||
|
self.context_menu_popup
|
||||||
|
&& window_id == popup_id
|
||||||
|
{
|
||||||
|
return widget::autosize::autosize(
|
||||||
|
menu::context_menu(&self.config, &self.key_binds, entity, link.clone()),
|
||||||
|
autosize_id.clone(),
|
||||||
|
)
|
||||||
|
.into();
|
||||||
|
}
|
||||||
match &self.dialog_opt {
|
match &self.dialog_opt {
|
||||||
Some(dialog) => dialog.view(window_id),
|
Some(dialog) => dialog.view(window_id),
|
||||||
None => widget::text("Unknown window ID").into(),
|
None => widget::text("Unknown window ID").into(),
|
||||||
|
|
@ -3307,7 +3409,19 @@ impl Application for App {
|
||||||
.on_activate(Message::TabActivate)
|
.on_activate(Message::TabActivate)
|
||||||
.on_close(|entity| Message::TabClose(Some(entity))),
|
.on_close(|entity| Message::TabClose(Some(entity))),
|
||||||
)
|
)
|
||||||
.class(style::Container::Background)
|
.class(style::Container::Custom(Box::new(|theme| {
|
||||||
|
let cosmic = theme.cosmic();
|
||||||
|
cosmic::iced::widget::container::Style {
|
||||||
|
icon_color: Some(Color::from(cosmic.background.on)),
|
||||||
|
text_color: Some(Color::from(cosmic.background.on)),
|
||||||
|
background: Some(iced::Background::Color(
|
||||||
|
cosmic.background.base.into(),
|
||||||
|
)),
|
||||||
|
border: iced::Border::default(),
|
||||||
|
shadow: iced::Shadow::default(),
|
||||||
|
snap: true,
|
||||||
|
}
|
||||||
|
})))
|
||||||
.width(Length::Fill),
|
.width(Length::Fill),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -3337,25 +3451,48 @@ impl Application for App {
|
||||||
terminal_box = terminal_box.on_mouse_enter(move || Message::MouseEnter(pane));
|
terminal_box = terminal_box.on_mouse_enter(move || Message::MouseEnter(pane));
|
||||||
}
|
}
|
||||||
|
|
||||||
let context_menu = {
|
// If a context menu popup is active for this pane, inform the
|
||||||
let terminal = terminal.lock().unwrap();
|
// terminal_box so it will emit on_context_menu(None) on click
|
||||||
terminal.context_menu.clone()
|
// to dismiss the popup.
|
||||||
|
if self.context_menu_popup.is_some() {
|
||||||
|
terminal_box = terminal_box.context_menu(cosmic::iced::Point::ORIGIN);
|
||||||
|
}
|
||||||
|
|
||||||
|
let use_wayland_popup = {
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
|
{
|
||||||
|
is_wayland()
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "wayland"))]
|
||||||
|
{
|
||||||
|
false
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let tab_element: Element<'_, Message> = match context_menu {
|
let tab_element: Element<'_, Message> = if !use_wayland_popup {
|
||||||
Some(menu_state) => match menu_state.position {
|
// Fallback: render context menu as an inline popover
|
||||||
Some(point) => widget::popover(terminal_box.context_menu(point))
|
if let Some((_, popup_pane, popup_entity, ref link, _, point)) =
|
||||||
.popup(menu::context_menu(
|
self.context_menu_popup
|
||||||
&self.config,
|
{
|
||||||
&self.key_binds,
|
if pane == popup_pane {
|
||||||
entity,
|
let mut popover = widget::popover(terminal_box.context_menu(point));
|
||||||
menu_state.link,
|
popover = popover
|
||||||
))
|
.popup(menu::context_menu(
|
||||||
.position(widget::popover::Position::Point(point))
|
&self.config,
|
||||||
.into(),
|
&self.key_binds,
|
||||||
None => terminal_box.into(),
|
popup_entity,
|
||||||
},
|
link.clone(),
|
||||||
None => terminal_box.into(),
|
))
|
||||||
|
.position(widget::popover::Position::Point(point));
|
||||||
|
popover.into()
|
||||||
|
} else {
|
||||||
|
terminal_box.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
terminal_box.into()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
terminal_box.into()
|
||||||
};
|
};
|
||||||
tab_column = tab_column.push(tab_element);
|
tab_column = tab_column.push(tab_element);
|
||||||
}
|
}
|
||||||
|
|
@ -3404,7 +3541,7 @@ impl Application for App {
|
||||||
widget::tooltip::Position::Top,
|
widget::tooltip::Position::Top,
|
||||||
)
|
)
|
||||||
.into(),
|
.into(),
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
button::custom(icon_cache_get("window-close-symbolic", 16))
|
button::custom(icon_cache_get("window-close-symbolic", 16))
|
||||||
.on_press(Message::Find(false))
|
.on_press(Message::Find(false))
|
||||||
.padding(space_xxs)
|
.padding(space_xxs)
|
||||||
|
|
@ -3470,22 +3607,24 @@ impl Application for App {
|
||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
}),
|
}),
|
||||||
Subscription::run_with_id(
|
Subscription::run_with(TypeId::of::<TerminalEventSubscription>(), |_| {
|
||||||
TypeId::of::<TerminalEventSubscription>(),
|
stream::channel(
|
||||||
stream::channel(100, |mut output| async move {
|
100,
|
||||||
let (event_tx, mut event_rx) = mpsc::unbounded_channel();
|
|mut output: iced::futures::channel::mpsc::Sender<Message>| async move {
|
||||||
output.send(Message::TermEventTx(event_tx)).await.unwrap();
|
let (event_tx, mut event_rx) = mpsc::unbounded_channel();
|
||||||
|
output.send(Message::TermEventTx(event_tx)).await.unwrap();
|
||||||
|
|
||||||
while let Some((pane, entity, event)) = event_rx.recv().await {
|
while let Some((pane, entity, event)) = event_rx.recv().await {
|
||||||
output
|
output
|
||||||
.send(Message::TermEvent(pane, entity, event))
|
.send(Message::TermEvent(pane, entity, event))
|
||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
panic!("terminal event channel closed");
|
panic!("terminal event channel closed");
|
||||||
}),
|
},
|
||||||
),
|
)
|
||||||
|
}),
|
||||||
cosmic_config::config_subscription(
|
cosmic_config::config_subscription(
|
||||||
TypeId::of::<ConfigSubscription>(),
|
TypeId::of::<ConfigSubscription>(),
|
||||||
Self::APP_ID.into(),
|
Self::APP_ID.into(),
|
||||||
|
|
@ -3499,7 +3638,7 @@ impl Application for App {
|
||||||
update.errors
|
update.errors
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Message::Config(update.config)
|
Message::Config(Box::new(update.config))
|
||||||
}),
|
}),
|
||||||
match &self.dialog_opt {
|
match &self.dialog_opt {
|
||||||
Some(dialog) => dialog.subscription(),
|
Some(dialog) => dialog.subscription(),
|
||||||
|
|
@ -3508,3 +3647,11 @@ impl Application for App {
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "wayland")]
|
||||||
|
fn is_wayland() -> bool {
|
||||||
|
matches!(
|
||||||
|
cosmic::app::cosmic::windowing_system(),
|
||||||
|
Some(cosmic::app::cosmic::WindowingSystem::Wayland)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
|
||||||
13
src/menu.rs
13
src/menu.rs
|
|
@ -1,16 +1,14 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use cosmic::iced::Point;
|
use cosmic::iced::Point;
|
||||||
use cosmic::widget::Column;
|
|
||||||
use cosmic::widget::menu::key_bind::KeyBind;
|
use cosmic::widget::menu::key_bind::KeyBind;
|
||||||
use cosmic::widget::menu::{Item as MenuItem, menu_button};
|
use cosmic::widget::menu::{Item as MenuItem, menu_button};
|
||||||
|
use cosmic::widget::{Column, space};
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Element,
|
Element,
|
||||||
app::Core,
|
app::Core,
|
||||||
iced::{
|
iced::core::Border,
|
||||||
Background, Length, advanced::widget::text::Style as TextStyle, widget::horizontal_space,
|
iced::{Background, Length, advanced::widget::text::Style as TextStyle},
|
||||||
},
|
|
||||||
iced_core::Border,
|
|
||||||
theme,
|
theme,
|
||||||
widget::{
|
widget::{
|
||||||
self, divider,
|
self, divider,
|
||||||
|
|
@ -28,6 +26,7 @@ static MENU_ID: LazyLock<cosmic::widget::Id> =
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct MenuState {
|
pub struct MenuState {
|
||||||
pub position: Option<Point>,
|
pub position: Option<Point>,
|
||||||
|
pub local_position: Option<Point>,
|
||||||
pub link: Option<String>,
|
pub link: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -57,7 +56,7 @@ pub fn context_menu<'a>(
|
||||||
let key = find_key(&action);
|
let key = find_key(&action);
|
||||||
menu_button(vec![
|
menu_button(vec![
|
||||||
widget::text(label).into(),
|
widget::text(label).into(),
|
||||||
horizontal_space().into(),
|
space::horizontal().into(),
|
||||||
widget::text(key)
|
widget::text(key)
|
||||||
.class(theme::Text::Custom(key_style))
|
.class(theme::Text::Custom(key_style))
|
||||||
.into(),
|
.into(),
|
||||||
|
|
@ -68,7 +67,7 @@ pub fn context_menu<'a>(
|
||||||
let menu_checkbox = |label, value, action| {
|
let menu_checkbox = |label, value, action| {
|
||||||
menu_button(vec![
|
menu_button(vec![
|
||||||
widget::text(label).into(),
|
widget::text(label).into(),
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
widget::toggler(value)
|
widget::toggler(value)
|
||||||
.on_toggle(move |_| Message::TabContextAction(entity, action))
|
.on_toggle(move |_| Message::TabContextAction(entity, action))
|
||||||
.size(16.0)
|
.size(16.0)
|
||||||
|
|
|
||||||
|
|
@ -234,10 +234,10 @@ impl PasswordManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't do anything if nothing have changed
|
// Don't do anything if nothing have changed
|
||||||
if let Some(original) = &original {
|
if let Some(original) = &original
|
||||||
if original == &input_state.input {
|
&& original == &input_state.input
|
||||||
return Task::none();
|
{
|
||||||
}
|
return Task::none();
|
||||||
}
|
}
|
||||||
|
|
||||||
cosmic::task::future(async move {
|
cosmic::task::future(async move {
|
||||||
|
|
@ -246,19 +246,14 @@ impl PasswordManager {
|
||||||
"Failed to add password {identifier}: {err}"
|
"Failed to add password {identifier}: {err}"
|
||||||
)))
|
)))
|
||||||
} else {
|
} else {
|
||||||
if let Some(original) = original {
|
if let Some(original) = original
|
||||||
if original.identifier != identifier {
|
&& original.identifier != identifier
|
||||||
if let Err(err) =
|
&& let Err(err) = store::delete_password(original.identifier.clone()).await
|
||||||
store::delete_password(original.identifier.clone()).await
|
{
|
||||||
{
|
return Message::PasswordManager(PasswordManagerMessage::Error(format!(
|
||||||
return Message::PasswordManager(PasswordManagerMessage::Error(
|
"Failed to delete password {}: {err}",
|
||||||
format!(
|
original.identifier
|
||||||
"Failed to delete password {}: {err}",
|
)));
|
||||||
original.identifier
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Message::PasswordManager(PasswordManagerMessage::None)
|
Message::PasswordManager(PasswordManagerMessage::None)
|
||||||
}
|
}
|
||||||
|
|
@ -315,78 +310,74 @@ impl PasswordManager {
|
||||||
.spacing(space_xxs),
|
.spacing(space_xxs),
|
||||||
);
|
);
|
||||||
|
|
||||||
if expanded {
|
if expanded && let Some(input_state) = &self.input_state {
|
||||||
if let Some(input_state) = &self.input_state {
|
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
||||||
let expanded_section: Section<'_, Message> = widget::settings::section().add(
|
widget::column::with_children(vec![
|
||||||
widget::column::with_children(vec![
|
widget::column::with_children(vec![
|
||||||
widget::column::with_children(vec![
|
widget::text(fl!("password-input-description")).into(),
|
||||||
widget::text(fl!("password-input-description")).into(),
|
widget::text_input("", input_state.input.identifier.clone())
|
||||||
widget::text_input("", input_state.input.identifier.clone())
|
|
||||||
.on_input(move |text| {
|
|
||||||
Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::DescriptionInput(text),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.on_submit(move |text| {
|
|
||||||
Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::DescriptionInputAndUpdate(text),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
.on_unfocus(Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::Update,
|
|
||||||
))
|
|
||||||
.into(),
|
|
||||||
])
|
|
||||||
.spacing(space_xxxs)
|
|
||||||
.into(),
|
|
||||||
widget::column::with_children(vec![
|
|
||||||
widget::text(fl!("password-input")).into(),
|
|
||||||
widget::secure_input(
|
|
||||||
"",
|
|
||||||
input_state.input.password.clone(),
|
|
||||||
Some(Message::PasswordManager(
|
|
||||||
PasswordManagerMessage::ToggleShowPassword,
|
|
||||||
)),
|
|
||||||
!input_state.show_password,
|
|
||||||
)
|
|
||||||
.on_input(move |text| {
|
.on_input(move |text| {
|
||||||
Message::PasswordManager(PasswordManagerMessage::PasswordInput(
|
Message::PasswordManager(
|
||||||
text,
|
PasswordManagerMessage::DescriptionInput(text),
|
||||||
))
|
)
|
||||||
})
|
})
|
||||||
.on_submit(move |text| {
|
.on_submit(move |text| {
|
||||||
Message::PasswordManager(
|
Message::PasswordManager(
|
||||||
PasswordManagerMessage::PasswordInputAndUpdate(text),
|
PasswordManagerMessage::DescriptionInputAndUpdate(text),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
.on_unfocus(Message::PasswordManager(
|
.on_unfocus(Message::PasswordManager(
|
||||||
PasswordManagerMessage::Update,
|
PasswordManagerMessage::Update,
|
||||||
))
|
))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.spacing(space_xxxs)
|
.spacing(space_xxxs)
|
||||||
|
.into(),
|
||||||
|
widget::column::with_children(vec![
|
||||||
|
widget::text(fl!("password-input")).into(),
|
||||||
|
widget::secure_input(
|
||||||
|
"",
|
||||||
|
input_state.input.password.clone(),
|
||||||
|
Some(Message::PasswordManager(
|
||||||
|
PasswordManagerMessage::ToggleShowPassword,
|
||||||
|
)),
|
||||||
|
!input_state.show_password,
|
||||||
|
)
|
||||||
|
.on_input(move |text| {
|
||||||
|
Message::PasswordManager(PasswordManagerMessage::PasswordInput(
|
||||||
|
text,
|
||||||
|
))
|
||||||
|
})
|
||||||
|
.on_submit(move |text| {
|
||||||
|
Message::PasswordManager(
|
||||||
|
PasswordManagerMessage::PasswordInputAndUpdate(text),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
.on_unfocus(Message::PasswordManager(PasswordManagerMessage::Update))
|
||||||
.into(),
|
.into(),
|
||||||
])
|
])
|
||||||
.padding([0, space_s])
|
.spacing(space_xxxs)
|
||||||
.spacing(space_xs),
|
.into(),
|
||||||
);
|
])
|
||||||
|
.padding([0, space_s])
|
||||||
|
.spacing(space_xs),
|
||||||
|
);
|
||||||
|
|
||||||
let padding = Padding {
|
let padding = Padding {
|
||||||
top: 0.0,
|
top: 0.0,
|
||||||
bottom: 0.0,
|
bottom: 0.0,
|
||||||
left: space_s.into(),
|
left: space_s.into(),
|
||||||
right: space_s.into(),
|
right: space_s.into(),
|
||||||
};
|
};
|
||||||
|
|
||||||
passwords_section =
|
passwords_section =
|
||||||
passwords_section.add(widget::container(expanded_section).padding(padding))
|
passwords_section.add(widget::container(expanded_section).padding(padding))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sections.push(passwords_section.into());
|
sections.push(passwords_section.into());
|
||||||
|
|
||||||
let add_password = widget::row::with_children(vec![
|
let add_password = widget::row::with_children(vec![
|
||||||
widget::horizontal_space().into(),
|
widget::space::horizontal().into(),
|
||||||
widget::button::standard(fl!("add-password"))
|
widget::button::standard(fl!("add-password"))
|
||||||
.on_press(Message::PasswordManager(PasswordManagerMessage::New))
|
.on_press(Message::PasswordManager(PasswordManagerMessage::New))
|
||||||
.into(),
|
.into(),
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
use cosmic::widget::menu::key_bind::{KeyBind, Modifier};
|
use cosmic::widget::menu::key_bind::{KeyBind, Modifier};
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
|
iced::core::keyboard::key::Named,
|
||||||
iced::keyboard::{Key, Modifiers},
|
iced::keyboard::{Key, Modifiers},
|
||||||
iced_core::keyboard::key::Named,
|
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::collections::{BTreeMap, HashMap};
|
use std::collections::{BTreeMap, HashMap};
|
||||||
|
|
@ -245,11 +245,11 @@ impl ShortcutsConfig {
|
||||||
// Remove any matching bindings
|
// Remove any matching bindings
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if let Some(default_action) = self.defaults.0.get(binding) {
|
if let Some(default_action) = self.defaults.0.get(binding)
|
||||||
if *default_action == reset_action {
|
&& *default_action == reset_action
|
||||||
// Remove binding that overrode a default
|
{
|
||||||
return false;
|
// Remove binding that overrode a default
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -266,6 +266,7 @@ pub struct Terminal {
|
||||||
|
|
||||||
impl Terminal {
|
impl Terminal {
|
||||||
//TODO: error handling
|
//TODO: error handling
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
pub fn new(
|
pub fn new(
|
||||||
pane: pane_grid::Pane,
|
pane: pane_grid::Pane,
|
||||||
entity: segmented_button::Entity,
|
entity: segmented_button::Entity,
|
||||||
|
|
@ -305,13 +306,13 @@ impl Terminal {
|
||||||
let (cell_width, cell_height) = {
|
let (cell_width, cell_height) = {
|
||||||
let mut font_system = font_system().write().unwrap();
|
let mut font_system = font_system().write().unwrap();
|
||||||
let font_system = font_system.raw();
|
let font_system = font_system.raw();
|
||||||
buffer.set_wrap(font_system, Wrap::None);
|
buffer.set_wrap(Wrap::None);
|
||||||
|
|
||||||
// Use size of space to determine cell size
|
// Use size of space to determine cell size
|
||||||
buffer.set_text(font_system, " ", &default_attrs, Shaping::Advanced, None);
|
buffer.set_text(" ", &default_attrs, Shaping::Advanced, None);
|
||||||
let layout = buffer.line_layout(font_system, 0).unwrap();
|
let layout = buffer.line_layout(font_system, 0).unwrap();
|
||||||
let w = layout[0].w;
|
let w = layout[0].w;
|
||||||
buffer.set_monospace_width(font_system, Some(w));
|
buffer.set_monospace_width(Some(w));
|
||||||
(w, metrics.line_height)
|
(w, metrics.line_height)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -457,15 +458,18 @@ impl Terminal {
|
||||||
if width != self.size.width || height != self.size.height {
|
if width != self.size.width || height != self.size.height {
|
||||||
let instant = Instant::now();
|
let instant = Instant::now();
|
||||||
|
|
||||||
self.size.width = width;
|
// Clamp dimensions to ensure at least 1 row and 1 column,
|
||||||
self.size.height = height;
|
// preventing index-out-of-bounds panics in alacritty_terminal.
|
||||||
|
let min_width = self.size.cell_width.ceil() as u32;
|
||||||
|
let min_height = self.size.cell_height.ceil() as u32;
|
||||||
|
self.size.width = width.max(min_width);
|
||||||
|
self.size.height = height.max(min_height);
|
||||||
|
|
||||||
self.notifier.on_resize(self.size.into());
|
self.notifier.on_resize(self.size.into());
|
||||||
self.term.lock().resize(self.size);
|
self.term.lock().resize(self.size);
|
||||||
|
|
||||||
self.with_buffer_mut(|buffer| {
|
self.with_buffer_mut(|buffer| {
|
||||||
let mut font_system = font_system().write().unwrap();
|
buffer.set_size(Some(width as f32), Some(height as f32));
|
||||||
buffer.set_size(font_system.raw(), Some(width as f32), Some(height as f32));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
self.needs_update = true;
|
self.needs_update = true;
|
||||||
|
|
@ -648,10 +652,7 @@ impl Terminal {
|
||||||
|
|
||||||
let metrics = config.metrics(zoom_adj);
|
let metrics = config.metrics(zoom_adj);
|
||||||
if metrics != self.buffer.metrics() {
|
if metrics != self.buffer.metrics() {
|
||||||
{
|
self.with_buffer_mut(|buffer| buffer.set_metrics(metrics));
|
||||||
let mut font_system = font_system().write().unwrap();
|
|
||||||
self.with_buffer_mut(|buffer| buffer.set_metrics(font_system.raw(), metrics));
|
|
||||||
}
|
|
||||||
update_cell_size = true;
|
update_cell_size = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -708,19 +709,13 @@ impl Terminal {
|
||||||
let (cell_width, cell_height) = {
|
let (cell_width, cell_height) = {
|
||||||
let mut font_system = font_system().write().unwrap();
|
let mut font_system = font_system().write().unwrap();
|
||||||
self.with_buffer_mut(|buffer| {
|
self.with_buffer_mut(|buffer| {
|
||||||
buffer.set_wrap(font_system.raw(), Wrap::None);
|
buffer.set_wrap(Wrap::None);
|
||||||
|
|
||||||
// Use size of space to determine cell size
|
// Use size of space to determine cell size
|
||||||
buffer.set_text(
|
buffer.set_text(" ", &default_attrs, Shaping::Advanced, None);
|
||||||
font_system.raw(),
|
|
||||||
" ",
|
|
||||||
&default_attrs,
|
|
||||||
Shaping::Advanced,
|
|
||||||
None,
|
|
||||||
);
|
|
||||||
let layout = buffer.line_layout(font_system.raw(), 0).unwrap();
|
let layout = buffer.line_layout(font_system.raw(), 0).unwrap();
|
||||||
let w = layout[0].w;
|
let w = layout[0].w;
|
||||||
buffer.set_monospace_width(font_system.raw(), Some(w));
|
buffer.set_monospace_width(Some(w));
|
||||||
(w, buffer.metrics().line_height)
|
(w, buffer.metrics().line_height)
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
@ -884,13 +879,12 @@ impl Terminal {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change color if selected
|
// Change color if selected
|
||||||
if let Some(selection) = &term.selection {
|
if let Some(selection) = &term.selection
|
||||||
if let Some(range) = selection.to_range(&term) {
|
&& let Some(range) = selection.to_range(&term)
|
||||||
if range.contains(indexed.point) {
|
&& range.contains(indexed.point)
|
||||||
//TODO: better handling of selection
|
{
|
||||||
mem::swap(&mut fg, &mut bg);
|
//TODO: better handling of selection
|
||||||
}
|
mem::swap(&mut fg, &mut bg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert foreground to linear
|
// Convert foreground to linear
|
||||||
|
|
@ -904,10 +898,10 @@ impl Terminal {
|
||||||
|
|
||||||
let mut flags = indexed.cell.flags;
|
let mut flags = indexed.cell.flags;
|
||||||
|
|
||||||
if let Some(active_match) = &self.active_regex_match {
|
if let Some(active_match) = &self.active_regex_match
|
||||||
if active_match.contains(&indexed.point) {
|
&& active_match.contains(&indexed.point)
|
||||||
flags |= Flags::UNDERLINE;
|
{
|
||||||
}
|
flags |= Flags::UNDERLINE;
|
||||||
}
|
}
|
||||||
if let Some(active_id) = &self.active_hyperlink_id {
|
if let Some(active_id) = &self.active_hyperlink_id {
|
||||||
let mut matches_active = indexed
|
let mut matches_active = indexed
|
||||||
|
|
@ -1216,13 +1210,12 @@ impl<'a, T> Iterator for HintPostProcessor<'a, T> {
|
||||||
fn next(&mut self) -> Option<Self::Item> {
|
fn next(&mut self) -> Option<Self::Item> {
|
||||||
let next_match = self.next_match.take()?;
|
let next_match = self.next_match.take()?;
|
||||||
|
|
||||||
if self.start <= self.end {
|
if self.start <= self.end
|
||||||
if let Some(rm) = self
|
&& let Some(rm) = self
|
||||||
.term
|
.term
|
||||||
.regex_search_right(self.regex, self.start, self.end)
|
.regex_search_right(self.regex, self.start, self.end)
|
||||||
{
|
{
|
||||||
self.next_processed_match(rm);
|
self.next_processed_match(rm);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(next_match)
|
Some(next_match)
|
||||||
|
|
|
||||||
|
|
@ -7,19 +7,10 @@ use alacritty_terminal::{
|
||||||
term::{TermMode, cell::Flags},
|
term::{TermMode, cell::Flags},
|
||||||
vte::ansi::{CursorShape, NamedColor},
|
vte::ansi::{CursorShape, NamedColor},
|
||||||
};
|
};
|
||||||
use cosmic::widget::menu::key_bind::KeyBind;
|
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
Renderer,
|
Renderer,
|
||||||
cosmic_theme::palette::{WithAlpha, blend::Compose},
|
cosmic_theme::palette::{WithAlpha, blend::Compose},
|
||||||
iced::{
|
iced::core::{
|
||||||
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
|
||||||
advanced::graphics::text::Raw,
|
|
||||||
event::{Event, Status},
|
|
||||||
keyboard::{Event as KeyEvent, Key, Modifiers},
|
|
||||||
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
|
||||||
window::RedrawRequest,
|
|
||||||
},
|
|
||||||
iced_core::{
|
|
||||||
Border, Shell,
|
Border, Shell,
|
||||||
clipboard::Clipboard,
|
clipboard::Clipboard,
|
||||||
keyboard::key::Named,
|
keyboard::key::Named,
|
||||||
|
|
@ -32,8 +23,16 @@ use cosmic::{
|
||||||
tree,
|
tree,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
iced::{
|
||||||
|
Color, Element, Length, Padding, Point, Rectangle, Size, Vector,
|
||||||
|
advanced::graphics::text::Raw,
|
||||||
|
event::Event,
|
||||||
|
keyboard::{Event as KeyEvent, Key, Modifiers},
|
||||||
|
mouse::{self, Button, Event as MouseEvent, ScrollDelta},
|
||||||
|
},
|
||||||
theme::Theme,
|
theme::Theme,
|
||||||
};
|
};
|
||||||
|
use cosmic::{iced::core::SmolStr, widget::menu::key_bind::KeyBind};
|
||||||
use cosmic_text::LayoutGlyph;
|
use cosmic_text::LayoutGlyph;
|
||||||
use indexmap::IndexSet;
|
use indexmap::IndexSet;
|
||||||
use std::{
|
use std::{
|
||||||
|
|
@ -263,7 +262,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn layout(
|
fn layout(
|
||||||
&self,
|
&mut self,
|
||||||
_tree: &mut widget::Tree,
|
_tree: &mut widget::Tree,
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
limits: &layout::Limits,
|
limits: &layout::Limits,
|
||||||
|
|
@ -297,15 +296,15 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
fn operate(
|
fn operate(
|
||||||
&self,
|
&mut self,
|
||||||
tree: &mut widget::Tree,
|
tree: &mut widget::Tree,
|
||||||
_layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
operation: &mut dyn Operation,
|
operation: &mut dyn Operation,
|
||||||
) {
|
) {
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
|
|
||||||
operation.focusable(state, self.id.as_ref());
|
operation.focusable(self.id.as_ref(), layout.bounds(), state);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn mouse_interaction(
|
fn mouse_interaction(
|
||||||
|
|
@ -316,6 +315,9 @@ where
|
||||||
_viewport: &Rectangle,
|
_viewport: &Rectangle,
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
) -> mouse::Interaction {
|
) -> mouse::Interaction {
|
||||||
|
if self.disabled {
|
||||||
|
return mouse::Interaction::default();
|
||||||
|
}
|
||||||
let state = tree.state.downcast_ref::<State>();
|
let state = tree.state.downcast_ref::<State>();
|
||||||
|
|
||||||
if let Some(Dragging::Scrollbar { .. }) = &state.dragging {
|
if let Some(Dragging::Scrollbar { .. }) = &state.dragging {
|
||||||
|
|
@ -348,7 +350,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mouse::Interaction::Idle
|
mouse::Interaction::default()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw(
|
fn draw(
|
||||||
|
|
@ -377,13 +379,41 @@ where
|
||||||
|
|
||||||
let view_position = layout.position() + [self.padding.left, self.padding.top].into();
|
let view_position = layout.position() + [self.padding.left, self.padding.top].into();
|
||||||
let view_w = cmp::min(viewport.width as i32, layout.bounds().width as i32)
|
let view_w = cmp::min(viewport.width as i32, layout.bounds().width as i32)
|
||||||
- self.padding.horizontal() as i32
|
- self.padding.x() as i32
|
||||||
- scrollbar_w as i32;
|
- scrollbar_w as i32;
|
||||||
let view_h = cmp::min(viewport.height as i32, layout.bounds().height as i32)
|
let view_h = cmp::min(viewport.height as i32, layout.bounds().height as i32)
|
||||||
- self.padding.vertical() as i32;
|
- self.padding.y() as i32;
|
||||||
|
|
||||||
if view_w <= 0 || view_h <= 0 {
|
if view_w <= 0 || view_h <= 0 {
|
||||||
// Zero sized image
|
// Pane too small for content, but still fill background
|
||||||
|
let terminal = self.terminal.lock().unwrap();
|
||||||
|
let meta = &terminal.metadata_set[terminal.default_attrs().metadata];
|
||||||
|
let background_color = shade(meta.bg, state.is_focused && !self.disabled);
|
||||||
|
renderer.fill_quad(
|
||||||
|
Quad {
|
||||||
|
bounds: layout.bounds(),
|
||||||
|
border: Border {
|
||||||
|
radius: if self.show_headerbar {
|
||||||
|
[0.0, 0.0, corner_radius[2], corner_radius[3]].into()
|
||||||
|
} else {
|
||||||
|
corner_radius.into()
|
||||||
|
},
|
||||||
|
width: self.border.width,
|
||||||
|
color: self.border.color,
|
||||||
|
},
|
||||||
|
snap: true,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
Color::from_rgba(
|
||||||
|
f32::from(background_color.r()) / 255.0,
|
||||||
|
f32::from(background_color.g()) / 255.0,
|
||||||
|
f32::from(background_color.b()) / 255.0,
|
||||||
|
match self.opacity {
|
||||||
|
Some(opacity) => opacity,
|
||||||
|
None => f32::from(background_color.a()) / 255.0,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -415,9 +445,10 @@ where
|
||||||
width: self.border.width,
|
width: self.border.width,
|
||||||
color: self.border.color,
|
color: self.border.color,
|
||||||
},
|
},
|
||||||
|
snap: true,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
Color::new(
|
Color::from_rgba(
|
||||||
f32::from(background_color.r()) / 255.0,
|
f32::from(background_color.r()) / 255.0,
|
||||||
f32::from(background_color.g()) / 255.0,
|
f32::from(background_color.g()) / 255.0,
|
||||||
f32::from(background_color.b()) / 255.0,
|
f32::from(background_color.b()) / 255.0,
|
||||||
|
|
@ -468,7 +499,7 @@ where
|
||||||
is_focused: bool,
|
is_focused: bool,
|
||||||
) {
|
) {
|
||||||
let cosmic_text_to_iced_color = |color: cosmic_text::Color| {
|
let cosmic_text_to_iced_color = |color: cosmic_text::Color| {
|
||||||
Color::new(
|
Color::from_rgba(
|
||||||
f32::from(color.r()) / 255.0,
|
f32::from(color.r()) / 255.0,
|
||||||
f32::from(color.g()) / 255.0,
|
f32::from(color.g()) / 255.0,
|
||||||
f32::from(color.b()) / 255.0,
|
f32::from(color.b()) / 255.0,
|
||||||
|
|
@ -645,7 +676,7 @@ where
|
||||||
renderer.fill_raw(Raw {
|
renderer.fill_raw(Raw {
|
||||||
buffer: terminal.buffer_weak(),
|
buffer: terminal.buffer_weak(),
|
||||||
position: view_position,
|
position: view_position,
|
||||||
color: Color::new(1.0, 1.0, 1.0, 1.0), // TODO
|
color: Color::from_rgba(1.0, 1.0, 1.0, 1.0), // TODO
|
||||||
clip_bounds: Rectangle::new(view_position, Size::new(view_w as f32, view_h as f32)),
|
clip_bounds: Rectangle::new(view_position, Size::new(view_w as f32, view_h as f32)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -799,19 +830,19 @@ where
|
||||||
log::trace!("redraw {}, {}: {:?}", view_w, view_h, duration);
|
log::trace!("redraw {}, {}: {:?}", view_w, view_h, duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_event(
|
fn update(
|
||||||
&mut self,
|
&mut self,
|
||||||
tree: &mut widget::Tree,
|
tree: &mut widget::Tree,
|
||||||
event: Event,
|
event: &Event,
|
||||||
layout: Layout<'_>,
|
layout: Layout<'_>,
|
||||||
cursor_position: mouse::Cursor,
|
cursor_position: mouse::Cursor,
|
||||||
_renderer: &Renderer,
|
_renderer: &Renderer,
|
||||||
_clipboard: &mut dyn Clipboard,
|
_clipboard: &mut dyn Clipboard,
|
||||||
shell: &mut Shell<'_, Message>,
|
shell: &mut Shell<'_, Message>,
|
||||||
_viewport: &Rectangle<f32>,
|
_viewport: &Rectangle<f32>,
|
||||||
) -> Status {
|
) {
|
||||||
if self.disabled {
|
if self.disabled {
|
||||||
return Status::Ignored;
|
return;
|
||||||
}
|
}
|
||||||
let state = tree.state.downcast_mut::<State>();
|
let state = tree.state.downcast_mut::<State>();
|
||||||
let scrollbar_rect = state.scrollbar_rect.get();
|
let scrollbar_rect = state.scrollbar_rect.get();
|
||||||
|
|
@ -820,7 +851,6 @@ where
|
||||||
|
|
||||||
let is_app_cursor = terminal.term.lock().mode().contains(TermMode::APP_CURSOR);
|
let is_app_cursor = terminal.term.lock().mode().contains(TermMode::APP_CURSOR);
|
||||||
let is_mouse_mode = terminal.term.lock().mode().intersects(TermMode::MOUSE_MODE);
|
let is_mouse_mode = terminal.term.lock().mode().intersects(TermMode::MOUSE_MODE);
|
||||||
let mut status = Status::Ignored;
|
|
||||||
match event {
|
match event {
|
||||||
Event::Window(event) => match event {
|
Event::Window(event) => match event {
|
||||||
cosmic::iced::window::Event::Focused => {
|
cosmic::iced::window::Event::Focused => {
|
||||||
|
|
@ -832,8 +862,8 @@ where
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
} else {
|
} else {
|
||||||
if let Some((pointer, multiplier)) = state.autoscroll.next_due() {
|
if let Some((pointer, multiplier)) = state.autoscroll.next_due()
|
||||||
if update_buffer_drag(
|
&& update_buffer_drag(
|
||||||
state,
|
state,
|
||||||
&mut terminal,
|
&mut terminal,
|
||||||
buffer_size,
|
buffer_size,
|
||||||
|
|
@ -841,12 +871,12 @@ where
|
||||||
layout.bounds(),
|
layout.bounds(),
|
||||||
self.padding,
|
self.padding,
|
||||||
multiplier,
|
multiplier,
|
||||||
) {
|
)
|
||||||
status = Status::Captured;
|
{
|
||||||
}
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
if state.autoscroll.is_active() {
|
if state.autoscroll.is_active() {
|
||||||
shell.request_redraw(RedrawRequest::NextFrame);
|
shell.request_redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -867,8 +897,9 @@ where
|
||||||
..
|
..
|
||||||
}) if state.is_focused && named == modified_named => {
|
}) if state.is_focused && named == modified_named => {
|
||||||
for key_bind in self.key_binds.keys() {
|
for key_bind in self.key_binds.keys() {
|
||||||
if key_bind.matches(modifiers, &Key::Named(named)) {
|
if key_bind.matches(*modifiers, &Key::Named(*named)) {
|
||||||
return Status::Captured;
|
shell.capture_event();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -956,7 +987,9 @@ where
|
||||||
};
|
};
|
||||||
if let Some(escape_code) = escape_code {
|
if let Some(escape_code) = escape_code {
|
||||||
terminal.input_scroll(escape_code);
|
terminal.input_scroll(escape_code);
|
||||||
return Status::Captured;
|
shell.capture_event();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Special handle Enter, Escape, Backspace and Tab as described in
|
//Special handle Enter, Escape, Backspace and Tab as described in
|
||||||
|
|
@ -967,11 +1000,11 @@ where
|
||||||
Named::Backspace => {
|
Named::Backspace => {
|
||||||
let code = if modifiers.control() { "\x08" } else { "\x7f" };
|
let code = if modifiers.control() { "\x08" } else { "\x7f" };
|
||||||
terminal.input_scroll(format!("{alt_prefix}{code}").into_bytes());
|
terminal.input_scroll(format!("{alt_prefix}{code}").into_bytes());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
Named::Enter => {
|
Named::Enter => {
|
||||||
terminal.input_scroll(format!("{}{}", alt_prefix, "\x0D").into_bytes());
|
terminal.input_scroll(format!("{}{}", alt_prefix, "\x0D").into_bytes());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
Named::Escape => {
|
Named::Escape => {
|
||||||
//Escape with any modifier will cancel selection
|
//Escape with any modifier will cancel selection
|
||||||
|
|
@ -984,31 +1017,19 @@ where
|
||||||
} else {
|
} else {
|
||||||
terminal.input_scroll(format!("{}{}", alt_prefix, "\x1B").into_bytes());
|
terminal.input_scroll(format!("{}{}", alt_prefix, "\x1B").into_bytes());
|
||||||
}
|
}
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
Named::Space => {
|
|
||||||
// Keep this instead of hardcoding the space to allow for dead keys
|
|
||||||
let character = text.and_then(|c| c.chars().next()).unwrap_or_default();
|
|
||||||
|
|
||||||
if modifiers.control() {
|
|
||||||
// Send NUL character (\x00) for Ctrl + Space
|
|
||||||
terminal.input_scroll(b"\x00".to_vec());
|
|
||||||
} else {
|
|
||||||
terminal
|
|
||||||
.input_scroll(format!("{}{}", alt_prefix, character).into_bytes());
|
|
||||||
}
|
|
||||||
status = Status::Captured;
|
|
||||||
}
|
|
||||||
Named::Tab => {
|
Named::Tab => {
|
||||||
let code = if modifiers.shift() { "\x1b[Z" } else { "\x09" };
|
let code = if modifiers.shift() { "\x1b[Z" } else { "\x09" };
|
||||||
terminal.input_scroll(format!("{alt_prefix}{code}").into_bytes());
|
terminal.input_scroll(format!("{alt_prefix}{code}").into_bytes());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
Event::Keyboard(KeyEvent::ModifiersChanged(modifiers)) => {
|
||||||
state.modifiers = modifiers;
|
state.modifiers = *modifiers;
|
||||||
|
|
||||||
if modifiers.contains(Modifiers::CTRL)
|
if modifiers.contains(Modifiers::CTRL)
|
||||||
|| terminal.active_regex_match.is_some()
|
|| terminal.active_regex_match.is_some()
|
||||||
|
|
@ -1032,6 +1053,31 @@ where
|
||||||
update_active_regex_match(&mut terminal, location, Some(&state.modifiers));
|
update_active_regex_match(&mut terminal, location, Some(&state.modifiers));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
|
text,
|
||||||
|
modifiers,
|
||||||
|
key,
|
||||||
|
..
|
||||||
|
}) if state.is_focused && *key == Key::Character(SmolStr::new(" ")) => {
|
||||||
|
//Special handle Enter, Escape, Backspace and Tab as described in
|
||||||
|
//https://sw.kovidgoyal.net/kitty/keyboard-protocol/#legacy-key-event-encoding
|
||||||
|
//Also special handle Ctrl-_ to behave like xterm
|
||||||
|
let alt_prefix = if modifiers.alt() { "\x1B" } else { "" };
|
||||||
|
|
||||||
|
// Keep this instead of hardcoding the space to allow for dead keys
|
||||||
|
let character = text
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|c| c.chars().next())
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
|
if modifiers.control() {
|
||||||
|
// Send NUL character (\x00) for Ctrl + Space
|
||||||
|
terminal.input_scroll(b"\x00".to_vec());
|
||||||
|
} else {
|
||||||
|
terminal.input_scroll(format!("{}{}", alt_prefix, character).into_bytes());
|
||||||
|
}
|
||||||
|
shell.capture_event();
|
||||||
|
}
|
||||||
Event::Keyboard(KeyEvent::KeyPressed {
|
Event::Keyboard(KeyEvent::KeyPressed {
|
||||||
text,
|
text,
|
||||||
modifiers,
|
modifiers,
|
||||||
|
|
@ -1039,11 +1085,16 @@ where
|
||||||
..
|
..
|
||||||
}) if state.is_focused => {
|
}) if state.is_focused => {
|
||||||
for key_bind in self.key_binds.keys() {
|
for key_bind in self.key_binds.keys() {
|
||||||
if key_bind.matches(modifiers, &key) {
|
if key_bind.matches(*modifiers, key) {
|
||||||
return Status::Captured;
|
shell.capture_event();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let character = text.and_then(|c| c.chars().next()).unwrap_or_default();
|
let character = text
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|c| c.chars().next())
|
||||||
|
.unwrap_or_default();
|
||||||
match (
|
match (
|
||||||
modifiers.logo(),
|
modifiers.logo(),
|
||||||
modifiers.control(),
|
modifiers.control(),
|
||||||
|
|
@ -1064,7 +1115,7 @@ where
|
||||||
str.len() + 1
|
str.len() + 1
|
||||||
};
|
};
|
||||||
terminal.input_scroll(buf[..len].to_vec());
|
terminal.input_scroll(buf[..len].to_vec());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(false, true, _, false) => {
|
(false, true, _, false) => {
|
||||||
|
|
@ -1073,7 +1124,7 @@ where
|
||||||
let mut buf = [0, 0, 0, 0];
|
let mut buf = [0, 0, 0, 0];
|
||||||
let str = character.encode_utf8(&mut buf);
|
let str = character.encode_utf8(&mut buf);
|
||||||
terminal.input_scroll(str.as_bytes().to_vec());
|
terminal.input_scroll(str.as_bytes().to_vec());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(false, true, _, true) => {
|
(false, true, _, true) => {
|
||||||
|
|
@ -1081,9 +1132,9 @@ where
|
||||||
//is taken by zoom, we send that code for
|
//is taken by zoom, we send that code for
|
||||||
//Ctrl+Underline instead, like xterm and
|
//Ctrl+Underline instead, like xterm and
|
||||||
//gnome-terminal
|
//gnome-terminal
|
||||||
if key == Key::Character("_".into()) {
|
if *key == Key::Character("_".into()) {
|
||||||
terminal.input_scroll(b"\x1F".as_slice());
|
terminal.input_scroll(b"\x1F".as_slice());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(false, false, true, _) => {
|
(false, false, true, _) => {
|
||||||
|
|
@ -1095,7 +1146,7 @@ where
|
||||||
str.len() + 1
|
str.len() + 1
|
||||||
};
|
};
|
||||||
terminal.input_scroll(buf[..len].to_vec());
|
terminal.input_scroll(buf[..len].to_vec());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
(false, false, false, _) => {
|
(false, false, false, _) => {
|
||||||
|
|
@ -1104,7 +1155,7 @@ where
|
||||||
let mut buf = [0, 0, 0, 0];
|
let mut buf = [0, 0, 0, 0];
|
||||||
let str = character.encode_utf8(&mut buf);
|
let str = character.encode_utf8(&mut buf);
|
||||||
terminal.input_scroll(str.as_bytes().to_vec());
|
terminal.input_scroll(str.as_bytes().to_vec());
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1119,7 +1170,12 @@ where
|
||||||
|
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
|
terminal.report_mouse(
|
||||||
|
event.clone(),
|
||||||
|
&state.modifiers,
|
||||||
|
col as u32,
|
||||||
|
row as u32,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
state.is_focused = true;
|
state.is_focused = true;
|
||||||
|
|
||||||
|
|
@ -1214,7 +1270,7 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if button == Button::Middle {
|
} else if *button == Button::Middle {
|
||||||
if let Some(on_middle_click) = &self.on_middle_click {
|
if let Some(on_middle_click) = &self.on_middle_click {
|
||||||
shell.publish(on_middle_click());
|
shell.publish(on_middle_click());
|
||||||
}
|
}
|
||||||
|
|
@ -1226,7 +1282,7 @@ where
|
||||||
shell.publish(on_context_menu(None));
|
shell.publish(on_context_menu(None));
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
if button == Button::Right {
|
if *button == Button::Right {
|
||||||
let x = p.x - self.padding.left;
|
let x = p.x - self.padding.left;
|
||||||
let y = p.y - self.padding.top;
|
let y = p.y - self.padding.top;
|
||||||
//TODO: better calculation of position
|
//TODO: better calculation of position
|
||||||
|
|
@ -1243,35 +1299,39 @@ where
|
||||||
None,
|
None,
|
||||||
);
|
);
|
||||||
let link = get_hyperlink(&terminal, location);
|
let link = get_hyperlink(&terminal, location);
|
||||||
|
let abs = cosmic::iced::Point::new(
|
||||||
|
layout.bounds().x + p.x,
|
||||||
|
layout.bounds().y + p.y,
|
||||||
|
);
|
||||||
shell.publish(on_context_menu(Some(MenuState {
|
shell.publish(on_context_menu(Some(MenuState {
|
||||||
position: Some(p),
|
position: Some(abs),
|
||||||
|
local_position: Some(p),
|
||||||
link,
|
link,
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Mouse(MouseEvent::ButtonReleased(Button::Left)) => {
|
Event::Mouse(MouseEvent::ButtonReleased(Button::Left)) => {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
if let Some(dragging) = state.dragging.take() {
|
if let Some(dragging) = state.dragging.take()
|
||||||
if let Dragging::Buffer {
|
&& let Dragging::Buffer {
|
||||||
last_point,
|
last_point,
|
||||||
last_side,
|
last_side,
|
||||||
..
|
..
|
||||||
} = dragging
|
} = dragging
|
||||||
|
{
|
||||||
{
|
{
|
||||||
{
|
let mut term = terminal.term.lock();
|
||||||
let mut term = terminal.term.lock();
|
if let Some(selection) = &mut term.selection {
|
||||||
if let Some(selection) = &mut term.selection {
|
selection.update(last_point, last_side);
|
||||||
selection.update(last_point, last_side);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
terminal.needs_update = true;
|
|
||||||
}
|
}
|
||||||
|
terminal.needs_update = true;
|
||||||
}
|
}
|
||||||
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
if let Some(p) = cursor_position.position_in(layout.bounds()) {
|
||||||
let x = p.x - self.padding.left;
|
let x = p.x - self.padding.left;
|
||||||
|
|
@ -1282,22 +1342,24 @@ where
|
||||||
|
|
||||||
let location = terminal
|
let location = terminal
|
||||||
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
|
.viewport_to_point(TermPoint::new(row as usize, TermColumn(col as usize)));
|
||||||
if state.modifiers.control() {
|
if state.modifiers.control()
|
||||||
if let Some(on_open_hyperlink) = &self.on_open_hyperlink {
|
&& let Some(on_open_hyperlink) = &self.on_open_hyperlink
|
||||||
if let Some(hyperlink) = get_hyperlink(&terminal, location) {
|
&& let Some(hyperlink) = get_hyperlink(&terminal, location)
|
||||||
shell.publish(on_open_hyperlink(hyperlink));
|
{
|
||||||
status = Status::Captured;
|
shell.publish(on_open_hyperlink(hyperlink));
|
||||||
}
|
shell.capture_event();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
|
terminal.report_mouse(
|
||||||
|
event.clone(),
|
||||||
|
&state.modifiers,
|
||||||
|
col as u32,
|
||||||
|
row as u32,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
status = Status::Captured;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::Mouse(MouseEvent::ButtonReleased(_button)) => {
|
Event::Mouse(MouseEvent::ButtonReleased(_button)) => {
|
||||||
|
|
@ -1309,7 +1371,12 @@ where
|
||||||
let col = x / terminal.size().cell_width;
|
let col = x / terminal.size().cell_width;
|
||||||
let row = y / terminal.size().cell_height;
|
let row = y / terminal.size().cell_height;
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
|
terminal.report_mouse(
|
||||||
|
event.clone(),
|
||||||
|
&state.modifiers,
|
||||||
|
col as u32,
|
||||||
|
row as u32,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1351,7 +1418,12 @@ where
|
||||||
|
|
||||||
if is_mouse_mode {
|
if is_mouse_mode {
|
||||||
if let Some((col, row)) = col_row_opt {
|
if let Some((col, row)) = col_row_opt {
|
||||||
terminal.report_mouse(event, &state.modifiers, col as u32, row as u32);
|
terminal.report_mouse(
|
||||||
|
event.clone(),
|
||||||
|
&state.modifiers,
|
||||||
|
col as u32,
|
||||||
|
row as u32,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let handled_buffer_drag = update_buffer_drag(
|
let handled_buffer_drag = update_buffer_drag(
|
||||||
|
|
@ -1364,7 +1436,7 @@ where
|
||||||
0.0,
|
0.0,
|
||||||
);
|
);
|
||||||
if handled_buffer_drag {
|
if handled_buffer_drag {
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
} else if let Some(Dragging::Scrollbar {
|
} else if let Some(Dragging::Scrollbar {
|
||||||
start_y,
|
start_y,
|
||||||
start_scroll,
|
start_scroll,
|
||||||
|
|
@ -1377,7 +1449,7 @@ where
|
||||||
(y - start_y) / buffer.size().1.unwrap_or(1.0)
|
(y - start_y) / buffer.size().1.unwrap_or(1.0)
|
||||||
});
|
});
|
||||||
terminal.scroll_to(start_scroll.0 + scroll_offset);
|
terminal.scroll_to(start_scroll.0 + scroll_offset);
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
|
|
||||||
if matches!(state.dragging, Some(Dragging::Buffer { .. })) {
|
if matches!(state.dragging, Some(Dragging::Buffer { .. })) {
|
||||||
|
|
@ -1389,7 +1461,7 @@ where
|
||||||
} else {
|
} else {
|
||||||
state.autoscroll.start(p_global);
|
state.autoscroll.start(p_global);
|
||||||
}
|
}
|
||||||
shell.request_redraw(RedrawRequest::NextFrame);
|
shell.request_redraw();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
state.autoscroll.stop();
|
state.autoscroll.stop();
|
||||||
|
|
@ -1405,15 +1477,15 @@ where
|
||||||
//TODO: better calculation of position
|
//TODO: better calculation of position
|
||||||
let col = x / terminal.size().cell_width;
|
let col = x / terminal.size().cell_width;
|
||||||
let row = y / terminal.size().cell_height;
|
let row = y / terminal.size().cell_height;
|
||||||
terminal.scroll_mouse(delta, &state.modifiers, col as u32, row as u32);
|
terminal.scroll_mouse(*delta, &state.modifiers, col as u32, row as u32);
|
||||||
} else if terminal.term.lock().mode().contains(TermMode::ALT_SCREEN) {
|
} else if terminal.term.lock().mode().contains(TermMode::ALT_SCREEN) {
|
||||||
MouseReporter::report_mouse_wheel_as_arrows(
|
MouseReporter::report_mouse_wheel_as_arrows(
|
||||||
&terminal,
|
&terminal,
|
||||||
terminal.size().cell_width,
|
terminal.size().cell_width,
|
||||||
terminal.size().cell_height,
|
terminal.size().cell_height,
|
||||||
delta,
|
*delta,
|
||||||
);
|
);
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
} else {
|
} else {
|
||||||
match delta {
|
match delta {
|
||||||
ScrollDelta::Lines { x: _, y } => {
|
ScrollDelta::Lines { x: _, y } => {
|
||||||
|
|
@ -1423,7 +1495,7 @@ where
|
||||||
if lines != 0 {
|
if lines != 0 {
|
||||||
terminal.scroll(TerminalScroll::Delta(-lines));
|
terminal.scroll(TerminalScroll::Delta(-lines));
|
||||||
}
|
}
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
ScrollDelta::Pixels { x: _, y } => {
|
ScrollDelta::Pixels { x: _, y } => {
|
||||||
//TODO: this adjustment is just a guess!
|
//TODO: this adjustment is just a guess!
|
||||||
|
|
@ -1441,7 +1513,7 @@ where
|
||||||
if lines != 0 {
|
if lines != 0 {
|
||||||
terminal.scroll(TerminalScroll::Delta(-lines));
|
terminal.scroll(TerminalScroll::Delta(-lines));
|
||||||
}
|
}
|
||||||
status = Status::Captured;
|
shell.capture_event();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1466,8 +1538,6 @@ where
|
||||||
}
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
|
|
||||||
status
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1580,10 +1650,10 @@ fn update_active_regex_match(
|
||||||
.find(|bounds| bounds.contains(&location))
|
.find(|bounds| bounds.contains(&location))
|
||||||
{
|
{
|
||||||
'update: {
|
'update: {
|
||||||
if let Some(active_match) = &terminal.active_regex_match {
|
if let Some(active_match) = &terminal.active_regex_match
|
||||||
if active_match == match_ {
|
&& active_match == match_
|
||||||
break 'update;
|
{
|
||||||
}
|
break 'update;
|
||||||
}
|
}
|
||||||
terminal.active_regex_match = Some(match_.clone());
|
terminal.active_regex_match = Some(match_.clone());
|
||||||
terminal.needs_update = true;
|
terminal.needs_update = true;
|
||||||
|
|
@ -1644,6 +1714,7 @@ enum EdgeScrollDirection {
|
||||||
Bottom,
|
Bottom,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
fn edge_scroll_adjustment(
|
fn edge_scroll_adjustment(
|
||||||
y: f32,
|
y: f32,
|
||||||
buffer_height: f32,
|
buffer_height: f32,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue