aboutsummaryrefslogtreecommitdiff
path: root/alacritty/src/main.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2021-11-22 21:34:09 +0300
committerGitHub <noreply@github.com>2021-11-22 18:34:09 +0000
commit8681f71084894db6d1e258be17db1f80bb669314 (patch)
tree24d3c0ced916d2d171fd03f50cd34dcda8f0aa06 /alacritty/src/main.rs
parentc89939b5d14e581e1aeaa940d81843192e0abc79 (diff)
downloadr-alacritty-8681f71084894db6d1e258be17db1f80bb669314.tar.gz
r-alacritty-8681f71084894db6d1e258be17db1f80bb669314.tar.bz2
r-alacritty-8681f71084894db6d1e258be17db1f80bb669314.zip
Add parameters to `msg create-window` subcommand
Alacritty's `msg create-window` subcommand would previously inherit all the CLI parameters from the original executable. However not only could this lead to unexpected behavior, it also prevents multi-window users from making use of parameters like `-e`, `--working-directory`, or `--hold`. This is solved by adding a JSON-based message format to the IPC socket messages which instructs the Alacritty server on which CLI parameters should be used to create the new window. Fixes #5562. Fixes #5561. Fixes #5560.
Diffstat (limited to 'alacritty/src/main.rs')
-rw-r--r--alacritty/src/main.rs26
1 files changed, 12 insertions, 14 deletions
diff --git a/alacritty/src/main.rs b/alacritty/src/main.rs
index 74e27b84..a5624a7b 100644
--- a/alacritty/src/main.rs
+++ b/alacritty/src/main.rs
@@ -53,10 +53,8 @@ mod gl {
use crate::cli::Options;
#[cfg(unix)]
use crate::cli::{MessageOptions, Subcommands};
-use crate::config::{monitor, Config};
+use crate::config::{monitor, UiConfig};
use crate::event::{Event, Processor};
-#[cfg(unix)]
-use crate::ipc::SOCKET_MESSAGE_CREATE_WINDOW;
#[cfg(target_os = "macos")]
use crate::macos::locale;
@@ -94,7 +92,7 @@ fn main() {
/// `msg` subcommand entrypoint.
#[cfg(unix)]
fn msg(options: MessageOptions) -> Result<(), String> {
- ipc::send_message(options.socket, &SOCKET_MESSAGE_CREATE_WINDOW).map_err(|err| err.to_string())
+ ipc::send_message(options.socket, options.message).map_err(|err| err.to_string())
}
/// Temporary files stored for Alacritty.
@@ -142,10 +140,10 @@ fn alacritty(options: Options) -> Result<(), String> {
log_config_path(&config);
// Update the log level from config.
- log::set_max_level(config.ui_config.debug.log_level);
+ log::set_max_level(config.debug.log_level);
// Set environment variables.
- tty::setup_env(&config);
+ tty::setup_env(&config.terminal_config);
// Switch to home directory.
#[cfg(target_os = "macos")]
@@ -159,20 +157,20 @@ fn alacritty(options: Options) -> Result<(), String> {
//
// The monitor watches the config file for changes and reloads it. Pending
// config changes are processed in the main loop.
- if config.ui_config.live_config_reload {
- monitor::watch(config.ui_config.config_paths.clone(), window_event_loop.create_proxy());
+ if config.live_config_reload {
+ monitor::watch(config.config_paths.clone(), window_event_loop.create_proxy());
}
// Create the IPC socket listener.
#[cfg(unix)]
- let socket_path = if config.ui_config.ipc_socket {
+ let socket_path = if config.ipc_socket {
ipc::spawn_ipc_socket(&options, window_event_loop.create_proxy())
} else {
None
};
// Setup automatic RAII cleanup for our files.
- let log_cleanup = log_file.filter(|_| !config.ui_config.debug.persistent_logging);
+ let log_cleanup = log_file.filter(|_| !config.debug.persistent_logging);
let _files = TemporaryFiles {
#[cfg(unix)]
socket_path,
@@ -184,7 +182,7 @@ fn alacritty(options: Options) -> Result<(), String> {
// Create the first Alacritty window.
let proxy = window_event_loop.create_proxy();
- processor.create_window(&window_event_loop, proxy).map_err(|err| err.to_string())?;
+ processor.create_window(&window_event_loop, None, proxy).map_err(|err| err.to_string())?;
info!("Initialisation complete");
@@ -217,13 +215,13 @@ fn alacritty(options: Options) -> Result<(), String> {
Ok(())
}
-fn log_config_path(config: &Config) {
- if config.ui_config.config_paths.is_empty() {
+fn log_config_path(config: &UiConfig) {
+ if config.config_paths.is_empty() {
return;
}
let mut msg = String::from("Configuration files loaded from:");
- for path in &config.ui_config.config_paths {
+ for path in &config.config_paths {
msg.push_str(&format!("\n {:?}", path.display()));
}