From 15e19b87fef3bf30974f6d5068b0cb20ce02548b Mon Sep 17 00:00:00 2001 From: Uyanide Date: Mon, 18 Aug 2025 20:59:21 +0200 Subject: [PATCH] enable HDR (maybe) --- .scripts/hypr-sdrbrightness.py | 45 ++++++++++++++++++++++++++++++++++ .scripts/mpv-hdr | 5 ++++ fish/prev.d/programs.fish | 2 +- hypr/hypridle.conf | 8 +++--- hypr/hyprland.conf | 1 + hypr/hyprland/general.conf | 13 +++------- hypr/hyprland/monitors.conf | 18 ++++++++++++++ 7 files changed, 77 insertions(+), 15 deletions(-) create mode 100755 .scripts/hypr-sdrbrightness.py create mode 100755 .scripts/mpv-hdr create mode 100644 hypr/hyprland/monitors.conf diff --git a/.scripts/hypr-sdrbrightness.py b/.scripts/hypr-sdrbrightness.py new file mode 100755 index 0000000..fe9fd0f --- /dev/null +++ b/.scripts/hypr-sdrbrightness.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python3 + +# new_brightness="$1" +# [ -z "$1" ] && new_brightness=1 + + +# sed -i "/sdrbrightness/c\ sdrbrightness = $new_brightness" + +import sys +import os + +if __name__ == "__main__": + if len(sys.argv) != 2: + new_brightness = 1 + else: + try: + new_brightness = float(sys.argv[1]) + if new_brightness < 1 or new_brightness > 1.5: + raise ValueError() + except Exception as e: + new_brightness = 1 + + print(f"Setting SDR brightness to: {new_brightness}\n") + + config_path = os.path.expanduser("~/.config/hypr/hyprland/monitors.conf") + if not os.path.exists(config_path): + print(f"Configuration file {config_path} does not exist.") + sys.exit(1) + + with open(config_path, 'r') as file: + lines = file.readlines() + for line in lines: + if "sdrbrightness" in line: + old_line = line.strip() + new_line = f" sdrbrightness = {new_brightness}\n" + lines[lines.index(line)] = new_line + print(f"Updated: {old_line} to {new_line.strip()}\n") + break + + with open(config_path, 'w') as file: + file.writelines(lines) + + print(f"New {config_path} content: \n") + with open(config_path, 'r') as file: + print(file.read()) diff --git a/.scripts/mpv-hdr b/.scripts/mpv-hdr new file mode 100755 index 0000000..196566c --- /dev/null +++ b/.scripts/mpv-hdr @@ -0,0 +1,5 @@ +#!/bin/sh + +export ENABLE_HDR_WSI=1 + +mpv --vo=gpu-next --target-colorspace-hint --gpu-api=vulkan --gpu-context=waylandvk "$@" \ No newline at end of file diff --git a/fish/prev.d/programs.fish b/fish/prev.d/programs.fish index f185994..1640b46 100644 --- a/fish/prev.d/programs.fish +++ b/fish/prev.d/programs.fish @@ -14,5 +14,5 @@ if type -q zoxide end if type -q trash - alias rm="echo \"use 'trash' instead :)\" && sh -c \"exit 42\"" + alias rm="echo \"use 'trash' instead :)\" && sh -c \"exit 42\" && echo why do you see this line :O" end diff --git a/hypr/hypridle.conf b/hypr/hypridle.conf index 0d2c740..a8fe836 100755 --- a/hypr/hypridle.conf +++ b/hypr/hypridle.conf @@ -17,7 +17,7 @@ listener { on-resume = hyprctl dispatch dpms on } -listener { - timeout = 540 # 9mins - on-timeout = $suspend_cmd -} +#listener { +# timeout = 540 # 9mins +# on-timeout = $suspend_cmd +#} diff --git a/hypr/hyprland.conf b/hypr/hyprland.conf index ce77fab..4865e72 100755 --- a/hypr/hyprland.conf +++ b/hypr/hyprland.conf @@ -4,3 +4,4 @@ source=~/.config/hypr/hyprland/general.conf source=~/.config/hypr/hyprland/rules.conf source=~/.config/hypr/hyprland/colors.conf source=~/.config/hypr/hyprland/keybinds.conf +source=~/.config/hypr/hyprland/monitors.conf diff --git a/hypr/hyprland/general.conf b/hypr/hyprland/general.conf index 2403187..2cad8bc 100755 --- a/hypr/hyprland/general.conf +++ b/hypr/hyprland/general.conf @@ -1,13 +1,3 @@ -# MONITOR CONFIG -monitor=,preferred,auto,1 -monitor=eDP-1,2560x1600@240,auto,1.25,bitdepth,10 -monitor=eDP-2,2560x1600@240,auto,1.25,bitdepth,10 -# monitor=,addreserved, 0, 0, 0, 0 # Custom reserved area - -# HDMI port: mirror display. To see device name, use `hyprctl monitors` -# monitor=HDMI-A-1,1920x1080@60,1920x0,1,mirror,eDP-1 - - input { # Keyboard: Add a layout and uncomment kb_options for Win+Space switching shortcut kb_layout = de @@ -186,3 +176,6 @@ xwayland { # disable_logs = false # } +experimental { + xx_color_management_v4 = true +} diff --git a/hypr/hyprland/monitors.conf b/hypr/hyprland/monitors.conf new file mode 100644 index 0000000..7087064 --- /dev/null +++ b/hypr/hyprland/monitors.conf @@ -0,0 +1,18 @@ +# MONITOR CONFIG +monitor=,preferred,auto,1 + +# monitor=eDP-1,2560x1600@240,auto,1.25,bitdepth,10 +monitor=eDP-2,2560x1600@240,auto,1.25,bitdepth,10 + +monitorv2 { + output = eDP-1 + mode = 2560x1600@240 + scale = 1.25 + bitdepth = 10 + + # comment out following lines to disabled HDR + supports_wide_color = true + supports_hdr = true + cm = hdr + sdrbrightness = 1.4 +}