From b7168724f61a998c0428792c79f24325b15a48bc Mon Sep 17 00:00:00 2001 From: Vladimir Rubin Date: Sat, 3 May 2025 01:47:38 +0300 Subject: [PATCH] fix: add check for no backends --- src/lib.rs | 4 ++-- src/main.rs | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 3d62dca..537fb43 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,7 +30,7 @@ pub struct Config { pub temp_backend: TempBackend, } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, PartialEq, Copy, Clone)] pub enum GammaBackend { Hyprctl, Ddcutil, @@ -40,7 +40,7 @@ pub enum GammaBackend { None, } -#[derive(Debug, Copy, Clone)] +#[derive(Debug, PartialEq, Copy, Clone)] pub enum TempBackend { Hyprctl, Redshift, diff --git a/src/main.rs b/src/main.rs index a3c8802..9ac543b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -237,6 +237,11 @@ async fn main() { 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(); if std::path::Path::new(SOCKET_PATH).exists() {