#!/bin/bash TOGGLE_FILE=~/.config/polybar/scripts/battery_toggle_state # Read the current state CURRENT_STATE=$(cat $TOGGLE_FILE) # Toggle the state if [ "$CURRENT_STATE" == "icon" ]; then echo "percentage" > $TOGGLE_FILE else echo "icon" > $TOGGLE_FILE fi # Notify Polybar to refresh the module polybar-msg hook battery 1