hyprswitch 3.3.2

A CLI/GUI that allows switching between windows in Hyprland
use lazy_static::lazy_static;
use std::env;
use tracing::debug;

lazy_static! {
    pub static ref SHOW_LAUNCHER: bool = env::var("SHOW_LAUNCHER")
        .map(|s| s.parse().expect("Failed to parse SHOW_LAUNCHER"))
        .unwrap_or(false);
    pub static ref LAUNCHER_MAX_ITEMS: usize = env::var("LAUNCHER_MAX_ITEMS")
        .map(|s| {
            let value = s.parse().expect("Failed to parse LAUNCHER_MAX_ITEMS");
            if !(1..=10).contains(&value) {
                panic!("LAUNCHER_MAX_ITEMS must be between 1 and 10");
            }
            value
        })
        .unwrap_or(5);
    pub static ref DEFAULT_TERMINAL: Option<String> =
        env::var("DEFAULT_TERMINAL").map_or(None, |s| Some(s.to_string()));

    // not implemented in config generator
    pub static ref LOG_MODULE_PATH: bool = env::var("LOG_MODULE_PATH")
        .map(|s| s.parse().expect("Failed to parse LOG_MODULE_PATH"))
        .unwrap_or(false);
    // allows exiting on new monitors or new versions as it automatically restarts
    pub static ref SYSTEMD_SERVICE: bool = env::var("SYSTEMD_SERVICE")
        .map(|s| s.parse().expect("Failed to parse SYSTEMD_SERVICE"))
        .unwrap_or(false);

    pub static ref REMOVE_HTML_FROM_WORKSPACE_NAME: bool = env::var("REMOVE_HTML_FROM_WORKSPACE_NAME")
        .map(|s| s.parse().expect("Failed to parse REMOVE_HTML_FROM_WORKSPACE_NAME"))
        .unwrap_or(true);
    pub static ref DISABLE_TOASTS: bool = env::var("DISABLE_TOASTS")
        .map(|s| s.parse().expect("Failed to parse DISABLE_TOASTS"))
        .unwrap_or(false);
    pub static ref SHOW_LAUNCHER_EXECS: bool = env::var("SHOW_LAUNCHER_EXECS")
        .map(|s| s.parse().expect("Failed to parse SHOW_LAUNCHER_EXECS"))
        .unwrap_or(true);
    pub static ref LAUNCHER_ANIMATE_LAUNCH_TIME: u64 = env::var("LAUNCHER_ANIMATE_LAUNCH_TIME")
        .map(|s| s.parse().expect("Failed to parse LAUNCHER_ANIMATE_LAUNCH_TIME"))
        .unwrap_or(300);
}

pub fn envvar_dump() {
    debug!("ENV dump: \
    SHOW_LAUNCHER: {:?}, LAUNCHER_MAX_ITEMS: {:?}, \
    DEFAULT_TERMINAL: {:?}, LOG_MODULE_PATH: {:?}, REMOVE_HTML_FROM_WORKSPACE_NAME: {:?}, DISABLE_TOASTS: {:?}, \
    SHOW_LAUNCHER_EXECS: {:?}, LAUNCHER_ANIMATE_LAUNCH_TIME: {:?}, SYSTEMD_SERVICE: {:?}",
        *SHOW_LAUNCHER, *LAUNCHER_MAX_ITEMS,
        *DEFAULT_TERMINAL, *LOG_MODULE_PATH, *REMOVE_HTML_FROM_WORKSPACE_NAME, *DISABLE_TOASTS,
        *SHOW_LAUNCHER_EXECS, *LAUNCHER_ANIMATE_LAUNCH_TIME, *SYSTEMD_SERVICE);
}