Update to alacritty_terminal v0.20
Signed-off-by: Mohammad AlSaleh <CE.Mohammad.AlSaleh@gmail.com>
This commit is contained in:
parent
0866a6897d
commit
fb2b251a33
5 changed files with 142 additions and 433 deletions
538
Cargo.lock
generated
538
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
alacritty_terminal = "0.19"
|
alacritty_terminal = "0.20"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
lazy_static = "1"
|
lazy_static = "1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
|
|
|
||||||
12
src/main.rs
12
src/main.rs
|
|
@ -2,7 +2,7 @@
|
||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
use alacritty_terminal::{
|
use alacritty_terminal::{
|
||||||
config::Config as TermConfig, event::Event as TermEvent, term::color::Colors as TermColors, tty,
|
event::Event as TermEvent, term::color::Colors as TermColors, term::Config as TermConfig, tty,
|
||||||
};
|
};
|
||||||
use cosmic::{
|
use cosmic::{
|
||||||
app::{message, Command, Core, Settings},
|
app::{message, Command, Core, Settings},
|
||||||
|
|
@ -22,7 +22,7 @@ use cosmic::{
|
||||||
Application, ApplicationExt, Element,
|
Application, ApplicationExt, Element,
|
||||||
};
|
};
|
||||||
use cosmic_text::Family;
|
use cosmic_text::Family;
|
||||||
use std::{any::TypeId, collections::HashMap, process, sync::Mutex};
|
use std::{any::TypeId, collections::HashMap, env, process, sync::Mutex};
|
||||||
use tokio::sync::mpsc;
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
use config::{AppTheme, Config, CONFIG_VERSION};
|
use config::{AppTheme, Config, CONFIG_VERSION};
|
||||||
|
|
@ -74,11 +74,11 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let term_config = TermConfig::default();
|
||||||
// Set up environmental variables for terminal
|
// Set up environmental variables for terminal
|
||||||
let mut term_config = TermConfig::default();
|
tty::setup_env();
|
||||||
// Override TERM for better compatibility
|
// Override TERM for better compatibility
|
||||||
term_config.env.insert("TERM".to_string(), "xterm-256color".to_string());
|
env::set_var("TERM", "xterm-256color");
|
||||||
tty::setup_env(&term_config);
|
|
||||||
|
|
||||||
let mut settings = Settings::default();
|
let mut settings = Settings::default();
|
||||||
settings = settings.theme(config.app_theme.theme());
|
settings = settings.theme(config.app_theme.theme());
|
||||||
|
|
@ -557,7 +557,7 @@ impl Application for App {
|
||||||
let terminal = Terminal::new(
|
let terminal = Terminal::new(
|
||||||
entity,
|
entity,
|
||||||
term_event_tx.clone(),
|
term_event_tx.clone(),
|
||||||
&self.term_config,
|
self.term_config.clone(),
|
||||||
colors.clone(),
|
colors.clone(),
|
||||||
);
|
);
|
||||||
self.tab_model
|
self.tab_model
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,4 @@
|
||||||
use alacritty_terminal::{
|
use alacritty_terminal::{
|
||||||
ansi::{Color, NamedColor},
|
|
||||||
config::Config,
|
|
||||||
event::{Event, EventListener, Notify, OnResize, WindowSize},
|
event::{Event, EventListener, Notify, OnResize, WindowSize},
|
||||||
event_loop::{EventLoop, Msg, Notifier},
|
event_loop::{EventLoop, Msg, Notifier},
|
||||||
grid::Dimensions,
|
grid::Dimensions,
|
||||||
|
|
@ -9,10 +7,13 @@ use alacritty_terminal::{
|
||||||
sync::FairMutex,
|
sync::FairMutex,
|
||||||
term::{
|
term::{
|
||||||
cell::Flags,
|
cell::Flags,
|
||||||
color::{self, Colors, Rgb},
|
color::{self, Colors},
|
||||||
|
Config,
|
||||||
viewport_to_point, TermMode,
|
viewport_to_point, TermMode,
|
||||||
},
|
},
|
||||||
tty, Term,
|
tty::{self, Options},
|
||||||
|
Term,
|
||||||
|
vte::ansi::{Color, NamedColor, Rgb},
|
||||||
};
|
};
|
||||||
use cosmic::{iced::advanced::graphics::text::font_system, widget::segmented_button};
|
use cosmic::{iced::advanced::graphics::text::font_system, widget::segmented_button};
|
||||||
use cosmic_text::{
|
use cosmic_text::{
|
||||||
|
|
@ -111,7 +112,7 @@ impl Terminal {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
entity: segmented_button::Entity,
|
entity: segmented_button::Entity,
|
||||||
event_tx: mpsc::Sender<(segmented_button::Entity, Event)>,
|
event_tx: mpsc::Sender<(segmented_button::Entity, Event)>,
|
||||||
config: &Config,
|
config: Config,
|
||||||
colors: Colors,
|
colors: Colors,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let metrics = Metrics::new(14.0, 20.0);
|
let metrics = Metrics::new(14.0, 20.0);
|
||||||
|
|
@ -141,19 +142,21 @@ impl Terminal {
|
||||||
};
|
};
|
||||||
let event_proxy = EventProxy(entity, event_tx);
|
let event_proxy = EventProxy(entity, event_tx);
|
||||||
let term = Arc::new(FairMutex::new(Term::new(
|
let term = Arc::new(FairMutex::new(Term::new(
|
||||||
&config,
|
config,
|
||||||
&size,
|
&size,
|
||||||
event_proxy.clone(),
|
event_proxy.clone(),
|
||||||
)));
|
)));
|
||||||
|
|
||||||
let window_id = 0;
|
let window_id = 0;
|
||||||
let pty = tty::new(&config.pty_config, size.into(), window_id).unwrap();
|
let options = Options::default();
|
||||||
|
|
||||||
|
let pty = tty::new(&options, size.into(), window_id).unwrap();
|
||||||
|
|
||||||
let pty_event_loop = EventLoop::new(
|
let pty_event_loop = EventLoop::new(
|
||||||
term.clone(),
|
term.clone(),
|
||||||
event_proxy,
|
event_proxy,
|
||||||
pty,
|
pty,
|
||||||
config.pty_config.hold,
|
options.hold,
|
||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
let notifier = Notifier(pty_event_loop.channel());
|
let notifier = Notifier(pty_event_loop.channel());
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
use alacritty_terminal::{
|
use alacritty_terminal::{
|
||||||
ansi::NamedColor,
|
term::color::Colors,
|
||||||
term::color::{Colors, Rgb},
|
vte::ansi::{NamedColor, Rgb},
|
||||||
};
|
};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue