HDR-Helper v1.1.0.0 WIP
-Implemented experimental HDR brightness control.
This commit is contained in:
@@ -47,9 +47,11 @@ chmod +x ~/.local/usr/bin/hdr-helper
|
||||
You will then need to create the following file `~/.config/hdr-helper/monitor.conf`. Copy the below template and adjust to your PC's
|
||||
configuration:
|
||||
```bash
|
||||
MONITOR= # <DP-1 | Enter your monitor ID from xrandr>
|
||||
NATIVE_RES= # <3440x1440@165 | Enter your native monitor resolution followed by the refresh rate>
|
||||
TEMP_RES= # <2560x1440@144 | Enter a different resolution or refresh rate from your native>
|
||||
MONITOR= # DP-1 | Enter your monitor ID from xrandr.
|
||||
NATIVE_RES= # 3440x1440@165 | Enter your native monitor resolution followed by the refresh rate.
|
||||
TEMP_RES= # 2560x1440@144 | Enter a different resolution or refresh rate from your native.
|
||||
HDR_TARGET_BRIGHTNESS=0 # 100 | Enter a target brightness level for your display in HDR mode [0,10-100].
|
||||
# 0 | Default
|
||||
```
|
||||
`xrandr` will give you the following output; in the below example `DP-3` is the value we need to use to target
|
||||
the active monitor.
|
||||
|
||||
+24
-4
@@ -1,10 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
_VERSION=1.1.0.0
|
||||
CONFIG_FILE="$HOME/.config/hdr-helper/monitor.conf"
|
||||
MONITOR= # MODIFY THESE VALUES INSIDE MONITOR.CONF #
|
||||
NATIVE_RES= ###########################################
|
||||
TEMP_RES= ###########################################
|
||||
CONFIG_PATH="$HOME/.config/hdr-helper/"
|
||||
CONFIG_FILE="$CONFIG_PATH/monitor.conf"
|
||||
CONFIG_CURR_BRIGHTNESS="$CONFIG_PATH/current-brightness-level"
|
||||
|
||||
show_hdr_status() {
|
||||
ICON="/usr/share/icons/breeze-dark/devices/64/monitor.svg"
|
||||
@@ -16,6 +15,25 @@ show_hdr_status() {
|
||||
fi
|
||||
}
|
||||
|
||||
set_brightness() {
|
||||
if [ "$HDR_TARGET_BRIGHTNESS" -gt 0 ]; then
|
||||
kscreen-doctor -o | \
|
||||
grep Brightness | \
|
||||
head -n 1 | \
|
||||
sed 's/.*set to \([0-9]\+\)%.*/\1/' \
|
||||
> $CONFIG_CURR_BRIGHTNESS
|
||||
echo "DEBUG: TARGET BRIGHTNESS" $HDR_TARGET_BRIGHTNESS
|
||||
kscreen-doctor output.$MONITOR.brightness.$HDR_TARGET_BRIGHTNESS
|
||||
fi
|
||||
}
|
||||
|
||||
restore_brightness() {
|
||||
if [ -f $CONFIG_CURR_BRIGHTNESS ]; then
|
||||
echo "Debug: CURRENT BRIGHTNESS" $(cat $CONFIG_CURR_BRIGHTNESS)
|
||||
kscreen-doctor output.$MONITOR.brightness.$(cat $CONFIG_CURR_BRIGHTNESS)
|
||||
fi
|
||||
}
|
||||
|
||||
refresh_display() {
|
||||
kscreen-doctor output.$MONITOR.mode.$TEMP_RES
|
||||
kscreen-doctor output.$MONITOR.mode.$NATIVE_RES
|
||||
@@ -25,11 +43,13 @@ refresh_display() {
|
||||
enable_hdr () {
|
||||
kscreen-doctor output.$MONITOR.hdr.enable
|
||||
refresh_display
|
||||
set_brightness
|
||||
}
|
||||
|
||||
disable_hdr() {
|
||||
kscreen-doctor output.$MONITOR.hdr.disable
|
||||
refresh_display
|
||||
restore_brightness
|
||||
}
|
||||
|
||||
auto_hdr() {
|
||||
|
||||
Reference in New Issue
Block a user