Add skel directory, tidy up battery warning script.
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
# http://github.com/github/gitignore
|
# http://github.com/github/gitignore
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
.*
|
|
||||||
!.gitignore
|
!.gitignore
|
||||||
*~
|
*~
|
||||||
|
|
||||||
|
|||||||
@@ -4,10 +4,13 @@
|
|||||||
# creating nice output if you click on the status bar
|
# creating nice output if you click on the status bar
|
||||||
# what i done depends on the first paramter
|
# what i done depends on the first paramter
|
||||||
|
|
||||||
[[ ! -d "$LOGDIR/batwarn" ]] && mkdir -p "$LOGDIR/batwarn"
|
rundir="$RUNDIR/batwarn"
|
||||||
|
logfile="$LOGDIR/batwarn.log"
|
||||||
|
|
||||||
PATH_WARN_1="$LOGDIR/batwarn/batwarn1"
|
[[ ! -d "$rundir" ]] && mkdir -p "$rundir"
|
||||||
PATH_WARN_2="$LOGDIR/batwarn/batwarn2"
|
|
||||||
|
PATH_WARN_1="$rundir/batwarn1"
|
||||||
|
PATH_WARN_2="$rundir/batwarn2"
|
||||||
|
|
||||||
THRESHOLD1=25
|
THRESHOLD1=25
|
||||||
THRESHOLD2=5
|
THRESHOLD2=5
|
||||||
@@ -22,6 +25,11 @@ fi
|
|||||||
time="$(echo "$acpi_output" | cut -d "," -f 3 | cut -d " " -f 2)"
|
time="$(echo "$acpi_output" | cut -d "," -f 3 | cut -d " " -f 2)"
|
||||||
shortstatus="$(echo $status | cut -c 1)"
|
shortstatus="$(echo $status | cut -c 1)"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo [$(date +%FT%T)] "$*" >> $logfile
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
pretty() {
|
pretty() {
|
||||||
(
|
(
|
||||||
echo "Status:|$status"
|
echo "Status:|$status"
|
||||||
@@ -52,11 +60,13 @@ conky() {
|
|||||||
if discharging ; then
|
if discharging ; then
|
||||||
if threshold2 ; then
|
if threshold2 ; then
|
||||||
if [[ ! -f "$PATH_WARN_2" ]] ; then
|
if [[ ! -f "$PATH_WARN_2" ]] ; then
|
||||||
|
log "battery fell below $THRESHOLD2 percent. issuing warning."
|
||||||
echo > "$PATH_WARN_2"
|
echo > "$PATH_WARN_2"
|
||||||
notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" --expire-time 0
|
notify-send --icon dialog-warning "Battery below ${THRESHOLD2}%" --expire-time 0
|
||||||
fi
|
fi
|
||||||
elif threshold1 ; then
|
elif threshold1 ; then
|
||||||
if [[ ! -f "$PATH_WARN_1" ]] ; then
|
if [[ ! -f "$PATH_WARN_1" ]] ; then
|
||||||
|
log "battery fell below $THRESHOLD1 percent. issuing warning."
|
||||||
echo > "$PATH_WARN_1"
|
echo > "$PATH_WARN_1"
|
||||||
notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" --expire-time 30000
|
notify-send --icon dialog-warning "Battery below ${THRESHOLD1}%" --expire-time 30000
|
||||||
fi
|
fi
|
||||||
@@ -64,7 +74,10 @@ conky() {
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if charging ; then
|
if charging ; then
|
||||||
[[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
|
if [[ -f "$PATH_WARN_1" ]] ; then
|
||||||
|
log "charging now. resetting warnings."
|
||||||
|
rm "$PATH_WARN_1"
|
||||||
|
fi
|
||||||
[[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
|
[[ -f "$PATH_WARN_2" ]] && rm "$PATH_WARN_2"
|
||||||
#if [[ $percent -gt 25 ]] ; then
|
#if [[ $percent -gt 25 ]] ; then
|
||||||
# [[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
|
# [[ -f "$PATH_WARN_1" ]] && rm "$PATH_WARN_1"
|
||||||
|
|||||||
0
skel/.var/lib/mpd/.gitignore
vendored
Normal file
0
skel/.var/lib/mpd/.gitignore
vendored
Normal file
0
skel/.var/log/i3/.gitignore
vendored
Normal file
0
skel/.var/log/i3/.gitignore
vendored
Normal file
0
skel/.var/log/mpd/.gitignore
vendored
Normal file
0
skel/.var/log/mpd/.gitignore
vendored
Normal file
0
skel/.var/run/batwarn/.gitignore
vendored
Normal file
0
skel/.var/run/batwarn/.gitignore
vendored
Normal file
0
skel/.var/run/i3/.gitignore
vendored
Normal file
0
skel/.var/run/i3/.gitignore
vendored
Normal file
Reference in New Issue
Block a user