summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortslil clingman <>2020-01-31 13:47:29 -0800
committertslil clingman <>2020-01-31 13:47:29 -0800
commitcef874a5aaf7a8c2ba60603176500099cf3c4362 (patch)
treee8bd1a3590e70f5427b6430034b2b65f2b697484
parent1e32cf0116d816dc64f744ed8812aa5a2a850f1e (diff)
Tweaks for bison
-rwxr-xr-xbattery41
-rwxr-xr-xce8
-rwxr-xr-xlock5
3 files changed, 14 insertions, 40 deletions
diff --git a/battery b/battery
index 4878dd1..29189ae 100755
--- a/battery
+++ b/battery
@@ -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;
diff --git a/ce b/ce
index db21013..f7d5bd8 100755
--- a/ce
+++ b/ce
@@ -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
diff --git a/lock b/lock
index 080983b..5d23815 100755
--- a/lock
+++ b/lock
@@ -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