Commit 8d6e66e73f19
Changed files (1)
home
common
desktop
niri
home/common/desktop/niri/waybar.nix
@@ -24,6 +24,8 @@
"custom/separator"
"wireplumber"
"custom/separator"
+ "custom/tuned"
+ "custom/separator"
"battery"
];
"custom/separator" = {
@@ -106,6 +108,35 @@
"(.*) - zsh" = "> [$1]";
};
};
+ "custom/tuned" = {
+ "exec" = pkgs.writeShellScript "waybar-tuned" ''
+ while true; do
+ profile=$(tuned-adm active 2>/dev/null | sed 's/.*: //')
+ case "$profile" in
+ powersave) icon="๐"; class="powersave" ;;
+ balanced-battery) icon="๐"; class="balanced-battery" ;;
+ balanced) icon="โก"; class="balanced" ;;
+ throughput-*|performance*) icon="๐"; class="performance" ;;
+ *) icon="โ"; class="unknown" ;;
+ esac
+ printf '{"text": "%s %s", "tooltip": "Power: %s", "class": "%s"}\n' "$icon" "$profile" "$profile" "$class"
+ sleep 10
+ done
+ '';
+ "return-type" = "json";
+ "format" = "{}";
+ "tooltip" = true;
+ "on-click" = pkgs.writeShellScript "tuned-cycle" ''
+ current=$(tuned-adm active 2>/dev/null | sed 's/.*: //')
+ case "$current" in
+ powersave) next="balanced-battery" ;;
+ balanced-battery) next="balanced" ;;
+ balanced) next="throughput-performance" ;;
+ *) next="powersave" ;;
+ esac
+ tuned-adm profile "$next"
+ '';
+ };
"niri/language" = {
"format" = "{short}-{variant}";
"on-click-right" = "niri msg action switch-layout prev";
@@ -237,6 +268,22 @@
color: #8e24aa; /* Accessible purple for white backgrounds */ /* Mauve in Catppuccin */
}
+ #custom-tuned.powersave {
+ color: #50fa7b;
+ }
+
+ #custom-tuned.balanced-battery {
+ color: #8be9fd;
+ }
+
+ #custom-tuned.balanced {
+ color: #f1fa8c;
+ }
+
+ #custom-tuned.performance {
+ color: #ff5555;
+ }
+
#custom-separator {
margin: 0 1px;
}