diff options
author | a-kenji <aks.kenji@protonmail.com> | 2021-05-31 21:47:32 +0200 |
---|---|---|
committer | a-kenji <aks.kenji@protonmail.com> | 2021-06-14 21:55:17 +0200 |
commit | cafcca0c57696968b609c4f4a8c7a6fe7f2909a8 (patch) | |
tree | 46adb670807caa3c715962cf50022004de00dd65 /zellij-client/src | |
parent | 9cbe4107403e94b3545257c7b13acd7fdd2cf04c (diff) |
Move `layout.rs` from `server` to `utils`
* give feedback on most errors in the layout-file
Diffstat (limited to 'zellij-client/src')
-rw-r--r-- | zellij-client/src/lib.rs | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs index ece154ea7..83121b678 100644 --- a/zellij-client/src/lib.rs +++ b/zellij-client/src/lib.rs @@ -18,7 +18,7 @@ use zellij_utils::{ channels::{self, ChannelWithContext, SenderWithContext}, consts::{SESSION_NAME, ZELLIJ_IPC_PIPE}, errors::{ClientContext, ContextType, ErrorInstruction}, - input::{actions::Action, config::Config, options::Options}, + input::{actions::Action, config::Config, layout::Layout, options::Options}, ipc::{ClientAttributes, ClientToServerMsg, ExitReason, ServerToClientMsg}, }; @@ -86,19 +86,13 @@ pub fn start_client( opts: CliArgs, config: Config, info: ClientInfo, + layout: Option<Layout>, ) { let clear_client_terminal_attributes = "\u{1b}[?1l\u{1b}=\u{1b}[r\u{1b}12l\u{1b}[?1000l\u{1b}[?1002l\u{1b}[?1003l\u{1b}[?1005l\u{1b}[?1006l\u{1b}[?12l"; let take_snapshot = "\u{1b}[?1049h"; let bracketed_paste = "\u{1b}[?2004h"; os_input.unset_raw_mode(0); - let config_options = Options::from_cli(&config.options, opts.command.clone()); - let palette = config.themes.clone().map_or_else( - || os_input.load_palette(), - |t| { - t.theme_config(&config_options) - .unwrap_or_else(|| os_input.load_palette()) - }, - ); + let _ = os_input .get_stdout_writer() .write(take_snapshot.as_bytes()) @@ -109,6 +103,15 @@ pub fn start_client( .unwrap(); std::env::set_var(&"ZELLIJ", "0"); + let config_options = Options::from_cli(&config.options, opts.command.clone()); + let palette = config.themes.clone().map_or_else( + || os_input.load_palette(), + |t| { + t.theme_config(&config_options) + .unwrap_or_else(|| os_input.load_palette()) + }, + ); + let full_screen_ws = os_input.get_terminal_size_using_fd(0); let client_attributes = ClientAttributes { position_and_size: full_screen_ws, @@ -133,6 +136,7 @@ pub fn start_client( client_attributes, Box::new(opts), Box::new(config_options.clone()), + layout, ) } }; @@ -143,6 +147,7 @@ pub fn start_client( client_attributes, Box::new(opts), Box::new(config_options.clone()), + layout, ) }; |