@@ -36,6 +36,7 @@
"custom/keyboard-layout",
"tray",
// @host jellyfish
+ "custom/tlp",
"battery",
// @end
"clock#date",
@@ -61,6 +62,16 @@
},
+// @host jellyfish
+ "custom/tlp": {
+ "exec": "~/.config/waybar/scripts/tlp-status.sh",
+ "return-type": "json",
+ "interval": 10,
+ "format": "{}",
+ "tooltip": true
+ },
+// @end
+
"battery": {
"interval": 10,
"states": {
@@ -0,0 +1,16 @@
+#!/bin/bash
+ac=$(cat /sys/class/power_supply/AC/online 2>/dev/null || echo 0)
+governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo "unknown")
+if [ "$ac" = "1" ]; then
+ icon="" # bolt / AC
+ label="AC"
+ class="ac"
+else
+ icon="" # leaf / power-save
+ label="BAT"
+ class="battery"
+fi
+tooltip="TLP: $label mode\nCPU governor: $governor"
+echo "{\"text\": \"$icon $governor\", \"tooltip\": \"$tooltip\", \"class\": \"$class\"}"