Merge branch 'master' into primary
This commit is contained in:
commit
59a6a8a12e
16 changed files with 876 additions and 1137 deletions
19
.github/workflows/flakehub-publish-rolling.yml
vendored
Normal file
19
.github/workflows/flakehub-publish-rolling.yml
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
name: "Publish every Git push to master to FlakeHub"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- "master"
|
||||
jobs:
|
||||
flakehub-publish:
|
||||
runs-on: "ubuntu-latest"
|
||||
permissions:
|
||||
id-token: "write"
|
||||
contents: "read"
|
||||
steps:
|
||||
- uses: "actions/checkout@v3"
|
||||
- uses: "DeterminateSystems/nix-installer-action@main"
|
||||
- uses: "DeterminateSystems/flakehub-push@main"
|
||||
with:
|
||||
name: "pop-os/cosmic-term"
|
||||
rolling: true
|
||||
visibility: "public"
|
||||
1323
Cargo.lock
generated
1323
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
1
debian/control
vendored
1
debian/control
vendored
|
|
@ -4,6 +4,7 @@ Priority: optional
|
|||
Maintainer: Jeremy Soller <jeremy@system76.com>
|
||||
Build-Depends:
|
||||
debhelper-compat (=13),
|
||||
git,
|
||||
just (>= 1.13.0),
|
||||
pkg-config,
|
||||
rust-all,
|
||||
|
|
|
|||
96
i18n/es-ES/cosmic_term.ftl
Normal file
96
i18n/es-ES/cosmic_term.ftl
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
cosmic-terminal = Terminal COSMIC
|
||||
new-terminal = Nuevo terminal
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Commit de Git {$hash} el {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Esquemas de color
|
||||
rename = Renombrar
|
||||
export = Exportar
|
||||
delete = Borrar
|
||||
import = Importar
|
||||
import-errors = Errores de importación
|
||||
|
||||
## Profiles
|
||||
profiles = Perfiles
|
||||
name = Nombre
|
||||
command-line = Línea de comando
|
||||
tab-title = Título de pestaña
|
||||
tab-title-description = Cambiar el título por defecto de la pestaña
|
||||
add-profile = Añadir perfil
|
||||
new-profile = Nuevo perfil
|
||||
make-default = Impostar como defecto
|
||||
|
||||
## Settings
|
||||
settings = Ajustes
|
||||
|
||||
### Appearance
|
||||
appearance = Apariencia
|
||||
theme = Tema
|
||||
match-desktop = Automático
|
||||
dark = Obscuro
|
||||
light = Claro
|
||||
syntax-dark = Esquema de color obscura
|
||||
syntax-light = Esquema de color clara
|
||||
default-zoom-step = Pasos de zoom
|
||||
opacity = Opacidad del fondo
|
||||
|
||||
### Font
|
||||
font = Fuente
|
||||
advanced-font-settings = Ajustes avanzados del fuente
|
||||
default-font = Fuente
|
||||
default-font-size = Tamaño del fuente
|
||||
default-font-stretch = Anchura del fuente
|
||||
default-font-weight = Peso del fuente normal
|
||||
default-dim-font-weight = Peso del fuente delgado
|
||||
default-bold-font-weight = Peso del fuente en negritas
|
||||
use-bright-bold = Mostrar negritas en colores claros
|
||||
|
||||
### Splits
|
||||
splits = Splits
|
||||
focus-follow-mouse = Enfoque del tecleo sigue el ratón
|
||||
|
||||
### Advanced
|
||||
advanced = Advanzado
|
||||
show-headerbar = Mostrar encabezado
|
||||
show-header-description = Mostrar el encabezado desde el menú del clic secundario.
|
||||
|
||||
# Find
|
||||
find-placeholder = Buscar...
|
||||
find-previous = Buscar previo
|
||||
find-next = Buscar siguiente
|
||||
|
||||
# Menu
|
||||
|
||||
## File
|
||||
file = Archivo
|
||||
new-tab = Nueva pestaña
|
||||
new-window = Ventana nueva
|
||||
profile = Perfil
|
||||
menu-profiles = Perfiles...
|
||||
close-tab = Cerrar pestaña
|
||||
quit = Salir
|
||||
|
||||
## Edit
|
||||
edit = Editar
|
||||
copy = Copiar
|
||||
paste = Pegar
|
||||
select-all = Seleccionar todo
|
||||
find = Buscar
|
||||
|
||||
## View
|
||||
view = Vista
|
||||
zoom-in = Texto más grande
|
||||
zoom-reset = Tamaño por defecto del fuente
|
||||
zoom-out = Texto más pequeño
|
||||
next-tab = Pestaña siguiente
|
||||
previous-tab = Pestaña previa
|
||||
split-horizontal = División horizontal
|
||||
split-vertical = División vertical
|
||||
pane-toggle-maximize = Cambiar maximización
|
||||
menu-color-schemes = Esquemas de color...
|
||||
menu-settings = Ajustes...
|
||||
menu-about = Sobre Terminal COSMIC...
|
||||
96
i18n/fr/cosmic_term.ftl
Normal file
96
i18n/fr/cosmic_term.ftl
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
cosmic-terminal = Terminal COSMIC
|
||||
new-terminal = Nouveau terminal
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Git commit {$hash} le {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Palettes de couleurs
|
||||
rename = Renommer
|
||||
export = Exporter
|
||||
delete = Supprimer
|
||||
import = Importer
|
||||
import-errors = Importer erreurs
|
||||
|
||||
## Profiles
|
||||
profiles = Profils
|
||||
name = Nom
|
||||
command-line = Ligne de commande
|
||||
tab-title = Titre de l'onglet
|
||||
tab-title-description = Remplacer le titre d'onglet par défaut
|
||||
add-profile = Ajouter profil
|
||||
new-profile = Nouveau profil
|
||||
make-default = Rendre par défaut
|
||||
|
||||
## Settings
|
||||
settings = Paramètres
|
||||
|
||||
### Appearance
|
||||
appearance = Apparence
|
||||
theme = Thème
|
||||
match-desktop = Assortir au bureau
|
||||
dark = Sombre
|
||||
light = Clair
|
||||
syntax-dark = Palette de couleur sombre
|
||||
syntax-light = Palette de couleur claire
|
||||
default-zoom-step = Pas du zoom
|
||||
opacity = Opacité de l'arrière-plan
|
||||
|
||||
### Font
|
||||
font = Police
|
||||
advanced-font-settings = Paramètres de police avancés
|
||||
default-font = Police
|
||||
default-font-size = Taille de la police
|
||||
default-font-stretch = Étirement de la police
|
||||
default-font-weight = Graisse de caractère normale
|
||||
default-dim-font-weight = Graisse de caractère légère
|
||||
default-bold-font-weight = Graisse de caractère grasse
|
||||
use-bright-bold = Rendre le texte en gras plus clair
|
||||
|
||||
### Splits
|
||||
splits = Divisions
|
||||
focus-follow-mouse = Le focus de la saisie suit la souris
|
||||
|
||||
### Advanced
|
||||
advanced = Avancé
|
||||
show-headerbar = Afficher l'en-tête
|
||||
show-header-description = Révéler l'en-tête du menu contextuel.
|
||||
|
||||
# Find
|
||||
find-placeholder = Rechercher...
|
||||
find-previous = Chercher précédent
|
||||
find-next = Chercher suivant
|
||||
|
||||
# Menu
|
||||
|
||||
## File
|
||||
file = Fichier
|
||||
new-tab = Nouvel onglet
|
||||
new-window = Nouvelle fenêtre
|
||||
profile = Profil
|
||||
menu-profiles = Profils...
|
||||
close-tab = Fermer l'onglet
|
||||
quit = Quitter
|
||||
|
||||
## Edit
|
||||
edit = Modifier
|
||||
copy = Copier
|
||||
paste = Coller
|
||||
select-all = Sélectionner tout
|
||||
find = Rechercher
|
||||
|
||||
## View
|
||||
view = Affichage
|
||||
zoom-in = Texte plus grand
|
||||
zoom-reset = Taille de texte par défaut
|
||||
zoom-out = Texte plus petit
|
||||
next-tab = Onglet suivant
|
||||
previous-tab = Onglet précédent
|
||||
split-horizontal = Diviser horizontalement
|
||||
split-vertical = Diviser verticalement
|
||||
pane-toggle-maximize = Maximiser l'affichage
|
||||
menu-color-schemes = Palettes de couleurs...
|
||||
menu-settings = Paramètres...
|
||||
menu-about = À propos du terminal COSMIC...
|
||||
|
|
@ -4,13 +4,13 @@ new-terminal = Nuovo terminale
|
|||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Commit git {$hash} del {$date}
|
||||
git-description = Git commit {$hash}, data {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Schema colori
|
||||
color-schemes = Schema dei colori
|
||||
rename = Rinomina
|
||||
export = Esporta
|
||||
delete = Cancella
|
||||
delete = Elimina
|
||||
import = Importa
|
||||
import-errors = Importa errori
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ settings = Impostazioni
|
|||
### Appearance
|
||||
appearance = Aspetto
|
||||
theme = Tema
|
||||
match-desktop = Abbina alla scrivania
|
||||
match-desktop = Combacia col Desktop
|
||||
dark = Scuro
|
||||
light = Chiaro
|
||||
syntax-dark = Schema colori scuro
|
||||
|
|
@ -39,14 +39,14 @@ default-zoom-step = Passi ingrandimento
|
|||
opacity = Opacità sfondo
|
||||
|
||||
### Font
|
||||
font = Carattere tipografico
|
||||
advanced-font-settings = Impostazioni avanzate del carattere tipografico
|
||||
font = Carattere
|
||||
advanced-font-settings = Impostazioni avanzate del carattere
|
||||
default-font = Font predefinito
|
||||
default-font-size = Dimensione del carattere tipografico predefinita
|
||||
default-font-stretch = Estensione del carattere tipografico predefinita
|
||||
default-font-weight = Spessore del carattere tipografico normale
|
||||
default-dim-font-weight = Spessore del carattere tipografico attenuato
|
||||
default-bold-font-weight = Spessore del carattere tipografico in grassetto
|
||||
default-font-size = Dimensione predefinita del carattere
|
||||
default-font-stretch = Espansione predefinita del carattere
|
||||
default-font-weight = Spessore predefinito del carattere
|
||||
default-dim-font-weight = Spessore del carattere attenuato
|
||||
default-bold-font-weight = Spessore del carattere in grassetto
|
||||
use-bright-bold = Rendi il testo in grassetto più luminoso
|
||||
|
||||
### Splits
|
||||
|
|
@ -71,14 +71,14 @@ new-tab = Nuova scheda
|
|||
new-window = Nuova finestra
|
||||
profile = Profilo
|
||||
menu-profiles = Profili...
|
||||
close-tab = Chiudi finestra
|
||||
close-tab = Chiudi scheda
|
||||
quit = Esci
|
||||
|
||||
## Edit
|
||||
edit = Modifica
|
||||
copy = Copia
|
||||
paste = Incolla
|
||||
select-all = Seleziona tutti
|
||||
select-all = Seleziona tutto
|
||||
find = Trova
|
||||
|
||||
## View
|
||||
|
|
@ -90,7 +90,7 @@ next-tab = Scheda successiva
|
|||
previous-tab = Scheda precedente
|
||||
split-horizontal = Dividi orizzontalmente
|
||||
split-vertical = Dividi verticalmente
|
||||
pane-toggle-maximize = Abilita/disabilita schermo intero
|
||||
pane-toggle-maximize = Abilita o disabilita schermo intero
|
||||
menu-color-schemes = Schemi di colore...
|
||||
menu-settings = Impostazioni...
|
||||
menu-about = A proposito di COSMIC Terminal...
|
||||
menu-about = Informazioni su COSMIC Terminal...
|
||||
|
|
|
|||
|
|
@ -1,13 +1,28 @@
|
|||
cosmic-terminal = COSMIC端末
|
||||
new-terminal = 新しい端末
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = {$date}の{$hash}というGitコミット
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Color schemes
|
||||
rename = 名前を変更
|
||||
export = エクスポート
|
||||
delete = 削除
|
||||
import = インポート
|
||||
import-errors = インポートエラー
|
||||
|
||||
## Profiles
|
||||
profiles = プロファイル
|
||||
name = 名前
|
||||
command-line = コマンドライン
|
||||
tab-title = タブのイトル
|
||||
tab-title = タブタイトル
|
||||
tab-title-description = デフォルトのタブタイトルを無効にします
|
||||
add-profile = プロファイルを追加
|
||||
new-profile = 新しいプロファイル
|
||||
make-default = デフォルトにする
|
||||
|
||||
## Settings
|
||||
settings = 設定
|
||||
|
|
@ -76,4 +91,6 @@ previous-tab = 前のタブ
|
|||
split-horizontal = 上下に分割
|
||||
split-vertical = 左右に分割
|
||||
pane-toggle-maximize = ペインの最大化を切替
|
||||
menu-color-schemes = カラースキーム
|
||||
menu-settings = 設定...
|
||||
menu-about = COSMIC端末について...
|
||||
|
|
|
|||
|
|
@ -1,5 +1,30 @@
|
|||
cosmic-terminal = Terminal COSMIC
|
||||
new-terminal = Nowy terminal
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Git commit {$hash} on {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Schemat kolorów
|
||||
rename = Zmień nazwę
|
||||
export = Eksportuj
|
||||
delete = Usuń
|
||||
import = Importuj
|
||||
import-errors = Importuj błędy
|
||||
|
||||
## Profiles
|
||||
profiles = Profile
|
||||
name = Nazwa
|
||||
command-line = Wiersz poleceń
|
||||
tab-title = Nazwa karty
|
||||
tab-title-description = Nadpisz domyślną nazwę karty
|
||||
add-profile = Dodaj profil
|
||||
new-profile = Nowy profil
|
||||
make-default = Uczyń domyślnym
|
||||
|
||||
|
||||
## Settings
|
||||
settings = Ustawienia
|
||||
|
||||
|
|
@ -12,6 +37,7 @@ light = Jasny
|
|||
syntax-dark = Ciemna składnia
|
||||
syntax-light = Jasna składnia
|
||||
default-zoom-step = Domyślny poziom przybliżenia
|
||||
opacity = Przejrzystość Tła
|
||||
|
||||
### Font
|
||||
font = Czcionka
|
||||
|
|
@ -64,4 +90,6 @@ previous-tab = Poprzednia karta
|
|||
split-horizontal = Podziel w poziomie
|
||||
split-vertical = Podziel w pionie
|
||||
pane-toggle-maximize = Przełącznik maksymalizacji
|
||||
menu-color-schemes = Schemat kolorów...
|
||||
menu-settings = Ustawienia...
|
||||
menu-about = O Terminalu COSMIC...
|
||||
|
|
|
|||
96
i18n/pt/cosmic_term.ftl
Normal file
96
i18n/pt/cosmic_term.ftl
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
cosmic-terminal = Terminal COSMIC
|
||||
new-terminal = Novo terminal
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Commit do git {$hash} em {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Esquemas de cores
|
||||
rename = Renomear
|
||||
export = Exportar
|
||||
delete = Eliminar
|
||||
import = Importar
|
||||
import-errors = Erros de importação
|
||||
|
||||
## Profiles
|
||||
profiles = Perfis
|
||||
name = Nome
|
||||
command-line = Linha de comandos
|
||||
tab-title = Título do separador
|
||||
tab-title-description = Substitui o título do separador predefinido
|
||||
add-profile = Adicionar perfil
|
||||
new-profile = Novo perfil
|
||||
make-default = Tornar predefinido
|
||||
|
||||
## Settings
|
||||
settings = Definições
|
||||
|
||||
### Appearance
|
||||
appearance = Aparência
|
||||
theme = Tema
|
||||
match-desktop = Acompanhar o ambiente de trabalho
|
||||
dark = Escuro
|
||||
light = Claro
|
||||
syntax-dark = Esquema de cores escuro
|
||||
syntax-light = Esquema de cores claro
|
||||
default-zoom-step = Etapas de zoom
|
||||
opacity = Opacidade do fundo
|
||||
|
||||
### Font
|
||||
font = Fonte
|
||||
advanced-font-settings = Definições avançadas do tipo de letra
|
||||
default-font = Tipo de letra
|
||||
default-font-size = Tamanho do tipo de letra
|
||||
default-font-stretch = Largura do tipo de letra
|
||||
default-font-weight = Volume do tipo de letra normal
|
||||
default-dim-font-weight = Volume do tipo de letra fino
|
||||
default-bold-font-weight = Volume do tipo de letra em negrito
|
||||
use-bright-bold = Tornar o texto a negrito mais brilhante
|
||||
|
||||
### Splits
|
||||
splits = Divisões
|
||||
focus-follow-mouse = Foco de digitação segue o rato
|
||||
|
||||
### Advanced
|
||||
advanced = Avançado
|
||||
show-headerbar = Mostrar cabeçalho
|
||||
show-header-description = Mostrar o cabeçalho a partir do menu do botão direito do rato
|
||||
|
||||
# Find
|
||||
find-placeholder = Localizar...
|
||||
find-previous = Localizar anterior
|
||||
find-next = Localizar seguinte
|
||||
|
||||
# Menu
|
||||
|
||||
## File
|
||||
file = Ficheiro
|
||||
new-tab = Novo separador
|
||||
new-window = Nova janela
|
||||
profile = Perfil
|
||||
menu-profiles = Perfis...
|
||||
close-tab = Fechar separador
|
||||
quit = Sair
|
||||
|
||||
## Edit
|
||||
edit = Editar
|
||||
copy = Copiar
|
||||
paste = Colar
|
||||
select-all = Selecionar tudo
|
||||
find = Localizar
|
||||
|
||||
## View
|
||||
view = Ver
|
||||
zoom-in = Aumentar texto
|
||||
zoom-reset = Repor zoom
|
||||
zoom-out = Diminuir texto
|
||||
next-tab = Separador seguinte
|
||||
previous-tab = Separador anterior
|
||||
split-horizontal = Dividir horizontalmente
|
||||
split-vertical = Dividir verticalmente
|
||||
pane-toggle-maximize = Alternar maximização
|
||||
menu-color-schemes = Esquemas de cores...
|
||||
menu-settings = Definições...
|
||||
menu-about = Acerca do Terminal COSMIC...
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
cosmic-terminal = COSMIC Uçbirim
|
||||
new-terminal = Yeni uçbirim
|
||||
|
||||
# Context Pages
|
||||
|
||||
## About
|
||||
git-description = Git commit {$hash}, {$date}
|
||||
|
||||
## Color schemes
|
||||
color-schemes = Renk şemaları
|
||||
rename = Yeniden adlandır
|
||||
export = Dışa akar
|
||||
delete = Sil
|
||||
import = İçe aktar
|
||||
import-errors = İçe aktarma hataları
|
||||
|
||||
## Profiles
|
||||
profiles = Profiller
|
||||
name = İsim
|
||||
|
|
@ -8,6 +22,7 @@ tab-title = Sekme başlığı
|
|||
tab-title-description = Varsayılan sekme başlığını geçersiz kılar
|
||||
add-profile = Profil ekle
|
||||
new-profile = Yeni profil
|
||||
make-default = Varsayılan yap
|
||||
|
||||
## Settings
|
||||
settings = Ayarlar
|
||||
|
|
@ -21,6 +36,7 @@ light = Aydınlık
|
|||
syntax-dark = Karanlık renk şeması
|
||||
syntax-light = Aydınlık renk şeması
|
||||
default-zoom-step = Yakınlaştırma basamakları
|
||||
opacity = Arkaplan saydamlığı
|
||||
|
||||
### Font
|
||||
font = Yazı tipi
|
||||
|
|
@ -74,5 +90,7 @@ next-tab = Sonraki sekme
|
|||
previous-tab = Önceki sekme
|
||||
split-horizontal = Yatay böl
|
||||
split-vertical = Dikey böl
|
||||
pane-toggle-maximize = En üste geç
|
||||
pane-toggle-maximize = Tam ekrana geç
|
||||
menu-color-schemes = Renk şemaları...
|
||||
menu-settings = Ayarlar...
|
||||
menu-about = COSMIC Uçbirim hakkında
|
||||
|
|
|
|||
5
justfile
5
justfile
|
|
@ -15,6 +15,10 @@ desktop := APPID + '.desktop'
|
|||
desktop-src := 'res' / desktop
|
||||
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / desktop
|
||||
|
||||
metainfo := APPID + '.metainfo.xml'
|
||||
metainfo-src := 'res' / metainfo
|
||||
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / metainfo
|
||||
|
||||
icons-src := 'res' / 'icons' / 'hicolor'
|
||||
icons-dst := clean(rootdir / prefix) / 'share' / 'icons' / 'hicolor'
|
||||
|
||||
|
|
@ -61,6 +65,7 @@ run *args:
|
|||
install:
|
||||
install -Dm0755 {{bin-src}} {{bin-dst}}
|
||||
install -Dm0644 {{desktop-src}} {{desktop-dst}}
|
||||
install -Dm0644 {{metainfo-src}} {{metainfo-dst}}
|
||||
for size in `ls {{icons-src}}`; do \
|
||||
install -Dm0644 "{{icons-src}}/$size/apps/{{APPID}}.svg" "{{icons-dst}}/$size/apps/{{APPID}}.svg"; \
|
||||
done
|
||||
|
|
|
|||
23
res/com.system76.CosmicTerm.metainfo.xml
Normal file
23
res/com.system76.CosmicTerm.metainfo.xml
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<component type="desktop-application">
|
||||
<id>com.system76.CosmicTerm</id>
|
||||
<metadata_license>CC0-1.0</metadata_license>
|
||||
<project_license>GPL-3.0-only</project_license>
|
||||
<project_group>COSMIC</project_group>
|
||||
<developer_name>System76</developer_name>
|
||||
<update_contact>jeremy@system76.com</update_contact>
|
||||
<url type="homepage">https://github.com/pop-os/cosmic-term</url>
|
||||
<url type="bugtracker">https://github.com/pop-os/cosmic-term</url>
|
||||
<name>COSMIC Terminal</name>
|
||||
<summary>Terminal emulator for the COSMIC desktop</summary>
|
||||
<description>
|
||||
<p>Terminal emulator for the COSMIC desktop</p>
|
||||
</description>
|
||||
<launchable type="desktop-id">com.system76.CosmicTerm.desktop</launchable>
|
||||
<icon type="remote" height="256" width="256">https://raw.githubusercontent.com/pop-os/cosmic-term/master/res/icons/hicolor/256x256/apps/com.system76.CosmicTerm.svg</icon>
|
||||
<provides>
|
||||
<binaries>
|
||||
<binary>cosmic-term</binary>
|
||||
</binaries>
|
||||
</provides>
|
||||
</component>
|
||||
|
|
@ -1,49 +1,9 @@
|
|||
use cosmic::{
|
||||
iced::keyboard::{Key, Modifiers},
|
||||
iced_core::keyboard::key::Named,
|
||||
};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{collections::HashMap, fmt};
|
||||
use cosmic::widget::menu::key_bind::{KeyBind, Modifier};
|
||||
use cosmic::{iced::keyboard::Key, iced_core::keyboard::key::Named};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::Action;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
pub enum Modifier {
|
||||
Super,
|
||||
Ctrl,
|
||||
Alt,
|
||||
Shift,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
|
||||
pub struct KeyBind {
|
||||
pub modifiers: Vec<Modifier>,
|
||||
pub key: Key,
|
||||
}
|
||||
|
||||
impl KeyBind {
|
||||
pub fn matches(&self, modifiers: Modifiers, key: &Key) -> bool {
|
||||
key == &self.key
|
||||
&& modifiers.logo() == self.modifiers.contains(&Modifier::Super)
|
||||
&& modifiers.control() == self.modifiers.contains(&Modifier::Ctrl)
|
||||
&& modifiers.alt() == self.modifiers.contains(&Modifier::Alt)
|
||||
&& modifiers.shift() == self.modifiers.contains(&Modifier::Shift)
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for KeyBind {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
for modifier in self.modifiers.iter() {
|
||||
write!(f, "{:?} + ", modifier)?;
|
||||
}
|
||||
match &self.key {
|
||||
Key::Character(c) => write!(f, "{}", c.to_uppercase()),
|
||||
Key::Named(named) => write!(f, "{:?}", named),
|
||||
other => write!(f, "{:?}", other),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: load from config
|
||||
pub fn key_binds() -> HashMap<KeyBind, Action> {
|
||||
let mut key_binds = HashMap::new();
|
||||
|
|
|
|||
63
src/main.rs
63
src/main.rs
|
|
@ -1,9 +1,9 @@
|
|||
// Copyright 2023 System76 <info@system76.com>
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use alacritty_terminal::{
|
||||
event::Event as TermEvent, term::color::Colors as TermColors, term::Config as TermConfig, tty,
|
||||
};
|
||||
use alacritty_terminal::{event::Event as TermEvent, term, term::color::Colors as TermColors, tty};
|
||||
use cosmic::widget::menu::action::MenuAction;
|
||||
use cosmic::widget::menu::key_bind::KeyBind;
|
||||
use cosmic::{
|
||||
app::{message, Command, Core, Settings},
|
||||
cosmic_config::{self, ConfigSet, CosmicConfigEntry},
|
||||
|
|
@ -43,7 +43,7 @@ mod mouse_reporter;
|
|||
use icon_cache::IconCache;
|
||||
mod icon_cache;
|
||||
|
||||
use key_bind::{key_binds, KeyBind};
|
||||
use key_bind::key_binds;
|
||||
mod key_bind;
|
||||
|
||||
mod localize;
|
||||
|
|
@ -134,7 +134,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||
None
|
||||
};
|
||||
|
||||
let term_config = TermConfig::default();
|
||||
let term_config = term::Config::default();
|
||||
// Set up environmental variables for terminal
|
||||
tty::setup_env();
|
||||
// Override TERM for better compatibility
|
||||
|
|
@ -167,7 +167,7 @@ pub struct Flags {
|
|||
config_handler: Option<cosmic_config::Config>,
|
||||
config: Config,
|
||||
startup_options: Option<tty::Options>,
|
||||
term_config: TermConfig,
|
||||
term_config: term::Config,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
|
||||
|
|
@ -211,12 +211,14 @@ pub enum Action {
|
|||
ZoomReset,
|
||||
}
|
||||
|
||||
impl Action {
|
||||
pub fn message(self, entity_opt: Option<segmented_button::Entity>) -> Message {
|
||||
impl MenuAction for Action {
|
||||
type Message = Message;
|
||||
|
||||
fn message(&self, entity_opt: Option<segmented_button::Entity>) -> Message {
|
||||
match self {
|
||||
Action::About => Message::ToggleContextPage(ContextPage::About),
|
||||
Action::ColorSchemes(color_scheme_kind) => {
|
||||
Message::ToggleContextPage(ContextPage::ColorSchemes(color_scheme_kind))
|
||||
Message::ToggleContextPage(ContextPage::ColorSchemes(*color_scheme_kind))
|
||||
}
|
||||
Action::Copy => Message::Copy(entity_opt),
|
||||
Action::CopyPrimary => Message::CopyPrimary(entity_opt),
|
||||
|
|
@ -230,11 +232,11 @@ impl Action {
|
|||
Action::PaneToggleMaximized => Message::PaneToggleMaximized,
|
||||
Action::Paste => Message::Paste(entity_opt),
|
||||
Action::PastePrimary => Message::PastePrimary(entity_opt),
|
||||
Action::ProfileOpen(profile_id) => Message::ProfileOpen(profile_id),
|
||||
Action::ProfileOpen(profile_id) => Message::ProfileOpen(*profile_id),
|
||||
Action::Profiles => Message::ToggleContextPage(ContextPage::Profiles),
|
||||
Action::SelectAll => Message::SelectAll(entity_opt),
|
||||
Action::Settings => Message::ToggleContextPage(ContextPage::Settings),
|
||||
Action::ShowHeaderBar(show_headerbar) => Message::ShowHeaderBar(show_headerbar),
|
||||
Action::ShowHeaderBar(show_headerbar) => Message::ShowHeaderBar(*show_headerbar),
|
||||
Action::TabActivate0 => Message::TabActivateJump(0),
|
||||
Action::TabActivate1 => Message::TabActivateJump(1),
|
||||
Action::TabActivate2 => Message::TabActivateJump(2),
|
||||
|
|
@ -387,7 +389,7 @@ pub struct App {
|
|||
find_search_value: String,
|
||||
term_event_tx_opt: Option<mpsc::Sender<(pane_grid::Pane, segmented_button::Entity, TermEvent)>>,
|
||||
startup_options: Option<tty::Options>,
|
||||
term_config: TermConfig,
|
||||
term_config: term::Config,
|
||||
color_scheme_errors: Vec<String>,
|
||||
color_scheme_expanded: Option<(ColorSchemeKind, ColorSchemeId)>,
|
||||
color_scheme_renaming: Option<(ColorSchemeKind, ColorSchemeId, String)>,
|
||||
|
|
@ -2174,6 +2176,31 @@ impl Application for App {
|
|||
TermEvent::Bell => {
|
||||
//TODO: audible or visible bell options?
|
||||
}
|
||||
TermEvent::ClipboardLoad(kind, callback) => {
|
||||
match kind {
|
||||
term::ClipboardType::Clipboard => {
|
||||
log::info!("clipboard load");
|
||||
return clipboard::read(move |data_opt| {
|
||||
//TODO: what to do when data_opt is None?
|
||||
callback(&data_opt.unwrap_or_default());
|
||||
// We don't need to do anything else
|
||||
message::none()
|
||||
});
|
||||
}
|
||||
term::ClipboardType::Selection => {
|
||||
log::info!("TODO: load selection");
|
||||
}
|
||||
}
|
||||
}
|
||||
TermEvent::ClipboardStore(kind, data) => match kind {
|
||||
term::ClipboardType::Clipboard => {
|
||||
log::info!("clipboard store");
|
||||
return clipboard::write(data);
|
||||
}
|
||||
term::ClipboardType::Selection => {
|
||||
log::info!("TODO: store selection");
|
||||
}
|
||||
},
|
||||
TermEvent::ColorRequest(index, f) => {
|
||||
if let Some(tab_model) = self.pane_model.panes.get(pane) {
|
||||
if let Some(terminal) = tab_model.data::<Mutex<Terminal>>(entity) {
|
||||
|
|
@ -2184,6 +2211,9 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
TermEvent::CursorBlinkingChange => {
|
||||
//TODO: should we blink the cursor?
|
||||
}
|
||||
TermEvent::Exit => {
|
||||
return self.update(Message::TabClose(Some(entity)));
|
||||
}
|
||||
|
|
@ -2243,9 +2273,6 @@ impl Application for App {
|
|||
}
|
||||
}
|
||||
}
|
||||
_ => {
|
||||
log::warn!("TODO: {:?}", event);
|
||||
}
|
||||
}
|
||||
}
|
||||
Message::TermEventTx(term_event_tx) => {
|
||||
|
|
@ -2500,10 +2527,8 @@ impl Application for App {
|
|||
.padding(space_xxs)
|
||||
.spacing(space_xxs);
|
||||
|
||||
tab_column = tab_column.push(
|
||||
widget::cosmic_container::container(find_widget)
|
||||
.layer(cosmic_theme::Layer::Primary),
|
||||
);
|
||||
tab_column = tab_column
|
||||
.push(widget::layer_container(find_widget).layer(cosmic_theme::Layer::Primary));
|
||||
}
|
||||
|
||||
pane_grid::Content::new(tab_column)
|
||||
|
|
|
|||
141
src/menu.rs
141
src/menu.rs
|
|
@ -1,13 +1,14 @@
|
|||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
use cosmic::widget::menu::key_bind::KeyBind;
|
||||
use cosmic::widget::menu::menu_tree::{menu_items, menu_root, MenuItem};
|
||||
use cosmic::{
|
||||
//TODO: export in cosmic::widget
|
||||
iced::{
|
||||
widget::{column, horizontal_rule, horizontal_space},
|
||||
Alignment, Background, Length,
|
||||
},
|
||||
iced_core::Border,
|
||||
theme,
|
||||
menu_button, theme,
|
||||
widget::{
|
||||
self,
|
||||
menu::{ItemHeight, ItemWidth, MenuBar, MenuTree},
|
||||
|
|
@ -17,22 +18,7 @@ use cosmic::{
|
|||
};
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::{fl, Action, ColorSchemeId, ColorSchemeKind, Config, KeyBind, Message};
|
||||
|
||||
macro_rules! menu_button {
|
||||
($($x:expr),+ $(,)?) => (
|
||||
widget::button(
|
||||
widget::Row::with_children(
|
||||
vec![$(Element::from($x)),+]
|
||||
)
|
||||
.align_items(Alignment::Center)
|
||||
)
|
||||
.height(Length::Fixed(32.0))
|
||||
.padding([4, 16])
|
||||
.width(Length::Fill)
|
||||
.style(theme::Button::MenuItem)
|
||||
);
|
||||
}
|
||||
use crate::{fl, Action, ColorSchemeId, ColorSchemeKind, Config, Message};
|
||||
|
||||
pub fn context_menu<'a>(
|
||||
config: &Config,
|
||||
|
|
@ -145,90 +131,69 @@ pub fn color_scheme_menu<'a>(
|
|||
}
|
||||
|
||||
pub fn menu_bar<'a>(config: &Config, key_binds: &HashMap<KeyBind, Action>) -> Element<'a, Message> {
|
||||
//TODO: port to libcosmic
|
||||
let menu_root = |label| {
|
||||
widget::button(widget::text(label))
|
||||
.padding([4, 12])
|
||||
.style(theme::Button::MenuRoot)
|
||||
};
|
||||
|
||||
let menu_folder =
|
||||
|label| menu_button!(widget::text(label), horizontal_space(Length::Fill), ">");
|
||||
|
||||
let find_key = |action: &Action| -> String {
|
||||
for (key_bind, key_action) in key_binds.iter() {
|
||||
if action == key_action {
|
||||
return key_bind.to_string();
|
||||
}
|
||||
}
|
||||
String::new()
|
||||
};
|
||||
|
||||
let menu_item = |label, action| {
|
||||
let key = find_key(&action);
|
||||
MenuTree::new(
|
||||
menu_button!(
|
||||
widget::text(label),
|
||||
horizontal_space(Length::Fill),
|
||||
widget::text(key)
|
||||
)
|
||||
.on_press(action.message(None)),
|
||||
)
|
||||
};
|
||||
|
||||
let mut profile_items = Vec::with_capacity(config.profiles.len());
|
||||
for (name, id) in config.profile_names() {
|
||||
profile_items.push(menu_item(name, Action::ProfileOpen(id)));
|
||||
profile_items.push(MenuItem::Button(name, Action::ProfileOpen(id)));
|
||||
}
|
||||
|
||||
//TODO: what to do if there are no profiles?
|
||||
|
||||
MenuBar::new(vec![
|
||||
MenuTree::with_children(
|
||||
menu_root(fl!("file")),
|
||||
vec![
|
||||
menu_item(fl!("new-tab"), Action::TabNew),
|
||||
menu_item(fl!("new-window"), Action::WindowNew),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
MenuTree::with_children(menu_folder(fl!("profile")), profile_items),
|
||||
menu_item(fl!("menu-profiles"), Action::Profiles),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("close-tab"), Action::TabClose),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("quit"), Action::WindowClose),
|
||||
],
|
||||
menu_items(
|
||||
key_binds,
|
||||
vec![
|
||||
MenuItem::Button(fl!("new-tab"), Action::TabNew),
|
||||
MenuItem::Button(fl!("new-window"), Action::WindowNew),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Folder(fl!("profile"), profile_items),
|
||||
MenuItem::Button(fl!("menu-profiles"), Action::Profiles),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("close-tab"), Action::TabClose),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("quit"), Action::WindowClose),
|
||||
],
|
||||
),
|
||||
),
|
||||
MenuTree::with_children(
|
||||
menu_root(fl!("edit")),
|
||||
vec![
|
||||
menu_item(fl!("copy"), Action::Copy),
|
||||
menu_item(fl!("paste"), Action::Paste),
|
||||
menu_item(fl!("select-all"), Action::SelectAll),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("find"), Action::Find),
|
||||
],
|
||||
menu_items(
|
||||
key_binds,
|
||||
vec![
|
||||
MenuItem::Button(fl!("copy"), Action::Copy),
|
||||
MenuItem::Button(fl!("paste"), Action::Paste),
|
||||
MenuItem::Button(fl!("select-all"), Action::SelectAll),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("find"), Action::Find),
|
||||
],
|
||||
),
|
||||
),
|
||||
MenuTree::with_children(
|
||||
menu_root(fl!("view")),
|
||||
vec![
|
||||
menu_item(fl!("zoom-in"), Action::ZoomIn),
|
||||
menu_item(fl!("zoom-reset"), Action::ZoomReset),
|
||||
menu_item(fl!("zoom-out"), Action::ZoomOut),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("next-tab"), Action::TabNext),
|
||||
menu_item(fl!("previous-tab"), Action::TabPrev),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("split-horizontal"), Action::PaneSplitHorizontal),
|
||||
menu_item(fl!("split-vertical"), Action::PaneSplitVertical),
|
||||
menu_item(fl!("pane-toggle-maximize"), Action::PaneToggleMaximized),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(
|
||||
fl!("menu-color-schemes"),
|
||||
Action::ColorSchemes(config.color_scheme_kind()),
|
||||
),
|
||||
menu_item(fl!("menu-settings"), Action::Settings),
|
||||
MenuTree::new(horizontal_rule(1)),
|
||||
menu_item(fl!("menu-about"), Action::About),
|
||||
],
|
||||
menu_items(
|
||||
key_binds,
|
||||
vec![
|
||||
MenuItem::Button(fl!("zoom-in"), Action::ZoomIn),
|
||||
MenuItem::Button(fl!("zoom-reset"), Action::ZoomReset),
|
||||
MenuItem::Button(fl!("zoom-out"), Action::ZoomOut),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("next-tab"), Action::TabNext),
|
||||
MenuItem::Button(fl!("previous-tab"), Action::TabPrev),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("split-horizontal"), Action::PaneSplitHorizontal),
|
||||
MenuItem::Button(fl!("split-vertical"), Action::PaneSplitVertical),
|
||||
MenuItem::Button(fl!("pane-toggle-maximize"), Action::PaneToggleMaximized),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(
|
||||
fl!("menu-color-schemes"),
|
||||
Action::ColorSchemes(config.color_scheme_kind()),
|
||||
),
|
||||
MenuItem::Button(fl!("menu-settings"), Action::Settings),
|
||||
MenuItem::Divider,
|
||||
MenuItem::Button(fl!("menu-about"), Action::About),
|
||||
],
|
||||
),
|
||||
),
|
||||
])
|
||||
.item_height(ItemHeight::Dynamic(40))
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ use alacritty_terminal::{
|
|||
selection::{Selection, SelectionType},
|
||||
term::{cell::Flags, TermMode},
|
||||
};
|
||||
use cosmic::widget::menu::key_bind::KeyBind;
|
||||
use cosmic::{
|
||||
cosmic_theme::palette::{blend::Compose, WithAlpha},
|
||||
iced::{
|
||||
|
|
@ -40,11 +41,7 @@ use std::{
|
|||
time::{Duration, Instant},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
key_bind::{key_binds, KeyBind},
|
||||
terminal::Metadata,
|
||||
Action, Terminal, TerminalScroll,
|
||||
};
|
||||
use crate::{key_bind::key_binds, terminal::Metadata, Action, Terminal, TerminalScroll};
|
||||
|
||||
pub struct TerminalBox<'a, Message> {
|
||||
terminal: &'a Mutex<Terminal>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue