xxwhirlpool
·
2026-07-04
1#!/usr/bin/env bash
2#
3# check battery status on my laptop, but cute
4
5# check if not running on laptop (mariposa hostname)
6if [[ "$(hostname)" != "mariposa" ]]; then
7 echo "only works on your laptop, dumbass"
8fi
9
10# styling stuff
11gum_border() {
12 # echo in here so i can use newlines in the msg (\n)
13 echo -e "$@" | gum style --foreground "#a6d189" --border-foreground "#99d1db" --border double --width 50 --padding "0 0" --align center
14}
15
16gum_echo_custom() {
17 # $* here to sub in the $charge_percent variable
18 gum style --foreground "#f4b8e4" --width 50 --padding "0 0" --align center "current: $*"
19}
20
21# get the battery percentage (minus the % sign ofc)
22charge_percent=$(upower -i "$(upower -e | grep 'BAT')" | awk '/percentage/ {print $NF}' | sed 's/%//g')
23
24# display it
25gum_border "[ █ █ █ █ █ █ █ █ █ █ █ ]" # cute battery text art i found online
26gum_echo_custom "$charge_percent%" # show the percentage (prefixed with "current:")