dot

packages and services management
Log | Files | Refs | README

commit 553415fa301fa1eb27846a063c030f04a876a08a
parent 7d87e70321e5209aa004bf2ab7a90fe6267933fc
Author: josuah <mail@josuah.net>
Date:   Sat,  5 Nov 2016 03:08:44 -0400

Merge branch 'master' of http://github.com/josuah/Config

Diffstat:
Mbin/status | 22++++++++++++++++------
Mbin/status-line | 2++
Mshell/.profile | 1-
Cbin/status -> vmR8opj/3 | 0
AvmR8opj/4 | 45+++++++++++++++++++++++++++++++++++++++++++++
Cbin/status -> vtGCE6H/2 | 0
AvtGCE6H/3 | 36++++++++++++++++++++++++++++++++++++
7 files changed, 99 insertions(+), 7 deletions(-)

diff --git a/bin/status b/bin/status @@ -5,20 +5,30 @@ #------------------------------------------------------------------------------- # Plain text status line for wherever useful -mail="$(ls "$MAIL/new" | wc -l)" -mail="${mail#0}" -mail="${mail:+mail $mail}" + +if [ -d $MAIL/new ] +then + mail="$(ls "$MAIL/new" | wc -l)" + mail="${mail#0}" + mail="${mail:+mail $mail}" +fi + date="$(date +'%Y-%m-%d %H:%M')" + cpu="$(awk '/cpu/ { usage = ($2 + $4) / ($2 + $4 + $5) * 100; } END { - printf("%i%%", usage); + printf("%i", usage); }' /proc/stat)" -battery="$(tee < /sys/class/power_supply/BAT1/capacity)%" + +IFS='' read -r battery < "$( + find -L /sys/class/power_supply -maxdepth 2 -name capacity 2> /dev/null +)" + main() { printf ' ' @@ -33,4 +43,4 @@ main() { printf ' ' } -main "$mail" "cpu $cpu" "bat $battery" "$date" +main "$mail" "cpu $cpu%" "bat $battery%" "$date" diff --git a/bin/status-line b/bin/status-line @@ -10,6 +10,7 @@ # # PS1='$(status_line)> ' + # # Current directory git status, # @@ -68,6 +69,7 @@ git_status() }' } + main() { local pwd="$(pwd)" diff --git a/shell/.profile b/shell/.profile @@ -58,7 +58,6 @@ alias lines='find . -name "*.[ch]" | xargs wc -l' if [ "$TERM" = 'linux' ] then theme pink - setfont "$CONFIG/fonts/terminus/ter-v16n.psf.gz" fi diff --git a/bin/status b/vmR8opj/3 diff --git a/vmR8opj/4 b/vmR8opj/4 @@ -0,0 +1,45 @@ +# | | +# ,--- |-- ,--. |-- , , ,--- +# `--. | ,--| | | | `--. +# ---' ' `--` ' `--` ---' 2016-11-01 +#------------------------------------------------------------------------------- +# Plain text status line for wherever useful + + +if [ -d "$MAIL/new" ] +then + mail="$(ls "$MAIL/new" | wc -l)" + mail="${mail#0}" + mail="${mail:+mail $mail}" +fi + + +date="$(date +'%Y-%m-%d %H:%M')" + + +cpu="$(awk '/cpu/ { + usage = ($2 + $4) / ($2 + $4 + $5) * 100; +} +END { + printf("%i%%", usage); +}' /proc/stat)" + + +read battery < /sys/class/power_supply/*/capacity +battery="$battery%" + + +main() { + printf ' ' + while [ "$#" -gt 0 ] + do + printf '%s' "$1" + + [ "$1" -a "$#" -gt 1 ] && printf ' | ' + + shift + done + printf ' ' +} + +main "$mail" "cpu $cpu" "bat $battery" "$date" diff --git a/bin/status b/vtGCE6H/2 diff --git a/vtGCE6H/3 b/vtGCE6H/3 @@ -0,0 +1,36 @@ +# | | +# ,--- |-- ,--. |-- , , ,--- +# `--. | ,--| | | | `--. +# ---' ' `--` ' `--` ---' 2016-11-01 +#------------------------------------------------------------------------------- +# Plain text status line for wherever useful + +mail="$(ls "$MAIL/new" | wc -l)" +mail="${mail#0}" +mail="${mail:+mail $mail}" + +date="$(date +'%Y-%m-%d %H:%M')" + +cpu="$(awk '/cpu/ { + usage = ($2 + $4) / ($2 + $4 + $5) * 100; +} +END { + printf("%i%%", usage); +}' /proc/stat)" + +battery="$(tee < /sys/class/power_supply/BAT2/capacity)%" + +main() { + printf ' ' + while [ "$#" -gt 0 ] + do + printf '%s' "$1" + + [ "$1" -a "$#" -gt 1 ] && printf ' | ' + + shift + done + printf ' ' +} + +main "$mail" "cpu $cpu" "bat $battery" "$date"