HDR-Helper v1.2.0.0

- WCG (Wide Color Gamut) is now toggled accordingly when switching.
- SDR to HDR conversion brightness level can now also be adjusted in nits.
- Migrated temporary brightness level value to /tmp as it's more appropriate than in ~/.config.
This commit is contained in:
2025-01-01 18:54:48 +00:00
parent 7340ccda2f
commit 77c78135fc
2 changed files with 36 additions and 19 deletions
+28 -12
View File
@@ -1,9 +1,10 @@
#!/bin/bash #!/bin/bash
_VERSION=1.1.0.0 _VERSION=1.2.0.0
CONFIG_PATH="$HOME/.config/hdr-helper/" CONFIG_PATH="$HOME/.config/hdr-helper/"
CONFIG_FILE="$CONFIG_PATH/monitor.conf" CONFIG_FILE="$CONFIG_PATH/monitor.conf"
CONFIG_CURR_BRIGHTNESS="$CONFIG_PATH/current-brightness-level" CURR_BRIGHT_LVL_PATH="/tmp/hdr-helper/"
CURR_BRIGHT_LVL_FILE="$CURR_BRIGHT_LVL_PATH/current-brightness-level"
show_hdr_status() { show_hdr_status() {
ICON="/usr/share/icons/breeze-dark/devices/64/monitor.svg" ICON="/usr/share/icons/breeze-dark/devices/64/monitor.svg"
@@ -16,21 +17,30 @@ show_hdr_status() {
} }
set_brightness() { set_brightness() {
if [[ "$SDR_TARGET_BRIGHTNESS" -gt 0 ]]; then
# Store the current brightness level before attempting to update it. # Store the current brightness level before attempting to update it.
kscreen-doctor -o | \ if [ ! -f $CURR_BRIGHT_LVL_PATH ]; then
grep Brightness | \ mkdir $CURR_BRIGHT_LVL_PATH
head -n 1 | \ fi
grep -oP "(?<=set to )[0-9]+" \
> $CONFIG_CURR_BRIGHTNESS kscreen-doctor -o | \
grep Brightness | \
head -n 1 | \
grep -oP "(?<=set to )[0-9]+" \
> $CURR_BRIGHT_LVL_FILE
if [ -v SDR_TARGET_BRIGHTNESS ]; then
kscreen-doctor output.$MONITOR.brightness.$SDR_TARGET_BRIGHTNESS kscreen-doctor output.$MONITOR.brightness.$SDR_TARGET_BRIGHTNESS
fi fi
if [ -v SDR_TARGET_BRIGHTNESS_NITS ]; then
kscreen-doctor output.$MONITOR.sdr-brightness.$SDR_TARGET_BRIGHTNESS_NITS
fi
} }
restore_brightness() { restore_brightness() {
if [ -f $CONFIG_CURR_BRIGHTNESS ]; then if [ -f $CURR_BRIGHT_LVL_FILE ]; then
kscreen-doctor output.$MONITOR.brightness.$(cat $CONFIG_CURR_BRIGHTNESS) kscreen-doctor output.$MONITOR.brightness.$(cat $CURR_BRIGHT_LVL_FILE)
rm $CONFIG_CURR_BRIGHTNESS rm $CURR_BRIGHT_LVL_FILE
fi fi
} }
@@ -42,12 +52,14 @@ refresh_display() {
enable_hdr () { enable_hdr () {
kscreen-doctor output.$MONITOR.hdr.enable kscreen-doctor output.$MONITOR.hdr.enable
kscreen-doctor output.$MONITOR.wcg.enable
refresh_display refresh_display
set_brightness set_brightness
} }
disable_hdr() { disable_hdr() {
kscreen-doctor output.$MONITOR.hdr.disable kscreen-doctor output.$MONITOR.hdr.disable
kscreen-doctor output.$MONITOR.wcg.disable
refresh_display refresh_display
restore_brightness restore_brightness
} }
@@ -78,7 +90,11 @@ show_help () {
echo "is present on your system for HDR Helper to function." echo "is present on your system for HDR Helper to function."
echo "" echo ""
echo "--- Config ---" echo "--- Config ---"
echo "Please modify the MONITOR, NATIVE_RES and TEMP_RES values in monitor.conf." echo "Copy monitor.conf to ~/.config/hdr-helper and ensure to modify this file with your"
echo "desired settings."
echo ""
echo "Please refer to README.md or https://github.com/dunestorm333/hdr-helper for further"
echo "setup instructions."
} }
# Check Dependencies # Check Dependencies
+8 -7
View File
@@ -1,9 +1,10 @@
# Copy this file into ~/.config/hdr-helper # Copy this file into ~/.config/hdr-helper
# #
# # Example Value | Description # # Example Value | Description
# #---------------|--------------------------------------------------------------------------------# # #---------------|--------------------------------------------------------------------------------#
MONITOR= # DP-1 | Enter your monitor ID from xrandr. MONITOR= # DP-1 | Enter your monitor ID from xrandr.
NATIVE_RES= # 3440x1440@165 | Enter your native monitor resolution followed by the refresh rate 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. TEMP_RES= # 2560x1440@144 | Enter a different resolution or refresh rate from your native.
SDR_TARGET_BRIGHTNESS=0 # 100 | Enter a target SDR brightness level for your display when in HDR mode [0,1-100]. #SDR_TARGET_BRIGHTNESS=0 # 100 | Enter a target SDR brightness level for your display when in HDR mode [0,1-100].
# 0 | Default #SDR_TARGET_BRIGHTNESS_NITS= # 450 | Enter a target SDR brightness level in nits when in HDR mode. Please refer to you
# | display's specs for this information.