diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0857c42 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +# Ignore all .conf files from changing +*.conf diff --git a/README.md b/README.md index 45e1d10..7475b42 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,9 @@ this script manually and force HDR to be on or off if you so desire. # Setup -Simply copy the script to a location within your $PATH for ease of access, such as ~/.local/usr/bin. +1. Copy the script to a location within your $PATH for ease of access, such as ~/.local/usr/bin. +2. Modify the monitor.conf file. +3. You should now be able to call `hdr-helper -v` from your terminal -OR- @@ -42,7 +44,7 @@ ln -s hdr-helper ~/.local/bin/ chmod +x ~/.local/usr/bin/hdr-helper ``` -You will then need to modify the following three values within the script specific to your system configuration: +You will then need to modify the following three values within monitor.conf specific to your system configuration: ``` # MONITOR= # NATIVE_RES=<3440x1440@165 | Enter your native monitor resolution followed by the refresh rate> @@ -71,7 +73,7 @@ Currently only KDE Plasma is supported running Wayland. Ensure that kscreen-doct is present on your system for HDR Helper to function. --- Config --- -Please modify the MONITOR, NATIVE_RES and TEMP_RES values in this script. +Please modify the MONITOR, NATIVE_RES and TEMP_RES values in monitor.conf. ``` # Usage diff --git a/hdr-helper b/hdr-helper old mode 100644 new mode 100755 index 0d5f556..460afbf --- a/hdr-helper +++ b/hdr-helper @@ -1,12 +1,9 @@ #!/bin/bash -_VERSION=1.0.0.0 -# MONITOR= -# 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-3 -NATIVE_RES=3440x1440@165 -TEMP_RES=2560x1440@144 +_VERSION=1.0.1.0 +MONITOR= # MODIFY THESE VALUES INSIDE MONITOR.CONF # +NATIVE_RES= ########################################### +TEMP_RES= ########################################### show_hdr_status() { ICON="/usr/share/icons/breeze-dark/devices/64/monitor.svg" @@ -60,7 +57,7 @@ show_help () { echo "is present on your system for HDR Helper to function." echo "" echo "--- Config ---" - echo "Please modify the MONITOR, NATIVE_RES and TEMP_RES values in this script." + echo "Please modify the MONITOR, NATIVE_RES and TEMP_RES values in monitor.conf." } # Check Dependencies @@ -73,6 +70,18 @@ if [[ $(whereis kscreen-doctor) != *"kscreen-doctor" ]]; then exit -1 fi +# Import monitor.conf values +if [ -f monitor.conf ]; then + source monitor.conf + if [[ $MONITOR == "" ]] || [[ $NATIVE_RES == "" ]] || [[ $TEMP_RES == "" ]]; then + echo "Error: monitor.conf has not been configured." + exit -2 + fi +else + echo "Error: monitor.conf file not found. Please ensure it's been properly setup." + exit -3 +fi + # Handle Args if [[ $1 == "-e" ]] || [ $1 == "--enable" ]; then enable_hdr