Skip to content

Commit

Permalink
Add new messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ushi Hiraga committed Jul 2, 2024
1 parent d11a796 commit 50145ae
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/battery-level-notification
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,17 @@ CONFIG_FOLDER=$HOME/.config/battery-level-notification/${BATTERY_NAME};
SLEEP_TIME=5;
EXEC_PATH="";
if test -x $CONFIG_FOLDER/config; then source ${CONFIG_FOLDER}/config; fi
echo "Watching battery ${BATTERY_NAME}"

while true; do
sleep $SLEEP_TIME;

CURR_BATTERY_LEVEL=$(cat /sys/class/power_supply/${BATTERY_NAME}/capacity);
if [ $CURR_BATTERY_LEVEL == $PREV_BATTERY_LEVEL ]; then
echo "Battery level has not changed.";
continue;
fi

echo "Battery level had a change.";
PREV_BATTERY_LEVEL="$CURR_BATTERY_LEVEL";
BATTERY_STATUS=$(cat /sys/class/power_supply/${BATTERY_NAME}/status);

Expand Down

0 comments on commit 50145ae

Please sign in to comment.