diff options
-rw-r--r-- | CHANGELOG.md | 2 | ||||
-rw-r--r-- | Cargo.lock | 8 | ||||
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | alacritty/Cargo.toml | 2 | ||||
-rw-r--r-- | alacritty/src/cli.rs | 5 | ||||
-rw-r--r-- | alacritty/src/display/window.rs | 16 | ||||
-rw-r--r-- | alacritty/src/input/keyboard.rs | 21 | ||||
-rw-r--r-- | alacritty/src/main.rs | 10 | ||||
-rw-r--r-- | alacritty/src/window_context.rs | 12 | ||||
-rw-r--r-- | extra/linux/org.alacritty.Alacritty.appdata.xml | 43 |
10 files changed, 75 insertions, 46 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a9efb5f..882c7c1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - Config option `window.level = "AlwaysOnTop"` to force Alacritty to always be the toplevel window - Escape sequence to move cursor forward tabs ( CSI Ps I ) +- Pass activation token in `alacritty msg create-window` on Wayland/X11 ### Changed @@ -28,6 +29,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its - `alacritty migrate` crashing with recursive toml imports - Migrating nonexistent toml import breaking the entire migration - First daemon mode window ignoring window options passed through CLI +- Report of Enter/Tab/Backspace in kitty keyboard's report event types mode ## 0.14.0 @@ -2045,9 +2045,9 @@ dependencies = [ [[package]] name = "vte" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40eb22ae96f050e0c0d6f7ce43feeae26c348fc4dea56928ca81537cfaa6188b" +checksum = "9a0b683b20ef64071ff03745b14391751f6beab06a54347885459b77a3f2caa5" dependencies = [ "bitflags 2.6.0", "cursor-icon", @@ -2526,9 +2526,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winit" -version = "0.30.7" +version = "0.30.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dba50bc8ef4b6f1a75c9274fb95aa9a8f63fbc66c56f391bd85cf68d51e7b1a3" +checksum = "f5d74280aabb958072864bff6cfbcf9025cf8bfacdde5e32b5e12920ef703b0f" dependencies = [ "ahash", "android-activity", @@ -6,7 +6,7 @@ <p align="center"> <img alt="Alacritty - A fast, cross-platform, OpenGL terminal emulator" - src="extra/promo/alacritty-readme.png"> + src="https://raw.githubusercontent.com/alacritty/alacritty/master/extra/promo/alacritty-readme.png"> </p> ## About diff --git a/alacritty/Cargo.toml b/alacritty/Cargo.toml index eff0b089..6d05983a 100644 --- a/alacritty/Cargo.toml +++ b/alacritty/Cargo.toml @@ -41,7 +41,7 @@ tempfile = "3.12.0" toml = "0.8.2" toml_edit = "0.22.21" unicode-width = "0.1" -winit = { version = "0.30.7", default-features = false, features = ["rwh_06", "serde"] } +winit = { version = "0.30.8", default-features = false, features = ["rwh_06", "serde"] } [build-dependencies] gl_generator = "0.14.0" diff --git a/alacritty/src/cli.rs b/alacritty/src/cli.rs index bb0a24f4..5010ffc8 100644 --- a/alacritty/src/cli.rs +++ b/alacritty/src/cli.rs @@ -300,6 +300,11 @@ pub struct WindowOptions { /// The window tabbing identifier to use when building a window. pub window_tabbing_id: Option<String>, + #[clap(skip)] + #[cfg(not(any(target_os = "macos", windows)))] + /// `ActivationToken` that we pass to winit. + pub activation_token: Option<String>, + /// Override configuration file options [example: 'cursor.style="Beam"']. #[clap(short = 'o', long, num_args = 1..)] option: Vec<String>, diff --git a/alacritty/src/display/window.rs b/alacritty/src/display/window.rs index 1c8089bc..fe40fab5 100644 --- a/alacritty/src/display/window.rs +++ b/alacritty/src/display/window.rs @@ -2,6 +2,8 @@ use winit::platform::startup_notify::{ self, EventLoopExtStartupNotify, WindowAttributesExtStartupNotify, }; +#[cfg(not(any(target_os = "macos", windows)))] +use winit::window::ActivationToken; #[cfg(all(not(feature = "x11"), not(any(target_os = "macos", windows))))] use winit::platform::wayland::WindowAttributesExtWayland; @@ -38,6 +40,7 @@ use winit::window::{ use alacritty_terminal::index::Point; +use crate::cli::WindowOptions; use crate::config::window::{Decorations, Identity, WindowConfig}; use crate::config::UiConfig; use crate::display::SizeInfo; @@ -124,9 +127,7 @@ impl Window { event_loop: &ActiveEventLoop, config: &UiConfig, identity: &Identity, - #[rustfmt::skip] - #[cfg(target_os = "macos")] - tabbing_id: &Option<String>, + _options: &mut WindowOptions, #[rustfmt::skip] #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual: Option<X11VisualInfo>, @@ -138,7 +139,7 @@ impl Window { #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] x11_visual, #[cfg(target_os = "macos")] - tabbing_id, + &_options.window_tabbing_id.take(), ); if let Some(position) = config.window.position { @@ -147,7 +148,12 @@ impl Window { } #[cfg(not(any(target_os = "macos", windows)))] - if let Some(token) = event_loop.read_token_from_env() { + if let Some(token) = _options + .activation_token + .take() + .map(ActivationToken::from_raw) + .or_else(|| event_loop.read_token_from_env()) + { log::debug!("Activating window with token: {token:?}"); window_attributes = window_attributes.with_activation_token(token); diff --git a/alacritty/src/input/keyboard.rs b/alacritty/src/input/keyboard.rs index 85734109..af9bfbb2 100644 --- a/alacritty/src/input/keyboard.rs +++ b/alacritty/src/input/keyboard.rs @@ -218,20 +218,15 @@ impl<T: EventListener, A: ActionContext<T>> Processor<T, A> { let text = key.text_with_all_modifiers().unwrap_or_default(); let mods = if self.alt_send_esc(&key, text) { mods } else { mods & !ModifiersState::ALT }; - let bytes: Cow<'static, [u8]> = match key.logical_key.as_ref() { - // NOTE: Echo the key back on release to follow kitty/foot behavior. When - // KEYBOARD_REPORT_ALL_KEYS_AS_ESC is used, we build proper escapes for - // the keys below. - _ if mode.contains(TermMode::REPORT_ALL_KEYS_AS_ESC) => { - build_sequence(key, mods, mode).into() + let bytes = match key.logical_key.as_ref() { + Key::Named(NamedKey::Enter) + | Key::Named(NamedKey::Tab) + | Key::Named(NamedKey::Backspace) + if !mode.contains(TermMode::REPORT_ALL_KEYS_AS_ESC) => + { + return }, - // Winit uses different keys for `Backspace` so we explicitly specify the - // values, instead of using what was passed to us from it. - Key::Named(NamedKey::Tab) => [b'\t'].as_slice().into(), - Key::Named(NamedKey::Enter) => [b'\r'].as_slice().into(), - Key::Named(NamedKey::Backspace) => [b'\x7f'].as_slice().into(), - Key::Named(NamedKey::Escape) => [b'\x1b'].as_slice().into(), - _ => build_sequence(key, mods, mode).into(), + _ => build_sequence(key, mods, mode), }; self.ctx.write_to_pty(bytes); diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs index 6bbf8dfd..5382e475 100644 --- a/alacritty/src/main.rs +++ b/alacritty/src/main.rs @@ -55,6 +55,8 @@ mod gl { #[cfg(unix)] use crate::cli::MessageOptions; +#[cfg(not(any(target_os = "macos", windows)))] +use crate::cli::SocketMessage; use crate::cli::{Options, Subcommands}; use crate::config::monitor::ConfigMonitor; use crate::config::UiConfig; @@ -89,7 +91,13 @@ fn main() -> Result<(), Box<dyn Error>> { /// `msg` subcommand entrypoint. #[cfg(unix)] -fn msg(options: MessageOptions) -> Result<(), Box<dyn Error>> { +#[allow(unused_mut)] +fn msg(mut options: MessageOptions) -> Result<(), Box<dyn Error>> { + #[cfg(not(any(target_os = "macos", windows)))] + if let SocketMessage::CreateWindow(window_options) = &mut options.message { + window_options.activation_token = + env::var("XDG_ACTIVATION_TOKEN").or_else(|_| env::var("DESKTOP_STARTUP_ID")).ok(); + } ipc::send_message(options.socket, options.message).map_err(|err| err.into()) } diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs index cfc3cd96..e3c39382 100644 --- a/alacritty/src/window_context.rs +++ b/alacritty/src/window_context.rs @@ -73,7 +73,7 @@ impl WindowContext { event_loop: &ActiveEventLoop, proxy: EventLoopProxy<Event>, config: Rc<UiConfig>, - options: WindowOptions, + mut options: WindowOptions, ) -> Result<Self, Box<dyn Error>> { let raw_display_handle = event_loop.display_handle().unwrap().as_raw(); @@ -83,7 +83,7 @@ impl WindowContext { // Windows has different order of GL platform initialization compared to any other platform; // it requires the window first. #[cfg(windows)] - let window = Window::new(event_loop, &config, &identity)?; + let window = Window::new(event_loop, &config, &identity, &mut options)?; #[cfg(windows)] let raw_window_handle = Some(window.raw_window_handle()); @@ -102,10 +102,9 @@ impl WindowContext { event_loop, &config, &identity, + &mut options, #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] gl_config.x11_visual(), - #[cfg(target_os = "macos")] - &options.window_tabbing_id, )?; // Create context. @@ -123,7 +122,7 @@ impl WindowContext { event_loop: &ActiveEventLoop, proxy: EventLoopProxy<Event>, config: Rc<UiConfig>, - options: WindowOptions, + mut options: WindowOptions, config_overrides: ParsedOptions, ) -> Result<Self, Box<dyn Error>> { let gl_display = gl_config.display(); @@ -135,10 +134,9 @@ impl WindowContext { event_loop, &config, &identity, + &mut options, #[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))] gl_config.x11_visual(), - #[cfg(target_os = "macos")] - &options.window_tabbing_id, )?; // Create context. diff --git a/extra/linux/org.alacritty.Alacritty.appdata.xml b/extra/linux/org.alacritty.Alacritty.appdata.xml index ddfdd281..e99ab8d4 100644 --- a/extra/linux/org.alacritty.Alacritty.appdata.xml +++ b/extra/linux/org.alacritty.Alacritty.appdata.xml @@ -1,13 +1,19 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Copyright 2016-2022 Joe Wilm, The Alacritty Project Contributors --> +<!-- SPDX-License-Identifier: MIT --> <component type="desktop-application"> <id>org.alacritty.Alacritty</id> - <!-- Translators: The application name --> + + <developer_name>Christian Duerr</developer_name> + <developer id="org.alacritty"> + <name>Christian Duerr</name> + </developer> + <name>Alacritty</name> - <project_license>APACHE-2.0</project_license> - <metadata_license>APACHE-2.0</metadata_license> - <!-- Translators: The application's summary / tagline --> - <summary>A fast, cross-platform, OpenGL terminal emulator</summary> + + <project_license>Apache-2.0</project_license> + <metadata_license>MIT</metadata_license> + + <summary>A cross-platform, OpenGL terminal emulator</summary> <description> <p> Alacritty is a modern terminal emulator that comes with sensible defaults, @@ -15,19 +21,28 @@ applications, rather than reimplementing their functionality, it manages to provide a flexible set of features with high performance. </p> + <ul> + <li>Wayland native</li> + <li>X11 native</li> + <li>DE agnostic</li> + </ul> </description> + + <categories> + <category>TerminalEmulator</category> + </categories> + <screenshots> <screenshot type="default"> - <image>https://user-images.githubusercontent.com/8886672/103264352-5ab0d500-49a2-11eb-8961-02f7da66c855.png</image> - <caption>Alacritty - A fast, cross-platform, OpenGL terminal emulator</caption> + <image>https://raw.githubusercontent.com/alacritty/alacritty/0a1e735cf6b13da1dbe5d161d17c8aa6c1692204/extra/promo/alacritty-readme.png</image> + <caption>Alacritty with default theme showing neovim</caption> </screenshot> </screenshots> - <keywords> - <keyword>terminal emulator</keyword> - <keyword>GPU</keyword> - </keywords> + <url type="homepage">https://github.com/alacritty/alacritty</url> <url type="bugtracker">https://github.com/alacritty/alacritty/issues</url> - <update_contact>https://github.com/alacritty/alacritty/blob/master/CONTRIBUTING.md#contact</update_contact> - <developer_name>Christian Duerr</developer_name> + + <launchable type="desktop-id">Alacritty.desktop</launchable> + + <content_rating type="oars-1.0" /> </component> |