Commit a084e1a4068e

Vincent Demeester <vincent@sbr.pm>
2026-07-30 09:54:05
feat: add Mod+P to cycle power profiles in niri
Cycles powersave โ†’ balanced-battery โ†’ balanced โ†’ latency-performance with desktop notification. Uses tuned-adm directly, works on Fedora CSB.
1 parent d54eea9
Changed files (2)
dots/bin/power-profile-cycle
@@ -0,0 +1,16 @@
+#!/usr/bin/env bash
+# Cycle through tuned power profiles and notify
+set -euo pipefail
+
+current=$(tuned-adm active 2>/dev/null | sed 's/.*: //')
+
+case "$current" in
+    powersave)             next="balanced-battery" ;;
+    balanced-battery)      next="balanced" ;;
+    balanced)              next="latency-performance" ;;
+    latency-performance)   next="powersave" ;;
+    *)                     next="balanced" ;;
+esac
+
+tuned-adm profile "$next"
+notify-send --icon=battery --category=info "Power: $next"
dots/config/niri/config.kdl
@@ -223,6 +223,7 @@ binds {
 
     Mod+T { spawn "bash" "-c" "notify-send --icon=clock --category=info --urgency=critical \"$(date +\"%I:%M\")\""; }
     Mod+B { spawn "bash" "-c" "notify-send --icon=battery --category=info --urgency=critical \"$(acpi)\""; }
+    Mod+P hotkey-overlay-title="Cycle Power Profile" { spawn "power-profile-cycle"; }
     Mod+Shift+T hotkey-overlay-title="Toggle Color Scheme" { spawn "toggle-color-scheme"; }
 
     Mod+Shift+B { spawn "pkill" "-USR1" "waybar"; }