mirror of
https://github.com/alacritty/alacritty.git
synced 2025-04-14 17:53:03 -04:00
parent
8cb359ad02
commit
e79f4b22d8
5 changed files with 31 additions and 13 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Reference in a new issue