diff --git a/src/main.rs b/src/main.rs index 61a0af7..4c01b88 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,9 +1,7 @@ // Copyright 2023 System76 // 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> { 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, config: Config, startup_options: Option, - 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>, startup_options: Option, - term_config: TermConfig, + term_config: term::Config, color_scheme_errors: Vec, 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::>(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) => {