diff options
| author | tslil clingman <> | 2020-01-31 13:47:29 -0800 |
|---|---|---|
| committer | tslil clingman <> | 2020-01-31 13:47:29 -0800 |
| commit | cef874a5aaf7a8c2ba60603176500099cf3c4362 (patch) | |
| tree | e8bd1a3590e70f5427b6430034b2b65f2b697484 | |
| parent | 1e32cf0116d816dc64f744ed8812aa5a2a850f1e (diff) | |
Tweaks for bison
| -rwxr-xr-x | battery | 41 | ||||
| -rwxr-xr-x | ce | 8 | ||||
| -rwxr-xr-x | lock | 5 |
3 files changed, 14 insertions, 40 deletions
@@ -1,36 +1,9 @@ #!/bin/sh - -names="sbs-20-000b BAT0" -dir="" - -for n in $names; do - if [ -d "/sys/class/power_supply/$n" ] ; then - dir=$n - break - fi; -done - -if [ -z "$dir" ]; then - echo \? - exit 0 +report=$(acpi | tr -d ',') +echo $report | grep -qv Unknown +if [ "$?" = "0" ]; then + status=$(echo $report | cut -d\ -f 3 | cut -b 1) + perc=$(echo $report | cut -d\ -f 4) + time=$(echo $report | cut -d\ -f 5 | sed 's/\([0-9]*\):\([0-9]*\).*/\1h\2m/') + echo $status$perc $time fi - -fetch() { - file="/sys/class/power_supply/$dir/$1" - [ -f "$file" ] && cat "$file" || exit 1 -} - -status=$(fetch status) - -if [ "$status" = "Full" ] || [ "$status" = "Unknown" ] ; then - echo $status -else - if [ "$status" = "Discharging" ]; then - time=$(fetch time_to_empty_avg) - else - time=$(fetch time_to_full_avg) - fi; - hours=$(($time/3600)) - minutes=$(($time/60-$hours*60)) - echo $status $(fetch capacity)%, "$hours"h "$minutes"m -fi; @@ -3,10 +3,10 @@ # source in a function j() { ce $*; cd `head -n 1 ~/.local/share/dir_lst` } # or some such. Depends on: sed, ed, rlwrap, grep [ "$1" = "$HOME" ] && echo $HOME && exit ; -fl="$HOME/.local/share/dir_lst"; [ ! -f "$fl" ] && echo "\n" > "$fl" +fl="$HOME/.local/share/dir_lst"; [ ! -f "$fl" ] && echo -e "\n" > "$fl" [ "$2" = '!' ] && echo $1 && exit || \ ln=`grep -n "$1" "$fl" | head -n 1 | cut -d : -f 1`; if [ -n "$1" ]; then -if [ -n "$ln" ]; then echo "$ln m0\n1p\nw" | ed -s "$fl" || echo \?; +if [ -n "$ln" ]; then echo -e "$ln m0\n1p\nw" | ed -s "$fl" || echo \?; else l="$1"; while [ ! -d "$l" ]; do echo \?; l="$(rlwrap -P$PWD/ -co cat -)"; -done; echo "0i\n$l\n.\nw" | ed -s "$fl"; sed -i '43,$d' "$fl"; fi; else -echo "2 m0\nw" | ed -s "$fl"; fi +done; echo -e "0i\n$l\n.\nw" | ed -s "$fl"; sed -i '43,$d' "$fl"; fi; else +echo -e "2 m0\nw" | ed -s "$fl"; fi @@ -2,6 +2,7 @@ killall -s HUP gpg-agent keychain --clear xset dpms force off -slock xset -dpms -xset s off
\ No newline at end of file +xset s off +slock +fix_backlight |
