diff --git a/src/input.rs b/src/input.rs index 976ef71d..8ae604c2 100644 --- a/src/input.rs +++ b/src/input.rs @@ -95,7 +95,7 @@ impl InputHandler { self.stdin .read(&mut self.buffer) .expect("failed to read stdin"); - // uncomment this to print the entered character to a log file (/tmp/mosaic-log.txt) for debugging + // uncomment this to print the entered character to a log file (/tmp/mosaic/mosaic-log.txt) for debugging // debug_log_to_file(format!("buffer {:?}", self.buffer)); match self.buffer { [7, 0, 0, 0, 0, 0, 0, 0, 0, 0] => { diff --git a/src/main.rs b/src/main.rs index 10ee87c1..683874f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,7 +27,7 @@ use crate::layout::Layout; use crate::os_input_output::{get_os_input, OsApi}; use crate::pty_bus::{PtyBus, PtyInstruction, VteEvent}; use crate::screen::{Screen, ScreenInstruction}; -use crate::utils::{consts::MOSAIC_TMP_FOLDER, logging::*}; +use crate::utils::{consts::MOSAIC_IPC_PIPE, logging::*}; #[derive(Serialize, Deserialize, Debug)] enum ApiCommand { @@ -64,23 +64,23 @@ pub fn main() { if opts.split.is_some() { match opts.split { Some('h') => { - let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap(); + let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::SplitHorizontally).unwrap(); stream.write_all(&api_command).unwrap(); } Some('v') => { - let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap(); + let mut stream = UnixStream::connect(MOSAIC_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_TMP_FOLDER).unwrap(); + let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); let api_command = bincode::serialize(&ApiCommand::MoveFocus).unwrap(); stream.write_all(&api_command).unwrap(); } else if opts.open_file.is_some() { - let mut stream = UnixStream::connect(MOSAIC_TMP_FOLDER).unwrap(); + let mut stream = UnixStream::connect(MOSAIC_IPC_PIPE).unwrap(); let file_to_open = opts.open_file.unwrap(); let api_command = bincode::serialize(&ApiCommand::OpenFile(file_to_open)).unwrap(); stream.write_all(&api_command).unwrap(); @@ -273,8 +273,8 @@ pub fn start(mut os_input: Box, opts: Opt) { let send_pty_instructions = send_pty_instructions.clone(); let send_screen_instructions = send_screen_instructions.clone(); move || { - ::std::fs::remove_file("/tmp/mosaic").ok(); - let listener = ::std::os::unix::net::UnixListener::bind("/tmp/mosaic") + std::fs::remove_file(MOSAIC_IPC_PIPE).ok(); + let listener = std::os::unix::net::UnixListener::bind(MOSAIC_IPC_PIPE) .expect("could not listen on ipc socket"); for stream in listener.incoming() { diff --git a/src/utils/consts.rs b/src/utils/consts.rs index 5eb96c67..e0a6da9f 100644 --- a/src/utils/consts.rs +++ b/src/utils/consts.rs @@ -1,3 +1,3 @@ -pub const MOSAIC_TMP_LOG_FILE: &str = "/tmp/mosaic-log.txt"; -pub const MOSAIC_TMP_LOG_DIR: &str = "/tmp/mosaic-log"; -pub const MOSAIC_TMP_FOLDER: &str = "/tmp/mosaic"; +pub const MOSAIC_TMP_LOG_FILE: &str = "/tmp/mosaic/mosaic-log/log.txt"; +pub const MOSAIC_TMP_LOG_DIR: &str = "/tmp/mosaic/mosaic-log"; +pub const MOSAIC_IPC_PIPE: &str = "/tmp/mosaic/ipc";