summaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-30 15:17:55 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-30 15:17:55 +0200
commit0be151fa28b6b0634271091f961048e8318fddc2 (patch)
tree382d3e3fe0a73ff127e19dd693589bcca824b842 /zellij-server
parentce73b6cca0d6132a57a5a7a2321e1cec8b071720 (diff)
parentfe299325eb54e6642d27a417a3922a757b4390e4 (diff)
Merge branch 'main' of https://github.com/zellij-org/zellij into theme-config
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/lib.rs13
-rw-r--r--zellij-server/src/os_input_output.rs8
-rw-r--r--zellij-server/src/route.rs2
-rw-r--r--zellij-server/src/screen.rs4
4 files changed, 18 insertions, 9 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs
index 8f1ad73a5..1691420e4 100644
--- a/zellij-server/src/lib.rs
+++ b/zellij-server/src/lib.rs
@@ -15,7 +15,7 @@ use std::path::PathBuf;
use std::sync::{Arc, Mutex, RwLock};
use std::thread;
use wasmer::Store;
-use zellij_tile::data::{Event, InputMode,Palette, PluginCapabilities};
+use zellij_tile::data::{Event, Palette, PluginCapabilities};
use crate::{
os_input_output::ServerOsApi,
@@ -44,7 +44,7 @@ pub(crate) enum ServerInstruction {
ClientExit,
Error(String),
DetachSession,
- AttachClient(ClientAttributes, bool),
+ AttachClient(ClientAttributes, bool, Options),
}
impl From<ClientToServerMsg> for ServerInstruction {
@@ -53,8 +53,8 @@ impl From<ClientToServerMsg> for ServerInstruction {
ClientToServerMsg::NewClient(attrs, opts, options) => {
ServerInstruction::NewClient(attrs, opts, options)
}
- ClientToServerMsg::AttachClient(attrs, force) => {
- ServerInstruction::AttachClient(attrs, force)
+ ClientToServerMsg::AttachClient(attrs, force, options) => {
+ ServerInstruction::AttachClient(attrs, force, options)
}
_ => unreachable!(),
}
@@ -226,7 +226,7 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
.send_to_pty(PtyInstruction::NewTab)
.unwrap();
}
- ServerInstruction::AttachClient(attrs, _) => {
+ ServerInstruction::AttachClient(attrs, _, options) => {
*session_state.write().unwrap() = SessionState::Attached;
let rlock = session_data.read().unwrap();
let session_data = rlock.as_ref().unwrap();
@@ -234,8 +234,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
.senders
.send_to_screen(ScreenInstruction::TerminalResize(attrs.position_and_size))
.unwrap();
+ let default_mode = options.default_mode.unwrap_or_default();
let mode_info =
- get_mode_info(InputMode::Normal, attrs.palette, session_data.capabilities);
+ get_mode_info(default_mode, attrs.palette, session_data.capabilities);
session_data
.senders
.send_to_screen(ScreenInstruction::ChangeMode(mode_info.clone()))
diff --git a/zellij-server/src/os_input_output.rs b/zellij-server/src/os_input_output.rs
index 4cda73ed5..a104dda21 100644
--- a/zellij-server/src/os_input_output.rs
+++ b/zellij-server/src/os_input_output.rs
@@ -41,7 +41,13 @@ pub(crate) fn set_terminal_size_using_fd(fd: RawFd, columns: u16, rows: u16) {
ws_xpixel: 0,
ws_ypixel: 0,
};
- unsafe { ioctl(fd, TIOCSWINSZ, &winsize) };
+ // TIOCGWINSZ is an u32, but the second argument to ioctl is u64 on
+ // some platforms. When checked on Linux, clippy will complain about
+ // useless conversion.
+ #[allow(clippy::useless_conversion)]
+ unsafe {
+ ioctl(fd, TIOCSWINSZ.into(), &winsize)
+ };
}
/// Handle some signals for the child process. This will loop until the child
diff --git a/zellij-server/src/route.rs b/zellij-server/src/route.rs
index baac1e9c2..285f333cb 100644
--- a/zellij-server/src/route.rs
+++ b/zellij-server/src/route.rs
@@ -238,7 +238,7 @@ pub(crate) fn route_thread_main(
to_server.send(instruction.into()).unwrap();
}
}
- ClientToServerMsg::AttachClient(_, force) => {
+ ClientToServerMsg::AttachClient(_, force, _) => {
if *session_state.read().unwrap() == SessionState::Attached && !force {
os_input.send_to_temp_client(ServerToClientMsg::Exit(ExitReason::CannotAttach));
} else {
diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs
index 068037eea..48be44bfc 100644
--- a/zellij-server/src/screen.rs
+++ b/zellij-server/src/screen.rs
@@ -405,6 +405,7 @@ pub(crate) fn screen_thread_main(
session_state: Arc<RwLock<SessionState>>,
) {
let capabilities = config_options.simplified_ui;
+ let default_mode = config_options.default_mode.unwrap_or_default();
let mut screen = Screen::new(
bus,
@@ -415,9 +416,10 @@ pub(crate) fn screen_thread_main(
capabilities: PluginCapabilities {
arrow_fonts: capabilities,
},
+ mode: default_mode,
..ModeInfo::default()
},
- InputMode::Normal,
+ default_mode,
session_state,
);
loop {