From d807b41b7f35047655892c63c0922a1f474634a4 Mon Sep 17 00:00:00 2001 From: mardevour Date: Sun, 22 Sep 2024 13:45:03 +0200 Subject: [PATCH] Adding tags / translation functionality to the i3block displaying the current power profile --- etc/skel/.config/i3/scripts/ppd-status | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/etc/skel/.config/i3/scripts/ppd-status b/etc/skel/.config/i3/scripts/ppd-status index 8e6eb7b7..6cc2f3dd 100644 --- a/etc/skel/.config/i3/scripts/ppd-status +++ b/etc/skel/.config/i3/scripts/ppd-status @@ -7,5 +7,19 @@ # script to show current power profile +# assign tags or translations to each profile +declare -A tags +tags=( + [performance]="Performance" + [balanced]="Balanced" + [power-saver]="Power saver" +) + +# Get current profile current_profile=$(/usr/bin/powerprofilesctl get) -echo "$current_profile" + +# Get tag from the array +profile_tag=${tags[$current_profile]} + +# Show tag on i3block +echo "${profile_tag:-$current_profile}"