forked from pop-os/cosmic-term
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
// Copyright 2023 System76 <[email protected]> | ||
// 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::{ | ||
app::{message, Command, Core, Settings}, | ||
cosmic_config::{self, ConfigSet, CosmicConfigEntry}, | ||
|
@@ -133,7 +131,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 | ||
|
@@ -166,7 +164,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)] | ||
|
@@ -379,7 +377,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)>, | ||
|
@@ -2136,6 +2134,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) { | ||
|
@@ -2146,6 +2169,9 @@ impl Application for App { | |
} | ||
} | ||
} | ||
TermEvent::CursorBlinkingChange => { | ||
//TODO: should we blink the cursor? | ||
} | ||
TermEvent::Exit => { | ||
return self.update(Message::TabClose(Some(entity))); | ||
} | ||
|
@@ -2205,9 +2231,6 @@ impl Application for App { | |
} | ||
} | ||
} | ||
_ => { | ||
log::warn!("TODO: {:?}", event); | ||
} | ||
} | ||
} | ||
Message::TermEventTx(term_event_tx) => { | ||
|