cleanup
This commit is contained in:
parent
fc83b60b90
commit
7b349f3892
|
@ -5,6 +5,9 @@ cyan="\033[36m"
|
|||
green="\033[32m"
|
||||
white="\033[37m"
|
||||
reset="\033[0m"
|
||||
|
||||
[ -z "$(ls /sys/class/power_supply)" ] && exit 0
|
||||
|
||||
for battery in /sys/class/power_supply/BAT?*; do
|
||||
pidof -x sbd-battery >/dev/null 2>&1 || sbd-battery "$battery" >/dev/null 2>&1 &
|
||||
[ -n "${capacity+x}" ] && printf " "
|
||||
|
|
|
@ -9,11 +9,11 @@ orange="\033[33m"
|
|||
|
||||
cache=/tmp/cpubarscache
|
||||
temp=$(sensors | awk '/CPU/ {printf ("%.f°C", $2)}' | tr -d "+")
|
||||
[ -n "$temp" ] && temp=" $temp "
|
||||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat)
|
||||
[ -n "$temp" ] && temp="$temp "
|
||||
stats=$(awk '/cpu[0-9]+/ {printf "%d %d %d\n", substr($1,4), ($2 + $3 + $4 + $5), $5 }' /proc/stat 2>/dev/null)
|
||||
[ ! -f $cache ] && echo "$stats" >"$cache"
|
||||
old=$(cat "$cache")
|
||||
printf "%b" "$big$normal$temp"
|
||||
printf "%b" "$big $normal$temp"
|
||||
echo "$stats" | while read -r row; do
|
||||
id=${row%% *}
|
||||
rest=${row#* }
|
||||
|
|
|
@ -4,18 +4,5 @@ big="\033[11m"
|
|||
reset="\033[0m"
|
||||
icon=""
|
||||
|
||||
if command -v pacman 1>/dev/null 2>&1; then
|
||||
num="$(pacman -Qu | grep -Fcv "[ignored]")"
|
||||
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset$num"
|
||||
fi
|
||||
|
||||
if command -v apt 1>/dev/null 2>&1; then
|
||||
vals=$(apt upgrade -sy 2>/dev/null | grep -m1 '^[0-9]\+ upgraded,' | tr -cd '0-9 ' | tr ' ' '\n' | grep '[0-9]\+' | xargs)
|
||||
|
||||
for i in $vals; do
|
||||
[ "$i" != 0 ] && updates_available=yes
|
||||
out="$out$i/"
|
||||
done
|
||||
|
||||
[ -n "$updates_available" ] && printf "%b" "$big$icon$reset $(echo "$out" | sed 's/\/$//')" || exit 0
|
||||
fi
|
||||
num="$(\xbps-install -Sun | grep -c "update")"
|
||||
[ "$num" -gt 0 ] && printf "%b" "$big$icon$reset $num\n"
|
||||
|
|
|
@ -2,28 +2,9 @@
|
|||
|
||||
BOLD='\033[1m'
|
||||
BLUE='\033[34m'
|
||||
NC='\033[0m'
|
||||
# apt -----------------------------------------------------------------------------
|
||||
# create the file /etc/apt/apt.conf.d/80statusbar containing the following
|
||||
|
||||
# DPkg::Post-Invoke {"/usr/bin/pkill -RTMIN+8 dwmblocks";};
|
||||
sudo xbps-install -Syu && pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
command -v apt 1>/dev/null 2>&1 && sudo apt upgrade
|
||||
|
||||
# void ----------------------------------------------------------------------------
|
||||
# Void doesn't have post-install hooks at all, and including pkills in the package hooks isn't feasible
|
||||
# Instead pkill is called in this script. Manually running updates will cause the status bar to desync
|
||||
|
||||
command -v xbps-install 1>/dev/null 2>&1 && sudo xbps-install -Syu && pkill -RTMIN+8 "${STATUSBAR:-dwmblocks}"
|
||||
|
||||
# newversion=$(grep -oP '(?<=\* version: )\d\d\d' "$(DISPLAY=invalid "$DOTS_DIR"/.local/share/firefox/updater.sh -r 2>/dev/null | grep -oP '(?<=Warning: user.js was saved to temporary file )/tmp/tmp\.\w+\.js')")
|
||||
# oldversion=$(grep -oP '(?<=\* version: )\d\d\d' "$DOTS_DIR"/.local/share/firefox/user.js)
|
||||
#
|
||||
# if [ $newversion -gt $oldversion ]; then
|
||||
# printf "%b" "$BOLD${BLUE}Updating arkenfox...$NC\n"
|
||||
# "$DOTS_DIR/.local/share/firefox/updater.sh" -b
|
||||
# fi
|
||||
|
||||
printf "%b" "$BOLD${BLUE}Upgrade complete.\nPress <Enter> to exit window.\n"
|
||||
printf "%b" "${BOLD}${BLUE}Upgrade complete.\nPress <Enter> to exit window.\n"
|
||||
read -r _
|
||||
exit
|
||||
|
|
Loading…
Reference in New Issue