]> Freerunner's - dotfiles.git/commitdiff
hypr: migrate wayland-generic gamma control to hyprsunset
authorAndre Ramnitz <tux.rising@gmail.com>
Thu, 26 Jun 2025 00:26:33 +0000 (02:26 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Thu, 26 Jun 2025 00:26:33 +0000 (02:26 +0200)
dot-config/hypr/hyprland.conf
dot-config/hypr/scripts/hyprsunset.sh [new file with mode: 0755]

index e3cf609d6e75bfe35a3b34b8999798409301fb0a..e9bf0e97bc196252d919d3e27e0c7567c79b920b 100644 (file)
@@ -20,7 +20,6 @@ xwayland {
 
 # See https://wiki.hyprland.org/Configuring/Keywords/ for more
 exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
-exec-once = sunsetr
 # exec-shutdown = setenv WAYLAND_DISPLAY= XDG_SESSION_TYPE= XDG_CURRENT_DESKTOP=
 
 # Execute your favorite apps at launch
@@ -28,6 +27,7 @@ exec-once = ~/.config/hypr/scripts/startup.sh
 exec-once = hypridle
 exec-once = hyprpm reload
 exec-once = hyprpaper
+exec-once = hyprsunset
 exec-once = flatpak run ch.threema.threema-desktop
 
 # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
@@ -67,7 +67,7 @@ general {
     # col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
     col.active_border = 0xfa$base0C 0xff$base0B 45deg
     col.inactive_border = 0xfa$base02
-    col.nogroup_border_active = 0xff$base0E
+    col.nogroup_border_active = 0xff$base09
     col.nogroup_border = 0xfa$base02
 
     layout = dwindle
@@ -168,7 +168,7 @@ device {
 group {
        merge_groups_on_drag = 0
        insert_after_current = 1
-       col.border_locked_active = 0xfa$base0E
+       col.border_locked_active = 0xfa$base09
        col.border_locked_inactive = 0xfa$base02
        col.border_active = 0xEE$base0C
        col.border_inactive = 0xfa$base02
@@ -187,10 +187,10 @@ group {
        text_color = 0xFF$base00
        gradients = true
        scrolling = false
-       col.locked_active = 0xfa$base0E 0x8a$base0E 45deg
+       col.locked_active = 0xfa$base09 0x8a$base09 45deg
        col.locked_inactive = 0xfa$base04 0x8a$base04 45deg
-       col.active = 0xfa$base0C 0xfa$base0D 45deg
-       col.inactive = 0xfa$base04 0xaa$base04 45deg
+       col.active = 0xfa$base0C 0x8a$base0C 45deg
+       col.inactive = 0xfa$base04 0x8a$base04 45deg
                rounding = 4
                gradient_rounding = 4
        gradient_round_only_edges = true
diff --git a/dot-config/hypr/scripts/hyprsunset.sh b/dot-config/hypr/scripts/hyprsunset.sh
new file mode 100755 (executable)
index 0000000..385c8a7
--- /dev/null
@@ -0,0 +1,67 @@
+#!/bin/bash
+CMD=$1
+DELTA=$2
+TOGGLE=$3
+if [ -z "$CMD" ]; then
+  echo "Set or get gamma and color temperature through hyprsunset IPC socket"
+  echo "Usage: sunset.sh <gamma/temperature> [+-][value] [toggle]"
+  exit 1
+fi
+if [[ ! -z "$TOGGLE" ]]; then
+  CUR=$(hyprctl hyprsunset $CMD)
+  FMT=$(LC_NUMERIC="en_US.UTF-8" printf "%.0f" $CUR 2>/dev/null)
+  if [ "$FMT" = "$DELTA" ]; then
+    if [ "$CMD" = "gamma" ]; then
+      DELTA=100
+    else
+      DELTA=6500
+    fi
+  fi
+fi
+[ "$CMD" = "gamma" ] && LEN=3 || LEN=4
+if [[ ! -z "$DELTA" ]]; then
+  # rate limit and queue commands to workaround nvidia freezing on ctm spam
+  flock /tmp/sunset.lock sleep 0.1
+  # tell waybar to update after a change
+  pkill -SIGRTMIN+$LEN waybar
+fi
+if NUM=$(hyprctl hyprsunset $CMD $DELTA); then
+  if FMT=$(LC_NUMERIC="en_US.UTF-8" printf "%$LEN.0f" $NUM 2>/dev/null); then
+    echo "$FMT"
+  fi
+fi
+
+
+# #!/bin/bash
+# CMD="$1"
+# DELTA="$2"
+# TOGGLE="$3"
+# if [ -z "$CMD" ]; then
+#   echo "Set or get gamma and color temperature through hyprsunset IPC socket"
+#   echo "Usage: sunset.sh <gamma/temperature> [+-][value] [toggle]"
+#   exit 1
+# fi
+# if [[ -n "$TOGGLE" ]]; then
+#   CUR=$(hyprctl hyprsunset "$CMD")
+#   FMT=$(LC_NUMERIC="en_US.UTF-8" printf "%.0f" "$CUR" 2>/dev/null)
+#   if [ "$FMT" = "$DELTA" ]; then
+#     if [ "$CMD" = "gamma" ]; then
+#       DELTA=100
+#     else
+#       DELTA=6500
+#     fi
+#   fi
+# fi
+# [ "$CMD" = "gamma" ] && LEN=3 || LEN=4
+# if [[ -n "$DELTA" ]]; then
+#   # rate limit and queue commands to workaround nvidia freezing on ctm spam
+#   flock /tmp/sunset.lock sleep 0.1
+#   # tell waybar to update after a change
+#   pkill -SIGRTMIN+"$LEN" waybar
+# fi
+# if NUM=$(hyprctl hyprsunset "$CMD" "$DELTA"); then
+#   if FMT=$(LC_NUMERIC="en_US.UTF-8" printf "%$LEN.0f" "$NUM" 2>/dev/null); then
+#     echo "$FMT"
+#   fi
+# fi
+