Skip to content

Instantly share code, notes, and snippets.

@evamvid
Created June 23, 2015 03:24
Show Gist options
  • Select an option

  • Save evamvid/a7231fca5e549d88871e to your computer and use it in GitHub Desktop.

Select an option

Save evamvid/a7231fca5e549d88871e to your computer and use it in GitHub Desktop.

Revisions

  1. evamvid created this gist Jun 23, 2015.
    23 changes: 23 additions & 0 deletions NoUse
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    #!/bin/bash
    cat /sys/class/power_supply/BAT0/status
    OUTPUT="$(cat /sys/class/power_supply/BAT0/status)"
    echo "${OUTPUT}"
    if [ "${OUTPUT}" = "Charging" ] || [ "${OUTPUT}" = "Unknown" ]; then
    echo charging or full
    elif [ "${OUTPUT}" = "Discharging" ]; then
    notify-send -i /home/evamvid/Documents/Programming/OokiNoUse/power25.png "Hey there brother" "plug it in"
    COUNTER=0
    while [ "$COUNTER" -le 12 ]
    do
    cat /sys/class/power_supply/BAT0/status
    OUTPUT="$(cat /sys/class/power_supply/BAT0/status)"
    echo "${OUTPUT}"
    if [ "${OUTPUT}" = "Charging" ] || [ "${OUTPUT}" = "Unknown" ]; then
    exit
    elif [ "${OUTPUT}" = "Discharging" ]; then
    COUNTER=$(($COUNTER+1))
    echo $COUNTER
    sleep 1
    fi
    done
    fi