HDR-Helper v1.2.0.0 DEV

- HDR capabilities testing.
- Reformatted help display for better readability.
This commit is contained in:
2025-02-17 23:01:06 +00:00
parent 622d0efaae
commit b2b36ac125
+37 -12
View File
@@ -1,6 +1,6 @@
#!/bin/bash
_VERSION=1.2.0.1
_VERSION=1.2.1.0
CONFIG_PATH="$HOME/.config/hdr-helper/"
CONFIG_FILE="$CONFIG_PATH/monitor.conf"
CURR_BRIGHT_LVL_PATH="/tmp/hdr-helper/"
@@ -64,6 +64,22 @@ disable_hdr() {
restore_brightness
}
test_hdr_support() {
if [[ $(kscreen-doctor -o | grep -A 15 $MONITOR | grep "HDR" | awk '{ print $3 }') == *"incapable"* ]]; then
echo "❌ HDR capabilities are either disabled or not supported on your current display."
echo ""
echo "Please check the correct display is configured in monitor.conf and that"
echo "HDR is both supported and enabled."
echo ""
elif [[ $(kscreen-doctor -o | grep -A 15 $MONITOR | grep "HDR" | awk '{ print $3 }') == *"enabled"* || *"disabled"* ]]; then
echo "✅ HDR capabilities are supported on your current display."
echo ""
else
echo "ERROR: Unhandled HDR status"
exit -4
fi
}
auto_hdr() {
if [[ $(kscreen-doctor -o | grep -A 15 $MONITOR | grep HDR) == *"enabled"* ]]; then
disable_hdr
@@ -77,19 +93,27 @@ show_version() {
}
show_help () {
echo "--- Usage ---"
echo "hdr-helper | The default behaviour will automatically enable or disable HDR"
echo "hdr-helper -e | Force enables HDR"
echo "hdr-helper -d | Force disables HDR"
echo "hdr-helper -s | Shows detected HDR status as a system notification"
echo "hdr-helper -v | Displays version information"
echo "hdr-helper -h | Displays this help screen"
echo "=== Usage ==="
echo "The default behaviour will automatically enable or disable HDR"
echo " hdr-helper (no args)"
echo "Force enable HDR"
echo " hdr-helper -e (--enable)"
echo "Force disable HDR"
echo " hdr-helper -d (--disable)"
echo "Show detected HDR status as a system notification"
echo " hdr-helper -s (--status)"
echo "Display version information"
echo " hdr-helper -v (--version)"
echo "Display this help screen"
echo " hdr-helper -h (--help)"
echo "Tests whether the connected display is HDR capable"
echo " hdr-helper -t (--test)"
echo ""
echo "--- Info ---"
echo "=== Info ==="
echo "Currently only KDE Plasma is supported running Wayland. Ensure that kscreen-doctor"
echo "is present on your system for HDR Helper to function."
echo ""
echo "--- Config ---"
echo "=== Config ==="
echo "Copy monitor.conf to ~/.config/hdr-helper and ensure to modify this file with your"
echo "desired settings."
echo ""
@@ -102,11 +126,10 @@ if [[ $(whereis kscreen-doctor) != *"kscreen-doctor" ]]; then
echo "Error: kscreen-doctor cannot be detected, aborting."
echo "Please note that only KDE Plasma is currently supported on Wayland."
echo ""
show_version
exit -1
fi
# Import monitor.conf values
if source "$CONFIG_FILE"; then
if [[ $MONITOR == "" ]] || [[ $NATIVE_RES == "" ]] || [[ $TEMP_RES == "" ]]; then
@@ -129,6 +152,8 @@ elif [[ $1 == "-v" ]] || [[ $1 == "--version" ]]; then
show_version
elif [[ $1 == "-h" ]] || [[ $1 == "--help" ]]; then
show_help
elif [[ $1 == "-t" ]] || [[ $1 == "--test" ]]; then
test_hdr_support
elif [[ $# -eq 0 ]]; then # Automatically Toggle HDR | Default Behaviour
auto_hdr
else