diff --git a/src/cli.rs b/src/cli.rs index 6fc5020b..6e384e16 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -2,17 +2,17 @@ use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt, Debug, Default)] -#[structopt(name = "mosaic")] +#[structopt(name = "zellij")] pub struct CliArgs { - /// Send "split (direction h == horizontal / v == vertical)" to active mosaic session + /// Send "split (direction h == horizontal / v == vertical)" to active zellij session #[structopt(short, long)] pub split: Option, - /// Send "move focused pane" to active mosaic session + /// Send "move focused pane" to active zellij session #[structopt(short, long)] pub move_focus: bool, - /// Send "open file in new pane" to active mosaic session + /// Send "open file in new pane" to active zellij session #[structopt(short, long)] pub open_file: Option, diff --git a/src/client/layout.rs b/src/client/layout.rs index d09e7618..397a26a7 100644 --- a/src/client/layout.rs +++ b/src/client/layout.rs @@ -1,4 +1,4 @@ -use crate::utils::consts::MOSAIC_ROOT_LAYOUT_DIR; +use crate::utils::consts::ZELLIJ_ROOT_LAYOUT_DIR; use directories_next::ProjectDirs; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; @@ -182,9 +182,9 @@ pub struct Layout { impl Layout { pub fn new(layout_path: PathBuf) -> Self { - let project_dirs = ProjectDirs::from("org", "Mosaic Contributors", "Mosaic").unwrap(); + let project_dirs = ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); let layout_dir = project_dirs.data_dir().join("layouts/"); - let root_layout_dir = Path::new(MOSAIC_ROOT_LAYOUT_DIR); + let root_layout_dir = Path::new(ZELLIJ_ROOT_LAYOUT_DIR); let mut layout_file = File::open(&layout_path) .or_else(|_| File::open(&layout_path.with_extension("yaml"))) .or_else(|_| File::open(&layout_dir.join(&layout_path).with_extension("yaml"))) diff --git a/src/common/input/actions.rs b/src/common/input/actions.rs index 6f4a4521..0e3243a3 100644 --- a/src/common/input/actions.rs +++ b/src/common/input/actions.rs @@ -12,7 +12,7 @@ pub enum Direction { #[derive(Clone)] pub enum Action { - /// Quit mosaic + /// Quit Zellij Quit, /// Write to terminal Write(Vec), diff --git a/src/common/input/handler.rs b/src/common/input/handler.rs index 2a1c2c72..136dacba 100644 --- a/src/common/input/handler.rs +++ b/src/common/input/handler.rs @@ -235,7 +235,7 @@ impl InputHandler { } /// Routine to be called when the input handler exits (at the moment this is the - /// same as quitting mosaic) + /// same as quitting zellij) fn exit(&mut self) { self.send_app_instructions .send(AppInstruction::Exit) @@ -261,7 +261,7 @@ impl Default for InputState { /// Dictates whether we're in command mode, persistent command mode, normal mode or exiting: /// - Normal mode either writes characters to the terminal, or switches to command mode /// using a particular key control -/// - Command mode intercepts characters to control mosaic itself, before switching immediately +/// - Command mode intercepts characters to control zellij itself, before switching immediately /// back to normal mode /// - Persistent command mode is the same as command mode, but doesn't return automatically to /// normal mode diff --git a/src/common/mod.rs b/src/common/mod.rs index de0b9f76..12e869f1 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -32,8 +32,8 @@ use input::handler::input_loop; use os_input_output::OsApi; use pty_bus::{PtyBus, PtyInstruction}; use screen::{Screen, ScreenInstruction}; -use utils::consts::{MOSAIC_IPC_PIPE, MOSAIC_ROOT_PLUGIN_DIR}; -use wasm_vm::{mosaic_imports, wasi_stdout, wasi_write_string, PluginInstruction}; +use utils::consts::{ZELLIJ_IPC_PIPE, ZELLIJ_ROOT_PLUGIN_DIR}; +use wasm_vm::{wasi_stdout, wasi_write_string, zellij_imports, PluginInstruction}; #[derive(Serialize, Deserialize, Debug)] pub enum ApiCommand { @@ -414,9 +414,9 @@ pub fn start(mut os_input: Box, opts: CliArgs) { match event { PluginInstruction::Load(pid_tx, path) => { let project_dirs = - ProjectDirs::from("org", "Mosaic Contributors", "Mosaic").unwrap(); + ProjectDirs::from("org", "Zellij Contributors", "Zellij").unwrap(); let plugin_dir = project_dirs.data_dir().join("plugins/"); - let root_plugin_dir = Path::new(MOSAIC_ROOT_PLUGIN_DIR); + let root_plugin_dir = Path::new(ZELLIJ_ROOT_PLUGIN_DIR); let wasm_bytes = fs::read(&path) .or_else(|_| fs::read(&path.with_extension("wasm"))) .or_else(|_| fs::read(&plugin_dir.join(&path).with_extension("wasm"))) @@ -430,7 +430,7 @@ pub fn start(mut os_input: Box, opts: CliArgs) { let output = Pipe::new(); let input = Pipe::new(); - let mut wasi_env = WasiState::new("mosaic") + let mut wasi_env = WasiState::new("Zellij") .env("CLICOLOR_FORCE", "1") .preopen(|p| { p.directory(".") // FIXME: Change this to a more meaningful dir @@ -455,8 +455,8 @@ pub fn start(mut os_input: Box, opts: CliArgs) { wasi_env, }; - let mosaic = mosaic_imports(&store, &plugin_env); - let instance = Instance::new(&module, &mosaic.chain_back(wasi)).unwrap(); + let zellij = zellij_imports(&store, &plugin_env); + let instance = Instance::new(&module, &zellij.chain_back(wasi)).unwrap(); let start = instance.exports.get_function("_start").unwrap(); @@ -530,8 +530,8 @@ pub fn start(mut os_input: Box, opts: CliArgs) { let mut send_pty_instructions = send_pty_instructions.clone(); let mut send_screen_instructions = send_screen_instructions.clone(); move || { - std::fs::remove_file(MOSAIC_IPC_PIPE).ok(); - let listener = std::os::unix::net::UnixListener::bind(MOSAIC_IPC_PIPE) + std::fs::remove_file(ZELLIJ_IPC_PIPE).ok(); + let listener = std::os::unix::net::UnixListener::bind(ZELLIJ_IPC_PIPE) .expect("could not listen on ipc socket"); let mut err_ctx = OPENCALLS.with(|ctx| *ctx.borrow()); err_ctx.add_call(ContextType::IPCServer); diff --git a/src/common/utils/consts.rs b/src/common/utils/consts.rs index 7a0c9ddf..c4a75158 100644 --- a/src/common/utils/consts.rs +++ b/src/common/utils/consts.rs @@ -1,6 +1,6 @@ -pub const MOSAIC_TMP_DIR: &str = "/tmp/mosaic"; -pub const MOSAIC_TMP_LOG_DIR: &str = "/tmp/mosaic/mosaic-log"; -pub const MOSAIC_TMP_LOG_FILE: &str = "/tmp/mosaic/mosaic-log/log.txt"; -pub const MOSAIC_IPC_PIPE: &str = "/tmp/mosaic/ipc"; -pub const MOSAIC_ROOT_PLUGIN_DIR: &str = "/usr/share/mosaic/plugins"; -pub const MOSAIC_ROOT_LAYOUT_DIR: &str = "/usr/share/mosaic/layouts"; +pub const ZELLIJ_TMP_DIR: &str = "/tmp/zellij"; +pub const ZELLIJ_TMP_LOG_DIR: &str = "/tmp/zellij/zellij-log"; +pub const ZELLIJ_TMP_LOG_FILE: &str = "/tmp/zellij/zellij-log/log.txt"; +pub const ZELLIJ_IPC_PIPE: &str = "/tmp/zellij/ipc"; +pub const ZELLIJ_ROOT_PLUGIN_DIR: &str = "/usr/share/zellij/plugins"; +pub const ZELLIJ_ROOT_LAYOUT_DIR: &str = "/usr/share/zellij/layouts"; diff --git a/src/common/utils/logging.rs b/src/common/utils/logging.rs index 05af455c..c568cd56 100644 --- a/src/common/utils/logging.rs +++ b/src/common/utils/logging.rs @@ -5,7 +5,7 @@ use std::{ path::PathBuf, }; -use crate::utils::consts::{MOSAIC_TMP_LOG_DIR, MOSAIC_TMP_LOG_FILE}; +use crate::utils::consts::{ZELLIJ_TMP_LOG_DIR, ZELLIJ_TMP_LOG_FILE}; pub fn atomic_create_file(file_name: &str) { let _ = fs::OpenOptions::new().create(true).open(file_name); @@ -29,11 +29,11 @@ pub fn debug_log_to_file(mut message: String) -> io::Result<()> { } pub fn debug_log_to_file_without_newline(message: String) -> io::Result<()> { - atomic_create_file(MOSAIC_TMP_LOG_FILE); + atomic_create_file(ZELLIJ_TMP_LOG_FILE); let mut file = fs::OpenOptions::new() .append(true) .create(true) - .open(MOSAIC_TMP_LOG_FILE)?; + .open(ZELLIJ_TMP_LOG_FILE)?; file.write_all(message.as_bytes()) } @@ -47,8 +47,8 @@ pub fn _debug_log_to_file_pid_3(message: String, pid: RawFd) -> io::Result<()> { #[allow(dead_code)] pub fn delete_log_file() -> io::Result<()> { - if fs::metadata(MOSAIC_TMP_LOG_FILE).is_ok() { - fs::remove_file(MOSAIC_TMP_LOG_FILE) + if fs::metadata(ZELLIJ_TMP_LOG_FILE).is_ok() { + fs::remove_file(ZELLIJ_TMP_LOG_FILE) } else { Ok(()) } @@ -56,8 +56,8 @@ pub fn delete_log_file() -> io::Result<()> { #[allow(dead_code)] pub fn delete_log_dir() -> io::Result<()> { - if fs::metadata(MOSAIC_TMP_LOG_DIR).is_ok() { - fs::remove_dir_all(MOSAIC_TMP_LOG_DIR) + if fs::metadata(ZELLIJ_TMP_LOG_DIR).is_ok() { + fs::remove_dir_all(ZELLIJ_TMP_LOG_DIR) } else { Ok(()) } @@ -65,8 +65,8 @@ pub fn delete_log_dir() -> io::Result<()> { pub fn debug_to_file(message: u8, pid: RawFd) -> io::Result<()> { let mut path = PathBuf::new(); - path.push(MOSAIC_TMP_LOG_DIR); - path.push(format!("mosaic-{}.log", pid.to_string())); + path.push(ZELLIJ_TMP_LOG_DIR); + path.push(format!("zellij-{}.log", pid.to_string())); let mut file = fs::OpenOptions::new() .append(true) diff --git a/src/common/wasm_vm.rs b/src/common/wasm_vm.rs index c9a236e3..5b4c891d 100644 --- a/src/common/wasm_vm.rs +++ b/src/common/wasm_vm.rs @@ -33,7 +33,7 @@ pub struct PluginEnv { // Plugin API --------------------------------------------------------------------------------------------------------- -pub fn mosaic_imports(store: &Store, plugin_env: &PluginEnv) -> ImportObject { +pub fn zellij_imports(store: &Store, plugin_env: &PluginEnv) -> ImportObject { imports! { "zellij" => { "host_open_file" => Function::new_native_with_env(store, plugin_env.clone(), host_open_file), diff --git a/src/main.rs b/src/main.rs index aea289fb..e02abd5c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -22,7 +22,7 @@ use crate::command_is_executing::CommandIsExecuting; use crate::os_input_output::get_os_input; use crate::pty_bus::VteEvent; use crate::utils::{ - consts::{MOSAIC_IPC_PIPE, MOSAIC_TMP_DIR, MOSAIC_TMP_LOG_DIR}, + consts::{ZELLIJ_IPC_PIPE, ZELLIJ_TMP_DIR, ZELLIJ_TMP_LOG_DIR}, logging::*, }; @@ -31,29 +31,29 @@ pub fn main() { if let Some(split_dir) = opts.split { match split_dir { 'h' => { - let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); + let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::SplitHorizontally).unwrap(); stream.write_all(&api_command).unwrap(); } 'v' => { - let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); + let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::SplitVertically).unwrap(); stream.write_all(&api_command).unwrap(); } _ => {} }; } else if opts.move_focus { - let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); + let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::MoveFocus).unwrap(); stream.write_all(&api_command).unwrap(); } else if let Some(file_to_open) = opts.open_file { - let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); + let mut stream = UnixStream::connect(ZELLIJ_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap(); stream.write_all(&api_command).unwrap(); } else { let os_input = get_os_input(); - atomic_create_dir(MOSAIC_TMP_DIR).unwrap(); - atomic_create_dir(MOSAIC_TMP_LOG_DIR).unwrap(); + atomic_create_dir(ZELLIJ_TMP_DIR).unwrap(); + atomic_create_dir(ZELLIJ_TMP_LOG_DIR).unwrap(); start(Box::new(os_input), opts); } } diff --git a/src/tests/integration/compatibility.rs b/src/tests/integration/compatibility.rs index 84deea5e..d64626e7 100644 --- a/src/tests/integration/compatibility.rs +++ b/src/tests/integration/compatibility.rs @@ -16,7 +16,7 @@ use crate::tests::utils::commands::{COMMAND_TOGGLE, QUIT}; * * They work like this: * - receive fake TTY input containing various VTE instructions. - * - run that output through mosaic so it interprets it and creates its state based on it + * - run that output through zellij so it interprets it and creates its state based on it * - read that state into a Human-readable snapshot and compare it to the expected snapshot for * this scenario. * diff --git a/src/tests/integration/layouts.rs b/src/tests/integration/layouts.rs index 2086ac72..cc7e66c2 100644 --- a/src/tests/integration/layouts.rs +++ b/src/tests/integration/layouts.rs @@ -45,7 +45,7 @@ pub fn accepts_basic_layout() { // created properly and that in the end it's populated properly with its content // // we read the next to last as well as the last, because the last includes the "Bye from - // Mosaic" message, and we also want to make sure things are fine before that + // Zellij" message, and we also want to make sure things are fine before that assert_snapshot!(first_snapshot); assert_snapshot!(next_to_last_snapshot); assert_snapshot!(last_snapshot);