From dd0abcf958de6977cb0ead7dc3dc3e18986a479c Mon Sep 17 00:00:00 2001 From: Fil Sapia Date: Wed, 8 Oct 2025 23:41:01 +0100 Subject: [PATCH] Mandate missing monitor.conf check only for functions that depend on it. --- hdr-helper | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/hdr-helper b/hdr-helper index 86a773f..56f8f7b 100755 --- a/hdr-helper +++ b/hdr-helper @@ -140,23 +140,27 @@ if [[ $(whereis kscreen-doctor) != *"kscreen-doctor" ]]; then fi -# Import monitor.conf values -if source "$CONFIG_FILE"; then - if [[ $MONITOR == "" ]] || [[ $NATIVE_RES == "" ]] || [[ $TEMP_RES == "" ]]; then - echo "Error: monitor.conf has not been configured." - exit -2 +import_config() { + if source "$CONFIG_FILE"; then + if [[ $MONITOR == "" ]] || [[ $NATIVE_RES == "" ]] || [[ $TEMP_RES == "" ]]; then + echo "Error: monitor.conf has not been configured." + exit -2 + fi + else + echo "Error: monitor.conf file not found. Please ensure it's been properly setup." + exit -3 fi -else - echo "Error: monitor.conf file not found. Please ensure it's been properly setup." - exit -3 -fi +} # Handle Args if [[ $1 == "-e" ]] || [[ $1 == "--enable" ]]; then + import_config enable_hdr elif [[ $1 == "-d" ]] || [[ $1 == "--disable" ]]; then + import_config disable_hdr elif [[ $1 == "-s" ]] || [[ $1 == "--status" ]]; then + import_config show_hdr_status elif [[ $1 == "-v" ]] || [[ $1 == "--version" ]]; then show_version