#!/bin/bash profile_file="/sys/firmware/acpi/platform_profile" options_file="/sys/firmware/acpi/platform_profile_choices" profile_colors=( "#5ab738" # low "#d5911a" # balanced "#f22c40" # performance ) profile_name=( "${1:-"L"}" # low "${2:-"M"}" # balanced "${3:-"H"}" # performance ) [[ -f "$profile_file" ]] || exit 0 readarray -t options < <(sed 's/ /\n/g' "$options_file") print_profile(){ profile="$(cat "$profile_file")" for i in "${!options[@]}"; do if [[ "${options[$i]}" = "$profile" ]]; then index="$i"; fi done echo "%{F${profile_colors[index]}}${profile_name[index]}%{F-}" } print_profile while inotifywait -e modify "$profile_file" &> /dev/null; do print_profile done