diff options
author | Christian Duerr <contact@christianduerr.com> | 2022-08-31 22:48:38 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-01 01:48:38 +0300 |
commit | 4ddb608563d985060d69594d1004550a680ae3bd (patch) | |
tree | 0b02a330b3e59300cff80a147f3c1bdab7f9ea57 /alacritty/src/ipc.rs | |
parent | 18f9c2793924aec91c80a69ccb45f529adaffae5 (diff) | |
download | r-alacritty-4ddb608563d985060d69594d1004550a680ae3bd.tar.gz r-alacritty-4ddb608563d985060d69594d1004550a680ae3bd.tar.bz2 r-alacritty-4ddb608563d985060d69594d1004550a680ae3bd.zip |
Add IPC config subcommand
This patch adds a new mechanism for changing configuration options
without editing the configuration file, by sending options to running
instances through `alacritty msg`.
Each window will load Alacritty's configuration file by default and then
accept IPC messages for config updates using the `alacritty msg config`
subcommand. By default all windows will be updated, individual windows
can be addressed using `alacritty msg config --window-id
"$ALACRITTY_WINDOW_ID"`.
Each option will replace the config's current value and cannot be reset
until Alacritty is restarted or the option is overwritten with a new
value.
Configuration options are passed in the format `field.subfield=value`,
where `value` is interpreted as yaml.
Closes #472.
Diffstat (limited to 'alacritty/src/ipc.rs')
-rw-r--r-- | alacritty/src/ipc.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/alacritty/src/ipc.rs b/alacritty/src/ipc.rs index d4c807ba..e229a048 100644 --- a/alacritty/src/ipc.rs +++ b/alacritty/src/ipc.rs @@ -7,6 +7,7 @@ use std::path::PathBuf; use std::{env, fs, process}; use glutin::event_loop::EventLoopProxy; +use glutin::window::WindowId; use log::warn; use alacritty_terminal::thread; @@ -62,6 +63,14 @@ pub fn spawn_ipc_socket(options: &Options, event_proxy: EventLoopProxy<Event>) - let event = Event::new(EventType::CreateWindow(options), None); let _ = event_proxy.send_event(event); }, + SocketMessage::Config(ipc_config) => { + let window_id = ipc_config + .window_id + .and_then(|id| u64::try_from(id).ok()) + .map(WindowId::from); + let event = Event::new(EventType::IpcConfig(ipc_config), window_id); + let _ = event_proxy.send_event(event); + }, } } }); |