From b25cb6b278d1db3d41bc3427c57510ef9a5a9c8c Mon Sep 17 00:00:00 2001 From: Dawson Matthews Date: Sun, 7 Dec 2025 16:18:01 -0700 Subject: [PATCH] still working on refactoring things --- load-display-profile.sh | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/load-display-profile.sh b/load-display-profile.sh index 24a9785..dfc37b2 100755 --- a/load-display-profile.sh +++ b/load-display-profile.sh @@ -79,15 +79,20 @@ function apply_attribute { value=$3 value_map=$4 - if [[ -n "$value_map" ]]; then - value=${map["$value"]} - fi - if [ $value != "null" ]; then + + if [[ -n "$value_map" ]]; then + log "[PREVALUE] Value supplied for $output_id $attribute: $value" + value=${value_map["$value"]} + log "[POSTVALUE] Value output for $output_id $attribute: $value" + fi + CMD="kscreen-doctor output.$output_id.$attribute.$value" + log "[CMD]" $CMD + $CMD + else + log "Output $output_id has not attribute $attribute, skipping..." fi - log "[CMDDDDDD]" $CMD - $CMD } function load_profile_to_outputs { @@ -126,27 +131,21 @@ function load_profile_to_outputs { declare -A bool_enable_map - wcg_map["true"]="enable" - wcg_map["false"]="false" + bool_enable_map["true"]="enable" + bool_enable_map["false"]="disable" + + declare -A rgb_range_map + rgb_range_map["0"]="automatic" + rgb_range_map["full"]="full" + rgb_range_map["limited"]="limited" apply_attribute $name "wcg" $wcg $bool_enable_map - #if [ $wcg == true ]; then - # CMD="kscreen-doctor output.$name.wcg.enable" - #else - # CMD="kscreen-doctor output.$name.wcg.disable" - #fi - #log "[CMD]" $CMD - #$CMD - if [ $sdrbrightness != "null" ]; then - CMD="kscreen-doctor output.$name.sdr-brightness.${sdrbrightness}" - log "[CMD]" $CMD - $CMD - fi + apply_attribute $name "sdr-brightness" $sdrbrightness apply_attribute $name "vrrpolicy" $vrrPolicy - apply_attribute $name rgbrange $rgbRange + apply_attribute $name "rgbrange" $rgbRange $rgb_range_map CMD="kscreen-doctor output.$name.overscan.$overscan" log "[CMD]" $CMD