diff --git a/src/main.rs b/src/main.rs index 9d28a22..c7d7945 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,7 +7,7 @@ use std::time::{Duration, UNIX_EPOCH}; use hinoirisetr::notify::InitializedNotificationSystem; use hinoirisetr::time::Time; -use hinoirisetr::{Config, apply_settings, compute_settings, debug, error, info, trace, warn}; +use hinoirisetr::{apply_settings, compute_settings, debug, error, info, trace, warn, Config, GammaBackend}; use smol::Timer; use smol::channel::{Sender, unbounded}; use smol::io::{AsyncBufReadExt, BufReader}; @@ -211,6 +211,29 @@ fn main() { Config::default() }; + + // TODO: add more temp backends and remove this + if !is_binary_available("hyprctl") { + error!("hyprctl is not available, exiting."); + std::process::exit(1); + } + + match cfg.gamma_backend { + GammaBackend::Hyprctl => { + if !is_binary_available("hyprctl") { + error!("hyprctl is not available, exiting."); + std::process::exit(1); + } + } + GammaBackend::Ddcutil => { + if !is_binary_available("ddcutil") { + error!("ddcutil is not available, exiting."); + std::process::exit(1); + } + } + } + + CONFIG.set(Arc::new(RwLock::new(cfg))).unwrap(); if std::path::Path::new(SOCKET_PATH).exists() {