aboutsummaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-05-12 13:32:39 +0200
committera-kenji <aks.kenji@protonmail.com>2021-05-12 15:27:28 +0200
commit776a2c5151f768bfa40fda7471258527c106dd85 (patch)
treeea9c4f5b93f5f9ca9a517dd146f69b1817bc0a60 /src/server
parentdocs(changelog): compatibility update (diff)
downloadsl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.tar.gz
sl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.tar.xz
sl0ppij-776a2c5151f768bfa40fda7471258527c106dd85.zip
Fix Simplified Ui
Propagate the config now, in all the places, as opposed to fallback to a default.
Diffstat (limited to 'src/server')
-rw-r--r--src/server/mod.rs30
-rw-r--r--src/server/route.rs25
2 files changed, 44 insertions, 11 deletions
diff --git a/src/server/mod.rs b/src/server/mod.rs
index 4ef30ce2..622a3257 100644
--- a/src/server/mod.rs
+++ b/src/server/mod.rs
@@ -6,13 +6,14 @@ use std::sync::{Arc, RwLock};
use std::thread;
use std::{path::PathBuf, sync::mpsc::channel};
use wasmer::Store;
+use zellij_tile::data::PluginCapabilities;
use crate::cli::CliArgs;
use crate::client::ClientInstruction;
use crate::common::thread_bus::{Bus, ThreadSenders};
use crate::common::{
errors::{ContextType, ServerContext},
- input::{actions::Action, options::ConfigOptions},
+ input::{actions::Action, options::Options},
os_input_output::{set_permissions, ServerOsApi},
pty::{pty_thread_main, Pty, PtyInstruction},
screen::{screen_thread_main, ScreenInstruction},
@@ -30,7 +31,7 @@ use route::route_thread_main;
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ServerInstruction {
TerminalResize(PositionAndSize),
- NewClient(PositionAndSize, CliArgs, ConfigOptions),
+ NewClient(PositionAndSize, CliArgs, Options),
Action(Action),
Render(Option<String>),
UnblockInputThread,
@@ -55,7 +56,10 @@ impl Drop for SessionMetaData {
}
}
-pub fn start_server(os_input: Box<dyn ServerOsApi>) -> thread::JoinHandle<()> {
+pub fn start_server(
+ os_input: Box<dyn ServerOsApi>,
+ config_options: Options,
+) -> thread::JoinHandle<()> {
let (to_server, server_receiver): ChannelWithContext<ServerInstruction> = channel();
let to_server = SenderWithContext::new(SenderType::Sender(to_server));
let sessions: Arc<RwLock<Option<SessionMetaData>>> = Arc::new(RwLock::new(None));
@@ -67,8 +71,11 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>) -> thread::JoinHandle<()> {
let sessions = sessions.clone();
let os_input = os_input.clone();
let to_server = to_server.clone();
+ let capabilities = PluginCapabilities {
+ arrow_fonts: !config_options.simplified_ui,
+ };
- move || route_thread_main(sessions, os_input, to_server)
+ move || route_thread_main(sessions, os_input, to_server, capabilities)
})
.unwrap();
#[cfg(not(test))]
@@ -78,6 +85,9 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>) -> thread::JoinHandle<()> {
let os_input = os_input.clone();
let sessions = sessions.clone();
let to_server = to_server.clone();
+ let capabilities = PluginCapabilities {
+ arrow_fonts: config_options.simplified_ui,
+ };
move || {
drop(std::fs::remove_file(&*ZELLIJ_IPC_PIPE));
let listener = LocalSocketListener::bind(&**ZELLIJ_IPC_PIPE).unwrap();
@@ -96,7 +106,14 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>) -> thread::JoinHandle<()> {
let os_input = os_input.clone();
let to_server = to_server.clone();
- move || route_thread_main(sessions, os_input, to_server)
+ move || {
+ route_thread_main(
+ sessions,
+ os_input,
+ to_server,
+ capabilities,
+ )
+ }
})
.unwrap();
}
@@ -155,7 +172,7 @@ pub fn start_server(os_input: Box<dyn ServerOsApi>) -> thread::JoinHandle<()> {
fn init_session(
os_input: Box<dyn ServerOsApi>,
opts: CliArgs,
- config_options: ConfigOptions,
+ config_options: Options,
to_server: SenderWithContext<ServerInstruction>,
full_screen_ws: PositionAndSize,
) -> SessionMetaData {
@@ -214,6 +231,7 @@ fn init_session(
Some(os_input.clone()),
);
let max_panes = opts.max_panes;
+ let config_options = config_options;
move || {
screen_thread_main(screen_bus, max_panes, full_screen_ws, config_options);
diff --git a/src/server/route.rs b/src/server/route.rs
index 668cdfbd..bd4b1b60 100644
--- a/src/server/route.rs
+++ b/src/server/route.rs
@@ -1,6 +1,6 @@
use std::sync::{Arc, RwLock};
-use zellij_tile::data::Event;
+use zellij_tile::data::{Event, PluginCapabilities};
use crate::common::errors::{ContextType, ServerContext};
use crate::common::input::actions::{Action, Direction};
@@ -12,7 +12,12 @@ use crate::common::thread_bus::SenderWithContext;
use crate::common::wasm_vm::PluginInstruction;
use crate::server::{ServerInstruction, SessionMetaData};
-fn route_action(action: Action, session: &SessionMetaData, os_input: &dyn ServerOsApi) {
+fn route_action(
+ action: Action,
+ session: &SessionMetaData,
+ os_input: &dyn ServerOsApi,
+ capabilities: PluginCapabilities,
+) {
match action {
Action::Write(val) => {
session
@@ -30,12 +35,16 @@ fn route_action(action: Action, session: &SessionMetaData, os_input: &dyn Server
.senders
.send_to_plugin(PluginInstruction::Update(
None,
- Event::ModeUpdate(get_mode_info(mode, palette)),
+ Event::ModeUpdate(get_mode_info(mode, palette, capabilities)),
))
.unwrap();
session
.senders
- .send_to_screen(ScreenInstruction::ChangeMode(get_mode_info(mode, palette)))
+ .send_to_screen(ScreenInstruction::ChangeMode(get_mode_info(
+ mode,
+ palette,
+ capabilities,
+ )))
.unwrap();
session
.senders
@@ -181,6 +190,7 @@ pub fn route_thread_main(
sessions: Arc<RwLock<Option<SessionMetaData>>>,
mut os_input: Box<dyn ServerOsApi>,
to_server: SenderWithContext<ServerInstruction>,
+ capabilities: PluginCapabilities,
) {
loop {
let (instruction, mut err_ctx) = os_input.recv_from_client();
@@ -192,7 +202,12 @@ pub fn route_thread_main(
break;
}
ServerInstruction::Action(action) => {
- route_action(action, rlocked_sessions.as_ref().unwrap(), &*os_input);
+ route_action(
+ action,
+ rlocked_sessions.as_ref().unwrap(),
+ &*os_input,
+ capabilities,
+ );
}
ServerInstruction::TerminalResize(new_size) => {
rlocked_sessions