use super::super::command::*;
use std::{io, sync::atomic::*};
static KITTY_ENABLED: AtomicBool = AtomicBool::new(false);
pub fn enable_kitty_if_supported() -> io::Result<bool> {
Ok(if is_kitty_enabled() {
true
} else {
let is_supported = Command::default().is_supported()?;
KITTY_ENABLED.store(is_supported, Ordering::SeqCst);
is_supported
})
}
pub fn is_kitty_enabled() -> bool {
KITTY_ENABLED.load(Ordering::SeqCst)
}
pub fn ensure_kitty_enabled() -> io::Result<()> {
if is_kitty_enabled() { Ok(()) } else { Err(io::Error::other("Kitty not enabled")) }
}