super close. Added all the available attribtes that I saw, but some need some input refining. I'm in the process of making a single function for all kscreen applications to go through but something is wrong and it's late.
This commit is contained in:
@@ -1,30 +1,29 @@
|
|||||||
# All Kscreen Doctor attributes
|
# All Kscreen Doctor attributes
|
||||||
|
|
||||||
- [x] primary
|
- [x] primary
|
||||||
- [ ] priority
|
- [x] priority
|
||||||
- [x] enable
|
- [x] enable
|
||||||
- [x] disable
|
- [x] disable
|
||||||
- [x] mode
|
- [x] mode
|
||||||
- [x] position
|
- [x] position
|
||||||
- [x] scale
|
- [x] scale
|
||||||
- [x] orientation / rotation
|
- [x] orientation / rotation
|
||||||
- [ ] overscan (0-100)
|
- [x] overscan (0-100)
|
||||||
- [ ] vrrpolicy (never / always / automatic)
|
- [x] vrrpolicy (never / always / automatic)
|
||||||
- [ ] rgbrange (automatic / full / limited)
|
- [x] rgbrange (automatic / full / limited)
|
||||||
- [ ] hdr (enable / disable / toggle)
|
- [x] hdr (enable / disable / toggle)
|
||||||
- [ ] sdr-brightness (50-10000)
|
- [x] sdr-brightness (50-10000)
|
||||||
- [ ] wcg (enable / disable / toggle)
|
- [x] wcg (enable / disable / toggle)
|
||||||
- [ ] iccprofile (path)
|
- [x] iccprofile (path)
|
||||||
- [ ] sdrGamut (0-100)
|
- [ ] sdrGamut (0-100)
|
||||||
- [ ] maxBrightnessOverride (disable / int)
|
- [ ] maxBrightnessOverride (disable / int)
|
||||||
- [ ] maxAverageBrightnessOverride (disable / int)
|
- [ ] maxAverageBrightnessOverride (disable / int)
|
||||||
- [ ] minBrightnessOverride (disable / int)
|
- [ ] minBrightnessOverride (disable / int)
|
||||||
- [ ] colorProfileSource (sRBG / ICC / EDID)
|
- [ ] colorProfileSource (sRBG / ICC / EDID)
|
||||||
- [ ] brightness (0-100)
|
- [x] brightness (0-100)
|
||||||
- [ ] colorPowerTradeoff (preferEfficiency / preferAccuracy)
|
- [ ] colorPowerTradeoff (preferEfficiency / preferAccuracy)
|
||||||
- [ ] dimming (0-100)
|
- [ ] dimming (0-100)
|
||||||
- [ ] mirror ( none / output )
|
- [x] mirror ( none / output )
|
||||||
- [ ] ddcCi (allow / disallow)
|
- [x] ddcCi (allow / disallow)
|
||||||
- [ ] maxbpc (automatic / 6-16)
|
- [x] maxbpc (automatic / 6-16)
|
||||||
- [ ] edrPolicy (never / always)
|
- [ ] edrPolicy (never / always)
|
||||||
- [ ] sharpness (0 - 100)
|
- [ ] sharpness (0 - 100)
|
||||||
@@ -73,6 +73,23 @@ enable_outputs "$enabled_outputs"
|
|||||||
log "Disabling disabled outputs..."
|
log "Disabling disabled outputs..."
|
||||||
enable_outputs "$disabled_outputs"
|
enable_outputs "$disabled_outputs"
|
||||||
|
|
||||||
|
function apply_attribute {
|
||||||
|
output_id=$1
|
||||||
|
attribute=$2
|
||||||
|
value=$3
|
||||||
|
value_map=$4
|
||||||
|
|
||||||
|
if [[ -n "$value_map" ]]; then
|
||||||
|
value=${map["$value"]}
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $value != "null" ]; then
|
||||||
|
CMD="kscreen-doctor output.$output_id.$attribute.$value"
|
||||||
|
fi
|
||||||
|
log "[CMDDDDDD]" $CMD
|
||||||
|
$CMD
|
||||||
|
}
|
||||||
|
|
||||||
function load_profile_to_outputs {
|
function load_profile_to_outputs {
|
||||||
local outputs=$1
|
local outputs=$1
|
||||||
|
|
||||||
@@ -87,22 +104,103 @@ function load_profile_to_outputs {
|
|||||||
rotation=$(echo "$out" | jq -r '.rotation')
|
rotation=$(echo "$out" | jq -r '.rotation')
|
||||||
scale=$(echo "$out" | jq -r '.scale')
|
scale=$(echo "$out" | jq -r '.scale')
|
||||||
mode_id=$(echo "$out" | jq -r '.currentModeId')
|
mode_id=$(echo "$out" | jq -r '.currentModeId')
|
||||||
|
brightness=$(echo "$out" | jq -r '.brightness')
|
||||||
|
brightness=$(awk "BEGIN {printf \"%d\", $brightness * 100}")
|
||||||
|
ddcCi=$(echo "$out" | jq -r '.ddcCi')
|
||||||
|
iccProfilePath=$(echo "$out" | jq -r '.iccProfilePath')
|
||||||
# mode_name=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .name")
|
# mode_name=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .name")
|
||||||
# log "[VAR] mode_name:" $mode_name
|
# log "[VAR] mode_name:" $mode_name
|
||||||
refresh_rate=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .refreshRate")
|
refresh_rate=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .refreshRate")
|
||||||
|
refresh_rate=$(printf "%.0f" "$refresh_rate")
|
||||||
height=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .size.height")
|
height=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .size.height")
|
||||||
width=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .size.width")
|
width=$(echo "$out" | jq -r ".modes[] | select(.id == \"$mode_id\") | .size.width")
|
||||||
mode="${width}x${height}@${refresh_rate}"
|
mode="${width}x${height}@${refresh_rate}"
|
||||||
replication_source_id=$(echo "$out" | jq -r ".replicationSource")
|
replication_source_id=$(echo "$out" | jq -r ".replicationSource")
|
||||||
|
hdr=$(echo "$out" | jq -r ".hdr")
|
||||||
|
maxBpc=$(echo "$out" | jq -r ".maxBpc")
|
||||||
|
overscan=$(echo "$out" | jq -r ".overscan")
|
||||||
|
rgbRange=$(echo "$out" | jq -r ".rgbRange")
|
||||||
|
sdrbrightness=$(echo "$out" | jq -r '."sdr-brightness"')
|
||||||
|
vrrPolicy=$(echo "$out" | jq -r ".vrrPolicy")
|
||||||
|
wcg=$(echo "$out" | jq -r ".wcg")
|
||||||
|
|
||||||
|
|
||||||
|
declare -A bool_enable_map
|
||||||
|
wcg_map["true"]="enable"
|
||||||
|
wcg_map["false"]="false"
|
||||||
|
|
||||||
|
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 "vrrpolicy" $vrrPolicy
|
||||||
|
|
||||||
|
apply_attribute $name rgbrange $rgbRange
|
||||||
|
|
||||||
|
CMD="kscreen-doctor output.$name.overscan.$overscan"
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
|
||||||
|
if [ "$maxBpc" == 0 ]; then
|
||||||
|
CMD="kscreen-doctor output.$name.maxbpc.automatic"
|
||||||
|
else
|
||||||
|
CMD="kscreen-doctor output.$name.maxbpc.$maxBpc"
|
||||||
|
fi
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
|
||||||
|
if [ "$hdr" == true ]; then
|
||||||
|
CMD="kscreen-doctor output.$name.hdr.enable"
|
||||||
|
else
|
||||||
|
CMD="kscreen-doctor output.$name.hdr.disable"
|
||||||
|
fi
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
|
||||||
log "[VAR] replication_source_id: $replication_source_id"
|
log "[VAR] replication_source_id: $replication_source_id"
|
||||||
if [ $replication_source_id -neq 0 ]; then
|
if [ $replication_source_id != 0 ]; then
|
||||||
replication_source_name=$(echo "$outputs.[] | select(.id == \"$replication_source_id\" | .name)" )
|
replication_source_name=$(echo "$outputs.[] | select(.id == \"$replication_source_id\" | .name)" )
|
||||||
log "[VAR] replication_source_name: $replication_source_name"
|
log "[VAR] replication_source_name: $replication_source_name"
|
||||||
CMD="kscreen-doctor output.$"
|
CMD="kscreen-doctor output.$name.mirror.$replication_source_name"
|
||||||
done
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
else
|
||||||
|
CMD="kscreen-doctor output.$name.mirror.none"
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
fi
|
||||||
|
|
||||||
log "[VAR] mode: $mode"
|
log "[VAR] mode: $mode"
|
||||||
priority=$(echo "$out" | jq -r '.priority')
|
priority=$(echo "$out" | jq -r '.priority')
|
||||||
|
|
||||||
|
if [ $ddcCi == true ]; then
|
||||||
|
CMD="kscreen-doctor output.$name.ddcCi.allow"
|
||||||
|
else
|
||||||
|
CMD="kscreen-doctor output.$name.ddcCi.disallow"
|
||||||
|
fi
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
|
||||||
|
if [ "$iccProfilePath" != "" ]; then
|
||||||
|
CMD="kscreen-doctor output.$name.iccProfilePath.$iccProfilePath"
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
fi
|
||||||
|
|
||||||
|
CMD="kscreen-doctor output.$name.brightness.$brightness"
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
#
|
#
|
||||||
|
|
||||||
# Mode (Resolution + refresh)
|
# Mode (Resolution + refresh)
|
||||||
@@ -139,28 +237,13 @@ function load_profile_to_outputs {
|
|||||||
$CMD
|
$CMD
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
CMD="kscreen-doctor output.$name.priority.$priority"
|
||||||
|
log "[CMD]" $CMD
|
||||||
|
$CMD
|
||||||
|
|
||||||
done <<< "$outputs"
|
done <<< "$outputs"
|
||||||
}
|
}
|
||||||
|
|
||||||
load_profile_to_outputs "$outputs"
|
load_profile_to_outputs "$outputs"
|
||||||
|
|
||||||
clone_groups=$(jq -c '.clones[]?' "$PROFILE")
|
|
||||||
|
|
||||||
function restore_clone_groups {
|
|
||||||
local clone_groups=$1
|
|
||||||
while IFS= read -r clone; do
|
|
||||||
primary=$(echo "$clone" | jq -r '.[0]')
|
|
||||||
others=$(echo "$clone" | jq -r '.[]' | tail -n +2)
|
|
||||||
|
|
||||||
for o in $others; do
|
|
||||||
CMD="kscreen-doctor output.$o.clone.$primary"
|
|
||||||
log "[CMD]" $CMD
|
|
||||||
$CMD
|
|
||||||
|
|
||||||
done
|
|
||||||
done <<< "$clone_groups"
|
|
||||||
}
|
|
||||||
|
|
||||||
restore_clone_groups "$clone_groups"
|
|
||||||
|
|
||||||
echo "Display configuration restored."
|
echo "Display configuration restored."
|
||||||
Reference in New Issue
Block a user