HDR-Helper v1.1.0.0

- SDR to HDR brightness control has been implemented.
- Sample monitor.conf file is now provided.
- VS Code debug launch file has been added.
- Updated Readme.
This commit is contained in:
2025-01-01 11:49:33 +00:00
parent 1630d00ec0
commit 7340ccda2f
5 changed files with 53 additions and 28 deletions
Vendored
-2
View File
@@ -1,2 +0,0 @@
# Ignore all .conf files from changing
*.conf
+22
View File
@@ -0,0 +1,22 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (hardcoded script name)",
"cwd": "${workspaceFolder}",
"program": "${workspaceFolder}/hdr-helper",
"args": []
},
{
"type": "bashdb",
"request": "launch",
"name": "Bash-Debug (simplest configuration)",
"program": "${file}"
}
]
}
+16 -20
View File
@@ -1,4 +1,4 @@
# hdr-helper # hdr-helper 💻
Linux script to control and automatically toggle HDR on KDE Plasma. Linux script to control and automatically toggle HDR on KDE Plasma.
![image](https://github.com/user-attachments/assets/87bc05e1-9235-487c-a61f-c03f273b3e4a) ![image](https://github.com/user-attachments/assets/87bc05e1-9235-487c-a61f-c03f273b3e4a)
@@ -7,6 +7,12 @@ I've personally tested this on Fedora 41 Plasma Edition on an RX 6800XT using th
are built into the Linux Kernel. I only have one display, I've not accounted for multi-display scenarios so are built into the Linux Kernel. I only have one display, I've not accounted for multi-display scenarios so
please take this into consideration :) please take this into consideration :)
## Supported Features 📋
- Automatically & manually toggling HDR on and off.
- Notifying you whether HDR has been successfully activated.
- Setting a target SDR brightness level whilst in HDR mode.
- Your original non-HDR brightness level will be preserved when switching back.
# The Problem # The Problem
At this moment in time, pretty much all games require HDR to be manually enabled for it to properly function. Normally At this moment in time, pretty much all games require HDR to be manually enabled for it to properly function. Normally
this isn't a problem when using Gamescope as your native compositor. Most people however run a fully fledged desktop this isn't a problem when using Gamescope as your native compositor. Most people however run a fully fledged desktop
@@ -29,30 +35,20 @@ this script manually and force HDR to be on or off if you so desire.
--- ---
# Setup # Setup
To start with, clone this repository and create a symbolic link to the file:
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-
You may also clone this repository and create a symbolic link to the file to receive any future updates:
```bash ```bash
git clone https://github.com/dunestorm333/hdr-helper.git git clone https://github.com/dunestorm333/hdr-helper.git
cd hdr-helper cd hdr-helper
ln -s hdr-helper ~/.local/bin/ ln -s hdr-helper ~/.local/bin/
chmod +x ~/.local/usr/bin/hdr-helper chmod +x ~/.local/bin/hdr-helper
# You will also need to copy monitor.conf into ~/.config/hdr-helper
mkdir ~/.config/hdr-helper
cp monitor.conf ~/.config/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 **Ensure to modify `monitor.conf` with your desired settings.**
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.
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 `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. the active monitor.
``` ```
@@ -97,7 +93,7 @@ hdr-helper ; gamescope -W 3440 -H 1440 -r 165 -f --hdr-enabled -- %command% ; hd
The commands you need to get this working with pretty much any app or game is very similar to the Steam method. Note that in both The commands you need to get this working with pretty much any app or game is very similar to the Steam method. Note that in both
cases, Gamescope is required as HDR requires a valid HDR layer and compositor to properly function in addition to working drivers. cases, Gamescope is required as HDR requires a valid HDR layer and compositor to properly function in addition to working drivers.
``` bash ``` bash
hdr-helper; gamescope -W 3440 -w 1920 -H 1440 -h 1080 -r 165 -f --hdr-enabled ~/my-app-or-game; hdr-helper hdr-helper; gamescope -W 3440 -H 1440 -r 165 -f --hdr-enabled ~/my-app-or-game; hdr-helper
``` ```
## Manual Approach ## Manual Approach
If you'd like to manually bind HDR Helper to a shortcut key for example, this can easily by configured in most desktop environments. If you'd like to manually bind HDR Helper to a shortcut key for example, this can easily by configured in most desktop environments.
+6 -6
View File
@@ -16,21 +16,21 @@ show_hdr_status() {
} }
set_brightness() { set_brightness() {
if [ "$HDR_TARGET_BRIGHTNESS" -gt 0 ]; then if [[ "$SDR_TARGET_BRIGHTNESS" -gt 0 ]]; then
# Store the current brightness level before attempting to update it.
kscreen-doctor -o | \ kscreen-doctor -o | \
grep Brightness | \ grep Brightness | \
head -n 1 | \ head -n 1 | \
sed 's/.*set to \([0-9]\+\)%.*/\1/' \ grep -oP "(?<=set to )[0-9]+" \
> $CONFIG_CURR_BRIGHTNESS > $CONFIG_CURR_BRIGHTNESS
echo "DEBUG: TARGET BRIGHTNESS" $HDR_TARGET_BRIGHTNESS kscreen-doctor output.$MONITOR.brightness.$SDR_TARGET_BRIGHTNESS
kscreen-doctor output.$MONITOR.brightness.$HDR_TARGET_BRIGHTNESS
fi fi
} }
restore_brightness() { restore_brightness() {
if [ -f $CONFIG_CURR_BRIGHTNESS ]; then if [ -f $CONFIG_CURR_BRIGHTNESS ]; then
echo "Debug: CURRENT BRIGHTNESS" $(cat $CONFIG_CURR_BRIGHTNESS)
kscreen-doctor output.$MONITOR.brightness.$(cat $CONFIG_CURR_BRIGHTNESS) kscreen-doctor output.$MONITOR.brightness.$(cat $CONFIG_CURR_BRIGHTNESS)
rm $CONFIG_CURR_BRIGHTNESS
fi fi
} }
+9
View File
@@ -0,0 +1,9 @@
# Copy this file into ~/.config/hdr-helper
#
# # Example Value | Description
# #---------------|--------------------------------------------------------------------------------#
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.
SDR_TARGET_BRIGHTNESS=0 # 100 | Enter a target SDR brightness level for your display when in HDR mode [0,1-100].
# 0 | Default