fix: add check for ddcutil

This commit is contained in:
Vladimir Rubin 2025-05-02 21:00:22 +03:00
parent e976352087
commit 8a1969aea1
Signed by: vavakado
GPG key ID: CAB744727F36B524

View file

@ -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() {