hotfix: remove termbg call so stdin won't get stuck

This commit is contained in:
Aram Drevekenin 2021-05-28 11:42:00 +02:00
parent 0c0355dbc6
commit 4ac77874ac

View file

@ -9,7 +9,7 @@ use std::io::prelude::*;
use std::os::unix::io::RawFd; use std::os::unix::io::RawFd;
use std::path::Path; use std::path::Path;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use zellij_tile::data::{Palette, PaletteColor}; use zellij_tile::data::Palette;
use zellij_utils::{ use zellij_utils::{
errors::ErrorContext, errors::ErrorContext,
ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg}, ipc::{ClientToServerMsg, IpcReceiverWithContext, IpcSenderWithContext, ServerToClientMsg},
@ -161,14 +161,17 @@ impl ClientOsApi for ClientOsInputOutput {
*self.receive_instructions_from_server.lock().unwrap() = Some(receiver); *self.receive_instructions_from_server.lock().unwrap() = Some(receiver);
} }
fn load_palette(&self) -> Palette { fn load_palette(&self) -> Palette {
let timeout = std::time::Duration::from_millis(100); let palette = default_palette();
let mut palette = default_palette(); // this was removed because termbg doesn't release stdin in certain scenarios (we know of
if let Ok(rgb) = termbg::rgb(timeout) { // windows terminal and FreeBSD): https://github.com/zellij-org/zellij/issues/538
palette.bg = PaletteColor::Rgb((rgb.r as u8, rgb.g as u8, rgb.b as u8)); //
// TODO: also dynamically get all other colors from the user's terminal // let timeout = std::time::Duration::from_millis(100);
// this should be done in the same method (OSC ]11), but there might be other // if let Ok(rgb) = termbg::rgb(timeout) {
// considerations here, hence using the library // palette.bg = PaletteColor::Rgb((rgb.r as u8, rgb.g as u8, rgb.b as u8));
}; // // TODO: also dynamically get all other colors from the user's terminal
// // this should be done in the same method (OSC ]11), but there might be other
// // considerations here, hence using the library
// };
palette palette
} }
} }