fix: add check for no backends

This commit is contained in:
Vladimir Rubin 2025-05-03 01:47:38 +03:00
parent b8205794cc
commit b7168724f6
Signed by: vavakado
GPG key ID: CAB744727F36B524
2 changed files with 7 additions and 2 deletions

View file

@ -30,7 +30,7 @@ pub struct Config {
pub temp_backend: TempBackend, pub temp_backend: TempBackend,
} }
#[derive(Debug, Copy, Clone)] #[derive(Debug, PartialEq, Copy, Clone)]
pub enum GammaBackend { pub enum GammaBackend {
Hyprctl, Hyprctl,
Ddcutil, Ddcutil,
@ -40,7 +40,7 @@ pub enum GammaBackend {
None, None,
} }
#[derive(Debug, Copy, Clone)] #[derive(Debug, PartialEq, Copy, Clone)]
pub enum TempBackend { pub enum TempBackend {
Hyprctl, Hyprctl,
Redshift, Redshift,

View file

@ -237,6 +237,11 @@ async fn main() {
TempBackend::None => {} TempBackend::None => {}
} }
if cfg.temp_backend == TempBackend::None && cfg.gamma_backend == GammaBackend::None {
error!("No backends selected, exiting.");
std::process::exit(1);
}
CONFIG.set(Arc::new(RwLock::new(cfg))).unwrap(); CONFIG.set(Arc::new(RwLock::new(cfg))).unwrap();
if std::path::Path::new(SOCKET_PATH).exists() { if std::path::Path::new(SOCKET_PATH).exists() {