aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/window_context.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty/src/window_context.rs')
-rw-r--r--alacritty/src/window_context.rs31
1 files changed, 25 insertions, 6 deletions
diff --git a/alacritty/src/window_context.rs b/alacritty/src/window_context.rs
index 130f42d6..795b3f73 100644
--- a/alacritty/src/window_context.rs
+++ b/alacritty/src/window_context.rs
@@ -19,7 +19,6 @@ use serde_json as json;
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
use wayland_client::EventQueue;
-use alacritty_terminal::config::PtyConfig;
use alacritty_terminal::event::Event as TerminalEvent;
use alacritty_terminal::event_loop::{EventLoop as PtyEventLoop, Msg, Notifier};
use alacritty_terminal::grid::{Dimensions, Scroll};
@@ -28,6 +27,7 @@ use alacritty_terminal::sync::FairMutex;
use alacritty_terminal::term::{Term, TermMode};
use alacritty_terminal::tty;
+use crate::cli::WindowOptions;
use crate::clipboard::Clipboard;
use crate::config::UiConfig;
use crate::display::Display;
@@ -50,6 +50,7 @@ pub struct WindowContext {
font_size: Size,
mouse: Mouse,
dirty: bool,
+ preserve_title: bool,
#[cfg(not(windows))]
master_fd: RawFd,
#[cfg(not(windows))]
@@ -60,18 +61,26 @@ impl WindowContext {
/// Create a new terminal window context.
pub fn new(
config: &UiConfig,
- pty_config: &PtyConfig,
+ options: &WindowOptions,
window_event_loop: &EventLoopWindowTarget<Event>,
proxy: EventLoopProxy<Event>,
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
wayland_event_queue: Option<&EventQueue>,
) -> Result<Self, Box<dyn Error>> {
+ let mut pty_config = config.terminal_config.pty_config.clone();
+ options.terminal_options.override_pty_config(&mut pty_config);
+
+ let mut identity = config.window.identity.clone();
+ let preserve_title = options.window_identity.title.is_some();
+ options.window_identity.override_identity_config(&mut identity);
+
// Create a display.
//
// The display manages a window and can draw the terminal.
let display = Display::new(
config,
window_event_loop,
+ &identity,
#[cfg(all(feature = "wayland", not(any(target_os = "macos", windows))))]
wayland_event_queue,
)?;
@@ -97,7 +106,7 @@ impl WindowContext {
// The PTY forks a process to run the shell on the slave side of the
// pseudoterminal. A file descriptor for the master side is retained for
// reading/writing to the shell.
- let pty = tty::new(pty_config, &display.size_info, display.window.x11_window_id())?;
+ let pty = tty::new(&pty_config, &display.size_info, display.window.x11_window_id())?;
#[cfg(not(windows))]
let master_fd = pty.file().as_raw_fd();
@@ -136,6 +145,7 @@ impl WindowContext {
notifier: Notifier(loop_tx),
terminal,
display,
+ preserve_title,
#[cfg(not(windows))]
master_fd,
#[cfg(not(windows))]
@@ -183,9 +193,18 @@ impl WindowContext {
self.display.pending_update.dirty = true;
}
- // Live title reload.
- if !config.window.dynamic_title || old_config.window.title != config.window.title {
- self.display.window.set_title(&config.window.title);
+ // Update title on config reload according to the following table.
+ //
+ // │cli │ dynamic_title │ current_title == old_config ││ set_title │
+ // │ Y │ _ │ _ ││ N │
+ // │ N │ Y │ Y ││ Y │
+ // │ N │ Y │ N ││ N │
+ // │ N │ N │ _ ││ Y │
+ if !self.preserve_title
+ && (!config.window.dynamic_title
+ || self.display.window.title() == old_config.window.identity.title)
+ {
+ self.display.window.set_title(config.window.identity.title.clone());
}
// Set subpixel anti-aliasing.