* work * work * work * work * work * more work * work * work * work * hack around stdin repeater * refactor(sixel): rename sixel structs * feat(sixel): render text above images * fix(sixel): reap images once they're past the end of the scrollbuffer * fix(sixel): display images in the middle of the line * fix(sixel): render crash * fix(sixel): react to SIGWINCH * fix(sixel): behave properly in alternate screen mode * fix(sixel): reap images on terminal reset * feat(sixel): handle DECSDM * fix(terminal): properly respond to XTSMGRAPHICS and device attributes with Sixel * Add comment * fix(sixel): hack for unknown event overflow until we fix the api * feat(input): query terminal for all OSC 4 colors and respond to them in a buggy way * fix(sixel): do not render corrupted image * feat(input): improve STDIN queries * fix(client): mistake in clear terminal attributes string * fix(ansi): report correct number of supported color registers * fix(sixel): reap images that are completely covered * style(comment): fix name * test(sixel): infra * test(sixel): cases and fixes * fix(sixel): forward dcs bytes to sixel parser * refactor(client): ansi stdin parser * refactor(output): cleanup * some refactorings * fix test * refactor(grid): sixel-grid / sixel-image-store * refactor(grid): grid debug method * refactor(grid): move various logic to sixel.rs * refactor(grid): remove unused methods * fix(sixel): work with multiple users * refactor(pane): remove unused z_index * style(fmt): prepend unused variable * style(fmt): rustfmt * fix(tests): various apis * chore(dependencies): use published version of sixel crates * style(fmt): rustfmt * style(fmt): rustfmt * style(lint): make clippy happy * style(lint): make clippy happy... again * style(lint): make clippy happy... again (chapter 2) * style(comment): remove unused * fix(colors): export COLORTERM and respond to XTVERSION * fix(test): color register count * fix(stdin): adjust STDIN sleep times
57 lines
1.4 KiB
Rust
57 lines
1.4 KiB
Rust
/// Uniformly operates ZELLIJ* environment variables
|
|
use anyhow::Result;
|
|
use serde::{Deserialize, Serialize};
|
|
use std::{
|
|
collections::HashMap,
|
|
env::{set_var, var},
|
|
};
|
|
|
|
pub const ZELLIJ_ENV_KEY: &str = "ZELLIJ";
|
|
pub fn get_zellij() -> Result<String> {
|
|
Ok(var(ZELLIJ_ENV_KEY)?)
|
|
}
|
|
pub fn set_zellij(v: String) {
|
|
set_var(ZELLIJ_ENV_KEY, v);
|
|
}
|
|
|
|
pub const SESSION_NAME_ENV_KEY: &str = "ZELLIJ_SESSION_NAME";
|
|
|
|
pub fn get_session_name() -> Result<String> {
|
|
Ok(var(SESSION_NAME_ENV_KEY)?)
|
|
}
|
|
|
|
pub fn set_session_name(v: String) {
|
|
set_var(SESSION_NAME_ENV_KEY, v);
|
|
}
|
|
|
|
pub fn set_initial_environment_vars() {
|
|
set_var("COLORTERM", "24bit");
|
|
}
|
|
|
|
pub const SOCKET_DIR_ENV_KEY: &str = "ZELLIJ_SOCKET_DIR";
|
|
pub fn get_socket_dir() -> Result<String> {
|
|
Ok(var(SOCKET_DIR_ENV_KEY)?)
|
|
}
|
|
|
|
/// Manage ENVIRONMENT VARIABLES from the configuration and the layout files
|
|
#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
|
|
pub struct EnvironmentVariablesFromYaml {
|
|
env: HashMap<String, String>,
|
|
}
|
|
|
|
impl EnvironmentVariablesFromYaml {
|
|
/// Merges two structs, keys from `other` supersede keys from `self`
|
|
pub fn merge(&self, other: Self) -> Self {
|
|
let mut env = self.clone();
|
|
env.env.extend(other.env);
|
|
env
|
|
}
|
|
|
|
/// Set all the ENVIRONMENT VARIABLES, that are configured
|
|
/// in the configuration and layout files
|
|
pub fn set_vars(&self) {
|
|
for (k, v) in &self.env {
|
|
set_var(k, v);
|
|
}
|
|
}
|
|
}
|