aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2024-08-23 15:41:48 +0200
committerGitHub <noreply@github.com>2024-08-23 15:41:48 +0200
commit820ff852310c92751e715017323035c4793eca10 (patch)
treea5f5e3e9ae9c4a3884eb5892328f84fec9869e3f
parentdocs(changelog): message to specific plugins API (diff)
downloadsl0ppij-820ff852310c92751e715017323035c4793eca10.tar.gz
sl0ppij-820ff852310c92751e715017323035c4793eca10.tar.xz
sl0ppij-820ff852310c92751e715017323035c4793eca10.zip
feat(ux): reload config options at runtime (#3564)
* change simplified_ui at runtime * change default_shell at runtime * change pane_frames (from config) at runtime * all other options * some refactoring * style(fmt): rustfmt
-rw-r--r--zellij-server/src/lib.rs32
-rw-r--r--zellij-server/src/panes/floating_panes/mod.rs11
-rw-r--r--zellij-server/src/panes/grid.rs3
-rw-r--r--zellij-server/src/panes/plugin_pane.rs11
-rw-r--r--zellij-server/src/panes/terminal_pane.rs8
-rw-r--r--zellij-server/src/panes/tiled_panes/mod.rs11
-rw-r--r--zellij-server/src/plugins/mod.rs4
-rw-r--r--zellij-server/src/plugins/plugin_map.rs3
-rw-r--r--zellij-server/src/plugins/wasm_bridge.rs4
-rw-r--r--zellij-server/src/pty.rs14
-rw-r--r--zellij-server/src/screen.rs123
-rw-r--r--zellij-server/src/tab/mod.rs35
-rw-r--r--zellij-utils/assets/config/default.kdl16
-rw-r--r--zellij-utils/src/data.rs11
-rw-r--r--zellij-utils/src/errors.rs1
-rw-r--r--zellij-utils/src/kdl/mod.rs48
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap13
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap10
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string.snap5
-rw-r--r--zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string_with_file_and_web.snap5
20 files changed, 311 insertions, 57 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs
index 537ba059..470ea88d 100644
--- a/zellij-server/src/lib.rs
+++ b/zellij-server/src/lib.rs
@@ -263,14 +263,33 @@ impl SessionMetaData {
}
pub fn propagate_configuration_changes(&mut self, config_changes: Vec<(ClientId, Config)>) {
for (client_id, new_config) in config_changes {
+ self.default_shell = new_config.options.default_shell.as_ref().map(|shell| {
+ TerminalAction::RunCommand(RunCommand {
+ command: shell.clone(),
+ cwd: new_config.options.default_cwd.clone(),
+ ..Default::default()
+ })
+ });
self.senders
.send_to_screen(ScreenInstruction::Reconfigure {
client_id,
- keybinds: Some(new_config.keybinds.clone()),
- default_mode: new_config.options.default_mode,
+ keybinds: new_config.keybinds.clone(),
+ default_mode: new_config
+ .options
+ .default_mode
+ .unwrap_or_else(Default::default),
theme: new_config
.theme_config(new_config.options.theme.as_ref())
- .or_else(|| Some(default_palette())),
+ .unwrap_or_else(|| default_palette()),
+ simplified_ui: new_config.options.simplified_ui.unwrap_or(false),
+ default_shell: new_config.options.default_shell,
+ pane_frames: new_config.options.pane_frames.unwrap_or(true),
+ copy_command: new_config.options.copy_command,
+ copy_to_clipboard: new_config.options.copy_clipboard,
+ copy_on_select: new_config.options.copy_on_select.unwrap_or(true),
+ auto_layout: new_config.options.auto_layout.unwrap_or(true),
+ rounded_corners: new_config.ui.pane_frames.rounded_corners,
+ hide_session_name: new_config.ui.pane_frames.hide_session_name,
})
.unwrap();
self.senders
@@ -278,6 +297,13 @@ impl SessionMetaData {
client_id,
keybinds: Some(new_config.keybinds),
default_mode: new_config.options.default_mode,
+ default_shell: self.default_shell.clone(),
+ })
+ .unwrap();
+ self.senders
+ .send_to_pty(PtyInstruction::Reconfigure {
+ client_id,
+ default_editor: new_config.options.scrollback_editor,
})
.unwrap();
}
diff --git a/zellij-server/src/panes/floating_panes/mod.rs b/zellij-server/src/panes/floating_panes/mod.rs
index 9bb438cb..2b586bbc 100644
--- a/zellij-server/src/panes/floating_panes/mod.rs
+++ b/zellij-server/src/panes/floating_panes/mod.rs
@@ -919,4 +919,15 @@ impl FloatingPanes {
pane.update_theme(theme);
}
}
+ pub fn update_pane_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ for pane in self.panes.values_mut() {
+ pane.update_arrow_fonts(should_support_arrow_fonts);
+ }
+ }
+ pub fn update_pane_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ for pane in self.panes.values_mut() {
+ pane.update_rounded_corners(rounded_corners);
+ }
+ }
}
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 55eee818..05d127a6 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -2158,6 +2158,9 @@ impl Grid {
pub fn update_theme(&mut self, theme: Palette) {
self.style.colors = theme.clone();
}
+ pub fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ self.arrow_fonts = should_support_arrow_fonts;
+ }
}
impl Perform for Grid {
diff --git a/zellij-server/src/panes/plugin_pane.rs b/zellij-server/src/panes/plugin_pane.rs
index 50c3236c..5ef548c2 100644
--- a/zellij-server/src/panes/plugin_pane.rs
+++ b/zellij-server/src/panes/plugin_pane.rs
@@ -681,6 +681,17 @@ impl Pane for PluginPane {
grid.update_theme(theme.clone());
}
}
+ fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ self.arrow_fonts = should_support_arrow_fonts;
+ for grid in self.grids.values_mut() {
+ grid.update_arrow_fonts(should_support_arrow_fonts);
+ }
+ self.set_should_render(true);
+ }
+ fn update_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ self.frame.clear();
+ }
}
impl PluginPane {
diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs
index 1c689dfe..872928c3 100644
--- a/zellij-server/src/panes/terminal_pane.rs
+++ b/zellij-server/src/panes/terminal_pane.rs
@@ -798,6 +798,14 @@ impl Pane for TerminalPane {
self.render_first_run_banner();
}
}
+ fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ self.arrow_fonts = should_support_arrow_fonts;
+ self.grid.update_arrow_fonts(should_support_arrow_fonts);
+ }
+ fn update_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ self.frame.clear();
+ }
}
impl TerminalPane {
diff --git a/zellij-server/src/panes/tiled_panes/mod.rs b/zellij-server/src/panes/tiled_panes/mod.rs
index 5baad9b9..7a528f2b 100644
--- a/zellij-server/src/panes/tiled_panes/mod.rs
+++ b/zellij-server/src/panes/tiled_panes/mod.rs
@@ -1772,6 +1772,17 @@ impl TiledPanes {
pane.update_theme(theme);
}
}
+ pub fn update_pane_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ for pane in self.panes.values_mut() {
+ pane.update_arrow_fonts(should_support_arrow_fonts);
+ }
+ }
+ pub fn update_pane_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ for pane in self.panes.values_mut() {
+ pane.update_rounded_corners(rounded_corners);
+ }
+ }
}
#[allow(clippy::borrowed_box)]
diff --git a/zellij-server/src/plugins/mod.rs b/zellij-server/src/plugins/mod.rs
index 62cc8916..593afbe0 100644
--- a/zellij-server/src/plugins/mod.rs
+++ b/zellij-server/src/plugins/mod.rs
@@ -148,6 +148,7 @@ pub enum PluginInstruction {
client_id: ClientId,
keybinds: Option<Keybinds>,
default_mode: Option<InputMode>,
+ default_shell: Option<TerminalAction>,
},
FailedToWriteConfigToDisk {
file_path: Option<PathBuf>,
@@ -778,11 +779,12 @@ pub(crate) fn plugin_thread_main(
client_id,
keybinds,
default_mode,
+ default_shell,
} => {
// TODO: notify plugins that this happened so that they can eg. rebind temporary keys that
// were lost
wasm_bridge
- .reconfigure(client_id, keybinds, default_mode)
+ .reconfigure(client_id, keybinds, default_mode, default_shell)
.non_fatal();
},
PluginInstruction::FailedToWriteConfigToDisk { file_path } => {
diff --git a/zellij-server/src/plugins/plugin_map.rs b/zellij-server/src/plugins/plugin_map.rs
index 6390841a..c33a6735 100644
--- a/zellij-server/src/plugins/plugin_map.rs
+++ b/zellij-server/src/plugins/plugin_map.rs
@@ -432,4 +432,7 @@ impl RunningPlugin {
pub fn update_default_mode(&mut self, default_mode: InputMode) {
self.store.data_mut().default_mode = default_mode;
}
+ pub fn update_default_shell(&mut self, default_shell: Option<TerminalAction>) {
+ self.store.data_mut().default_shell = default_shell;
+ }
}
diff --git a/zellij-server/src/plugins/wasm_bridge.rs b/zellij-server/src/plugins/wasm_bridge.rs
index 59ebe332..9e0583cf 100644
--- a/zellij-server/src/plugins/wasm_bridge.rs
+++ b/zellij-server/src/plugins/wasm_bridge.rs
@@ -826,6 +826,7 @@ impl WasmBridge {
client_id: ClientId,
keybinds: Option<Keybinds>,
default_mode: Option<InputMode>,
+ default_shell: Option<TerminalAction>,
) -> Result<()> {
let plugins_to_reconfigure: Vec<Arc<Mutex<RunningPlugin>>> = self
.plugin_map
@@ -848,10 +849,12 @@ impl WasmBridge {
if let Some(keybinds) = keybinds.as_ref() {
self.keybinds.insert(client_id, keybinds.clone());
}
+ self.default_shell = default_shell.clone();
for running_plugin in plugins_to_reconfigure {
task::spawn({
let running_plugin = running_plugin.clone();
let keybinds = keybinds.clone();
+ let default_shell = default_shell.clone();
async move {
let mut running_plugin = running_plugin.lock().unwrap();
if let Some(keybinds) = keybinds {
@@ -860,6 +863,7 @@ impl WasmBridge {
if let Some(default_mode) = default_mode {
running_plugin.update_default_mode(default_mode);
}
+ running_plugin.update_default_shell(default_shell);
}
});
}
diff --git a/zellij-server/src/pty.rs b/zellij-server/src/pty.rs
index 5a910af1..1ad549cd 100644
--- a/zellij-server/src/pty.rs
+++ b/zellij-server/src/pty.rs
@@ -100,6 +100,10 @@ pub enum PtyInstruction {
Option<FloatingPaneCoordinates>,
),
ListClientsMetadata(SessionLayoutMetadata, ClientId),
+ Reconfigure {
+ client_id: ClientId,
+ default_editor: Option<PathBuf>,
+ },
Exit,
}
@@ -123,6 +127,7 @@ impl From<&PtyInstruction> for PtyContext {
PtyInstruction::LogLayoutToHd(..) => PtyContext::LogLayoutToHd,
PtyInstruction::FillPluginCwd(..) => PtyContext::FillPluginCwd,
PtyInstruction::ListClientsMetadata(..) => PtyContext::ListClientsMetadata,
+ PtyInstruction::Reconfigure { .. } => PtyContext::Reconfigure,
PtyInstruction::Exit => PtyContext::Exit,
}
}
@@ -765,6 +770,12 @@ pub(crate) fn pty_thread_main(mut pty: Pty, layout: Box<Layout>) -> Result<()> {
floating_pane_coordinates,
)?;
},
+ PtyInstruction::Reconfigure {
+ default_editor,
+ client_id,
+ } => {
+ pty.reconfigure(default_editor);
+ },
PtyInstruction::Exit => break,
}
}
@@ -1545,6 +1556,9 @@ impl Pty {
))?;
Ok(())
}
+ pub fn reconfigure(&mut self, default_editor: Option<PathBuf>) {
+ self.default_editor = default_editor;
+ }
}
impl Drop for Pty {
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 8dd01ac2..9c88396a 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -54,7 +54,7 @@ use zellij_utils::{
PluginCapabilities, Style, TabInfo,
},
errors::{ContextType, ScreenContext},
- input::{get_mode_info, options::Options},
+ input::get_mode_info,
ipc::{ClientAttributes, PixelDimensions, ServerToClientMsg},
};
@@ -366,9 +366,18 @@ pub enum ScreenInstruction {
ListClientsMetadata(Option<PathBuf>, ClientId), // Option<PathBuf> - default shell
Reconfigure {
client_id: ClientId,
- keybinds: Option<Keybinds>,
- default_mode: Option<InputMode>,
- theme: Option<Palette>,
+ keybinds: Keybinds,
+ default_mode: InputMode,
+ theme: Palette,
+ simplified_ui: bool,
+ default_shell: Option<PathBuf>,
+ pane_frames: bool,
+ copy_command: Option<String>,
+ copy_to_clipboard: Option<Clipboard>,
+ copy_on_select: bool,
+ auto_layout: bool,
+ rounded_corners: bool,
+ hide_session_name: bool,
},
RerunCommandPane(u32), // u32 - terminal pane id
}
@@ -1743,6 +1752,7 @@ impl Screen {
.unwrap_or(&self.default_mode_info);
let previous_mode = previous_mode_info.mode;
mode_info.style = previous_mode_info.style;
+ mode_info.capabilities = previous_mode_info.capabilities;
let err_context = || {
format!(
@@ -2182,22 +2192,48 @@ impl Screen {
}
Ok(())
}
- pub fn reconfigure_mode_info(
+ pub fn reconfigure(
&mut self,
- new_keybinds: Option<Keybinds>,
- new_default_mode: Option<InputMode>,
- theme: Option<Palette>,
+ new_keybinds: Keybinds,
+ new_default_mode: InputMode,
+ theme: Palette,
+ simplified_ui: bool,
+ default_shell: Option<PathBuf>,
+ pane_frames: bool,
+ copy_command: Option<String>,
+ copy_to_clipboard: Option<Clipboard>,
+ copy_on_select: bool,
+ auto_layout: bool,
+ rounded_corners: bool,
+ hide_session_name: bool,
client_id: ClientId,
) -> Result<()> {
- let should_update_mode_info =
- new_keybinds.is_some() || new_default_mode.is_some() || theme.is_some();
+ let should_support_arrow_fonts = !simplified_ui;
- // themes are currently global and not per-client
- if let Some(theme) = theme {
- self.default_mode_info.update_theme(theme);
- for tab in self.tabs.values_mut() {
- tab.update_theme(theme);
- }
+ // global configuration
+ self.default_mode_info.update_theme(theme);
+ self.default_mode_info
+ .update_rounded_corners(rounded_corners);
+ self.default_shell = default_shell.clone();
+ self.auto_layout = auto_layout;
+ self.copy_options.command = copy_command.clone();
+ self.copy_options.copy_on_select = copy_on_select;
+ self.draw_pane_frames = pane_frames;
+ self.default_mode_info
+ .update_arrow_fonts(should_support_arrow_fonts);
+ self.default_mode_info
+ .update_hide_session_name(hide_session_name);
+ if let Some(copy_to_clipboard) = copy_to_clipboard {
+ self.copy_options.clipboard = copy_to_clipboard;
+ }
+ for tab in self.tabs.values_mut() {
+ tab.update_theme(theme);
+ tab.update_rounded_corners(rounded_corners);
+ tab.update_default_shell(default_shell.clone());
+ tab.update_auto_layout(auto_layout);
+ tab.update_copy_options(&self.copy_options);
+ tab.set_pane_frames(pane_frames);
+ tab.update_arrow_fonts(should_support_arrow_fonts);
}
// client specific configuration
@@ -2206,27 +2242,21 @@ impl Screen {
.mode_info
.entry(client_id)
.or_insert_with(|| self.default_mode_info.clone());
- if let Some(new_keybinds) = new_keybinds {
- mode_info.update_keybinds(new_keybinds);
- }
- if let Some(new_default_mode) = new_default_mode {
- mode_info.update_default_mode(new_default_mode);
- }
- if let Some(theme) = theme {
- mode_info.update_theme(theme);
- }
- if should_update_mode_info {
- for tab in self.tabs.values_mut() {
- tab.change_mode_info(mode_info.clone(), client_id);
- tab.mark_active_pane_for_rerender(client_id);
- }
+ mode_info.update_keybinds(new_keybinds);
+ mode_info.update_default_mode(new_default_mode);
+ mode_info.update_theme(theme);
+ mode_info.update_arrow_fonts(should_support_arrow_fonts);
+ mode_info.update_hide_session_name(hide_session_name);
+ for tab in self.tabs.values_mut() {
+ tab.change_mode_info(mode_info.clone(), client_id);
+ tab.mark_active_pane_for_rerender(client_id);
}
}
- if should_update_mode_info {
- for tab in self.tabs.values_mut() {
- tab.update_input_modes()?;
- }
+ // this needs to be done separately at the end because it applies some of the above changes
+ // and propagates them to plugins
+ for tab in self.tabs.values_mut() {
+ tab.update_input_modes()?;
}
Ok(())
}
@@ -4104,9 +4134,32 @@ pub(crate) fn screen_thread_main(
keybinds,
default_mode,
theme,
+ simplified_ui,
+ default_shell,
+ pane_frames,
+ copy_to_clipboard,
+ copy_command,
+ copy_on_select,
+ auto_layout,
+ rounded_corners,
+ hide_session_name,
} => {
screen
- .reconfigure_mode_info(keybinds, default_mode, theme, client_id)
+ .reconfigure(
+ keybinds,
+ default_mode,
+ theme,
+ simplified_ui,
+ default_shell,
+ pane_frames,
+ copy_command,
+ copy_to_clipboard,
+ copy_on_select,
+ auto_layout,
+ rounded_corners,
+ hide_session_name,
+ client_id,
+ )
.non_fatal();
},
ScreenInstruction::RerunCommandPane(terminal_pane_id) => {
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 44673dad..4d507d46 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -493,6 +493,8 @@ pub trait Pane {
None
} // only relevant to terminal panes
fn update_theme(&mut self, _theme: Palette) {}
+ fn update_arrow_fonts(&mut self, _should_support_arrow_fonts: bool) {}
+ fn update_rounded_corners(&mut self, _rounded_corners: bool) {}
}
#[derive(Clone, Debug)]
@@ -3960,6 +3962,39 @@ impl Tab {
pane.update_theme(theme);
}
}
+ pub fn update_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ self.floating_panes
+ .update_pane_rounded_corners(rounded_corners);
+ self.tiled_panes
+ .update_pane_rounded_corners(rounded_corners);
+ for (_, pane) in self.suppressed_panes.values_mut() {
+ pane.update_rounded_corners(rounded_corners);
+ }
+ }
+ pub fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ self.arrow_fonts = should_support_arrow_fonts;
+ self.floating_panes
+ .update_pane_arrow_fonts(should_support_arrow_fonts);
+ self.tiled_panes
+ .update_pane_arrow_fonts(should_support_arrow_fonts);
+ for (_, pane) in self.suppressed_panes.values_mut() {
+ pane.update_arrow_fonts(should_support_arrow_fonts);
+ }
+ }
+ pub fn update_default_shell(&mut self, default_shell: Option<PathBuf>) {
+ self.default_shell = default_shell;
+ }
+ pub fn update_copy_options(&mut self, copy_options: &CopyOptions) {
+ self.clipboard_provider = match &copy_options.command {
+ Some(command) => ClipboardProvider::Command(CopyCommand::new(command.clone())),
+ None => ClipboardProvider::Osc52(copy_options.clipboard),
+ };
+ self.copy_on_select = copy_options.copy_on_select;
+ }
+ pub fn update_auto_layout(&mut self, auto_layout: bool) {
+ self.auto_layout = auto_layout;
+ }
}
pub fn pane_info_for_pane(pane_id: &PaneId, pane: &Box<dyn Pane>) -> PaneInfo {
diff --git a/zellij-utils/assets/config/default.kdl b/zellij-utils/assets/config/default.kdl
index 95f42fe4..9d2afa40 100644
--- a/zellij-utils/assets/config/default.kdl
+++ b/zellij-utils/assets/config/default.kdl
@@ -193,6 +193,8 @@ keybinds {
}
}
+// Plugin aliases - can be used to change the implementation of Zellij
+// changing these requires a restart to take effect
plugins {
tab-bar location="zellij:tab-bar"
status-bar location="zellij:status-bar"
@@ -210,6 +212,7 @@ plugins {
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
// eg. when terminal window with an active zellij session is closed
+// (Requires restart)
// Options:
// - detach (Default)
// - quit
@@ -247,6 +250,7 @@ plugins {
// auto_layout true
// Whether sessions should be serialized to the cache folder (including their tabs/panes, cwds and running commands) so that they can later be resurrected
+// (Requires restart)
// Options:
// - true (default)
// - false
@@ -254,14 +258,17 @@ plugins {
// session_serialization false
// Whether pane viewports are serialized along with the session, default is false
+// (Requires restart)
// Options:
// - true
// - false (default)
+//
// serialize_pane_viewport true
// Scrollback lines to serialize along with the pane viewport when serializing sessions, 0
// defaults to the scrollback size. If this number is higher than the scrollback size, it will
// also default to the scrollback size. This does nothing if `serialize_pane_viewport` is not true.
+// (Requires restart)
//
// scrollback_lines_to_serialize 10000
@@ -292,6 +299,7 @@ plugins {
// The name of the default layout to load on startup
// Default: "default"
+// (Requires restart)
//
// default_layout "compact"
@@ -303,6 +311,7 @@ plugins {
// Toggle enabling the mouse mode.
// On certain configurations, or terminals this could
// potentially interfere with copying text.
+// (Requires restart)
// Options:
// - true (default)
// - false
@@ -312,6 +321,7 @@ plugins {
// Configure the scroll back buffer size
// This is the number of lines zellij stores for each pane in the scroll back
// buffer. Excess number of lines are discarded in a FIFO fashion.
+// (Requires restart)
// Valid values: positive integers
// Default value: 10000
//
@@ -349,31 +359,37 @@ plugins {
// When attaching to an existing session with other users,
// should the session be mirrored (true)
// or should each user have their own cursor (false)
+// (Requires restart)
// Default: false
//
// mirror_session true
// The folder in which Zellij will look for layouts
+// (Requires restart)
//
// layout_dir "/path/to/my/layout_dir"
// The folder in which Zellij will look for themes
+// (Requires restart)
//
// theme_dir "/path/to/my/theme_dir"
// Enable or disable the rendering of styled and colored underlines (undercurl).
// May need to be disabled for certain unsupported terminals
+// (Requires restart)
// Default: true
//
// styled_underlines false
// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know
// metadata info on this session)
+// (Requires restart)
// Default: false
//
// disable_session_metadata true
// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it)
+// (Requires restart)
// Default: true (if the host terminal supports it)
//
// support_kitty_keyboard_protocol false
diff --git a/zellij-utils/src/data.rs b/zellij-utils/src/data.rs
index f1e95df2..85897839 100644
--- a/zellij-utils/src/data.rs
+++ b/zellij-utils/src/data.rs
@@ -1178,6 +1178,17 @@ impl ModeInfo {
pub fn update_theme(&mut self, theme: Palette) {
self.style.colors = theme;
}
+ pub fn update_rounded_corners(&mut self, rounded_corners: bool) {
+ self.style.rounded_corners = rounded_corners;
+ }
+ pub fn update_arrow_fonts(&mut self, should_support_arrow_fonts: bool) {
+ // it is honestly quite baffling to me how "arrow_fonts: false" can mean "I support arrow
+ // fonts", but since this is a public API... ¯\_(ツ)_/¯
+ self.capabilities.arrow_fonts = !should_support_arrow_fonts;
+ }
+ pub fn update_hide_session_name(&mut self, hide_session_name: bool) {
+ self.style.hide_session_name = hide_session_name;
+ }
}
#[derive(Debug, Default, Clone, PartialEq, Eq, Deserialize, Serialize)]
diff --git a/zellij-utils/src/errors.rs b/zellij-utils/src/errors.rs
index 21b9294e..44dd206d 100644
--- a/zellij-utils/src/errors.rs
+++ b/zellij-utils/src/errors.rs
@@ -377,6 +377,7 @@ pub enum PtyContext {
FillPluginCwd,
DumpLayoutToPlugin,
ListClientsMetadata,
+ Reconfigure,
Exit,
}
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs
index dfa1f9ad..3c8aeb71 100644
--- a/zellij-utils/src/kdl/mod.rs
+++ b/zellij-utils/src/kdl/mod.rs
@@ -2427,8 +2427,11 @@ impl Options {
}
fn layout_dir_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}",
- " ", "// The folder in which Zellij will look for layouts", "// ",
+ "{}\n{}\n{}\n{}",
+ " ",
+ "// The folder in which Zellij will look for layouts",
+ "// (Requires restart)",
+ "// ",
);
let create_node = |node_value: &str| -> KdlNode {
@@ -2452,8 +2455,11 @@ impl Options {
}
fn theme_dir_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}",
- " ", "// The folder in which Zellij will look for themes", "// ",
+ "{}\n{}\n{}\n{}",
+ " ",
+ "// The folder in which Zellij will look for themes",
+ "// (Requires restart)",
+ "// ",
);
let create_node = |node_value: &str| -> KdlNode {
@@ -2539,11 +2545,12 @@ impl Options {
}
fn mirror_session_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}\n{}\n{}\n{}",
+ "{}\n{}\n{}\n{}\n{}\n{}\n{}",
" ",
"// When attaching to an existing session with other users,",
"// should the session be mirrored (true)",
"// or should each user have their own cursor (false)",
+ "// (Requires restart)",
"// Default: false",
"// ",
);
@@ -2569,10 +2576,11 @@ impl Options {
}
fn on_force_close_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}\n{}\n{}\n{}\n{}",
+ "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
" ",
"// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP",
"// eg. when terminal window with an active zellij session is closed",
+ "// (Requires restart)",
"// Options:",
"// - detach (Default)",
"// - quit",
@@ -2603,11 +2611,12 @@ impl Options {
}
fn scroll_buffer_size_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}\n{}\n{}\n{}\n{}",
+ "{}\n{}\n{}\n{}\n{}\n{}\n{}\n{}",
" ",
"// Configure the scroll back buffer size",
"// This is the number of lines zellij stores for each pane in the scroll back",
"// buffer. Excess number of lines are discarded in a FIFO fashion.",
+ "// (Requires restart)",
"// Valid values: positive integers",
"// Default value: 10000",
"// ",
@@ -2933,10 +2942,11 @@ impl Options {
}
fn styled_underlines_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
let comment_text = format!(
- "{}\n{}\n{}\n{}\n{}",
+ "{}\n{}\n{}\n{}\n{}\n{}",
" ",
"// Enable or disable the rendering of styled and colored underlines (undercurl).",
"// May need to be disabled for certain unsupported terminals",
+ "// (Requires restart)",
"// Default: true",
"// ",
);
@@ -2986,10 +2996,11 @@ impl Options {
}
}
fn disable_session_metadata_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
- let comment_text = format!("{}\n{}\n{}\n{}\n{}",
+ let comment_text = format!("{}\n{}\n{}\n{}\n{}\n{}",
" ",
"// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know",
"// metadata info on this session)",
+ "// (Requires restart)",
"// Default: false",
"// ",
);
@@ -3014,9 +3025,10 @@ impl Options {
}
}
fn support_kitty_keyboard_protocol_to_kdl(&self, add_comments: bool) -> Option<KdlNode> {
- let comment_text = format!("{}\n{}\n{}\n{}",
+ let comment_text = format!("{}\n{}\n{}\n{}\n{}",
" ",
"// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it)",
+ "// (Requires restart)",
"// Default: true (if the host terminal supports it)",
"// ",
);
@@ -3625,7 +3637,7 @@ impl Config {
document.nodes_mut().push(themes);
}
- let plugins = self.plugins.to_kdl();
+ let plugins = self.plugins.to_kdl(add_comments);
document.nodes_mut().push(plugins);
if let Some(ui_config) = self.ui.to_kdl() {
@@ -3667,7 +3679,7 @@ impl PluginAliases {
}
Ok(PluginAliases { aliases })
}
- pub fn to_kdl(&self) -> KdlNode {
+ pub fn to_kdl(&self, add_comments: bool) -> KdlNode {
let mut plugins = KdlNode::new("plugins");
let mut plugins_children = KdlDocument::new();
for (alias_name, plugin_alias) in self.aliases.iter() {
@@ -3705,6 +3717,14 @@ impl PluginAliases {
plugins_children.nodes_mut().push(plugin_alias_node);
}
plugins.set_children(plugins_children);
+
+ if add_comments {
+ plugins.set_leading(format!(
+ "\n{}\n{}\n",
+ "// Plugin aliases - can be used to change the implementation of Zellij",
+ "// changing these requires a restart to take effect",
+ ));
+ }
plugins
}
}
@@ -5147,7 +5167,7 @@ fn plugins_to_string() {
}"##;
let document: KdlDocument = fake_config.parse().unwrap();
let deserialized = PluginAliases::from_kdl(document.get("plugins").unwrap()).unwrap();
- let serialized = PluginAliases::to_kdl(&deserialized);
+ let serialized = PluginAliases::to_kdl(&deserialized, true);
let deserialized_from_serialized = PluginAliases::from_kdl(
serialized
.to_string()
@@ -5175,7 +5195,7 @@ fn plugins_to_string_with_file_and_web() {
}"##;
let document: KdlDocument = fake_config.parse().unwrap();
let deserialized = PluginAliases::from_kdl(document.get("plugins").unwrap()).unwrap();
- let serialized = PluginAliases::to_kdl(&deserialized);
+ let serialized = PluginAliases::to_kdl(&deserialized, true);
let deserialized_from_serialized = PluginAliases::from_kdl(
serialized
.to_string()
diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap
index 443f1017..c30dca10 100644
--- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap
+++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__bare_config_from_default_assets_to_string_with_comments.snap
@@ -1,6 +1,6 @@
---
source: zellij-utils/src/kdl/mod.rs
-assertion_line: 5069
+assertion_line: 5441
expression: fake_config_stringified
---
keybinds clear-defaults=true {
@@ -223,6 +223,9 @@ keybinds clear-defaults=true {
bind "z" { ToggleFocusFullscreen; SwitchToMode "normal"; }
}
}
+
+// Plugin aliases - can be used to change the implementation of Zellij
+// changing these requires a restart to take effect
plugins {
compact-bar location="zellij:compact-bar"
configuration location="zellij:configuration"
@@ -270,10 +273,12 @@ plugins {
// default_layout "compact"
// The folder in which Zellij will look for layouts
+// (Requires restart)
//
// layout_dir "/tmp"
// The folder in which Zellij will look for themes
+// (Requires restart)
//
// theme_dir "/tmp"
@@ -296,12 +301,14 @@ plugins {
// When attaching to an existing session with other users,
// should the session be mirrored (true)
// or should each user have their own cursor (false)
+// (Requires restart)
// Default: false
//
// mirror_session true
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
// eg. when terminal window with an active zellij session is closed
+// (Requires restart)
// Options:
// - detach (Default)
// - quit
@@ -311,6 +318,7 @@ plugins {
// Configure the scroll back buffer size
// This is the number of lines zellij stores for each pane in the scroll back
// buffer. Excess number of lines are discarded in a FIFO fashion.
+// (Requires restart)
// Valid values: positive integers
// Default value: 10000
//
@@ -388,6 +396,7 @@ plugins {
// Enable or disable the rendering of styled and colored underlines (undercurl).
// May need to be disabled for certain unsupported terminals
+// (Requires restart)
// Default: true
//
// styled_underlines false
@@ -398,11 +407,13 @@ plugins {
// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know
// metadata info on this session)
+// (Requires restart)
// Default: false
//
// disable_session_metadata false
// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it)
+// (Requires restart)
// Default: true (if the host terminal supports it)
//
// support_kitty_keyboard_protocol false
diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap
index 3d0736e0..00fd6320 100644
--- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap
+++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__config_options_to_string_with_comments.snap
@@ -1,6 +1,6 @@
---
source: zellij-utils/src/kdl/mod.rs
-assertion_line: 4987
+assertion_line: 5380
expression: fake_document.to_string()
---
@@ -36,10 +36,12 @@ default_cwd "/tmp/foo"
default_layout "compact"
// The folder in which Zellij will look for layouts
+// (Requires restart)
//
layout_dir "/tmp/layouts"
// The folder in which Zellij will look for themes
+// (Requires restart)
//
theme_dir "/tmp/themes"
@@ -62,12 +64,14 @@ pane_frames false
// When attaching to an existing session with other users,
// should the session be mirrored (true)
// or should each user have their own cursor (false)
+// (Requires restart)
// Default: false
//
mirror_session true
// Choose what to do when zellij receives SIGTERM, SIGINT, SIGQUIT or SIGHUP
// eg. when terminal window with an active zellij session is closed
+// (Requires restart)
// Options:
// - detach (Default)
// - quit
@@ -77,6 +81,7 @@ on_force_close "quit"
// Configure the scroll back buffer size
// This is the number of lines zellij stores for each pane in the scroll back
// buffer. Excess number of lines are discarded in a FIFO fashion.
+// (Requires restart)
// Valid values: positive integers
// Default value: 10000
//
@@ -154,6 +159,7 @@ scrollback_lines_to_serialize 1000
// Enable or disable the rendering of styled and colored underlines (undercurl).
// May need to be disabled for certain unsupported terminals
+// (Requires restart)
// Default: true
//
styled_underlines false
@@ -164,11 +170,13 @@ serialization_interval 1
// Enable or disable writing of session metadata to disk (if disabled, other sessions might not know
// metadata info on this session)
+// (Requires restart)
// Default: false
//
disable_session_metadata true
// Enable or disable support for the enhanced Kitty Keyboard Protocol (the host terminal must also support it)
+// (Requires restart)
// Default: true (if the host terminal supports it)
//
support_kitty_keyboard_protocol false
diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string.snap
index 694f2c15..3988ac01 100644
--- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string.snap
+++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string.snap
@@ -1,8 +1,11 @@
---
source: zellij-utils/src/kdl/mod.rs
-assertion_line: 3874
+assertion_line: 5184
expression: serialized.to_string()
---
+
+// Plugin aliases - can be used to change the implementation of Zellij
+// changing these requires a restart to take effect
plugins {
compact-bar location="zellij:compact-bar"
filepicker location="zellij:strider" {
diff --git a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string_with_file_and_web.snap b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string_with_file_and_web.snap
index 4f998225..0e776bff 100644
--- a/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string_with_file_and_web.snap
+++ b/zellij-utils/src/kdl/snapshots/zellij_utils__kdl__plugins_to_string_with_file_and_web.snap
@@ -1,8 +1,11 @@
---
source: zellij-utils/src/kdl/mod.rs
-assertion_line: 3891
+assertion_line: 5212
expression: serialized.to_string()
---
+
+// Plugin aliases - can be used to change the implementation of Zellij
+// changing these requires a restart to take effect
plugins {
filepicker location="file:/path/to/my/plugin.wasm" {
cwd "/"