This repository has been archived on 2023-11-11. You can view files and clone it, but cannot push or open issues or pull requests.
yadm-dotfiles/.local/bin/battery.sh

18 lines
365 B
Bash

#!/bin/bash
BAT0=$(upower --show-info /org/freedesktop/UPower/devices/battery_BAT0 | grep percentage | awk '{ print $2 }')
BAT1=$(upower --show-info /org/freedesktop/UPower/devices/battery_BAT1 | grep percentage | awk '{ print $2 }')
echo '{'
echo -ne ' "BAT0": "'
echo -ne "${BAT0}"
echo '",'
echo -ne ' "BAT1": "'
echo -ne "${BAT1}"
echo '"'
echo '}'