Fix issue with update checker script and minor other fixes
This commit is contained in:
parent
4b6cab805c
commit
b363ef013a
@ -24,7 +24,7 @@ setup_keyring() {
|
||||
sudo pacman-key --populate archlabs
|
||||
}
|
||||
|
||||
while ! (ping -c 1 archlabslinux.com &>/dev/null || ping -c 1 bitbucket.org &>/dev/null || ping -c 1 github.com &>/dev/null); do
|
||||
while ! (ping -c 1 archlabslinux.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 google.com) &>/dev/null; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
|
@ -354,7 +354,7 @@ menu-3-3-exec = systemctl -i poweroff
|
||||
type = custom/script
|
||||
tail = true
|
||||
label = %output%
|
||||
click-left = toggle.sh -c -tg &
|
||||
click-left = toggle.sh -c -t &
|
||||
exec = toggle.sh -c
|
||||
format = <label>
|
||||
|
||||
@ -393,7 +393,7 @@ type = custom/script
|
||||
tail = true
|
||||
exec = toggle.sh -r
|
||||
label = %output%
|
||||
click-left = toggle.sh -r -tg &
|
||||
click-left = toggle.sh -r -t &
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;
|
||||
|
@ -6,14 +6,10 @@ disconnected2="\\"
|
||||
wireless_connected=""
|
||||
ethernet_connected=""
|
||||
|
||||
ID="$(ip link | awk '/state UP/ {print $2}')"
|
||||
|
||||
while true; do
|
||||
if (ping -c 1 archlabslinux.com || ping -c 1 google.com || ping -c 1 bitbucket.org || ping -c 1 github.com || ping -c 1 sourceforge.net) &>/dev/null; then
|
||||
# avoid checking what type of interface it is every loop
|
||||
if (( count < 1 )); then
|
||||
ID="$(ip link | awk '/state UP/ {print $2}')"
|
||||
((count++))
|
||||
fi
|
||||
|
||||
if [[ $ID == e* ]]; then
|
||||
echo "$ethernet_connected" ; sleep 25
|
||||
else
|
||||
|
@ -26,7 +26,6 @@ usage() {
|
||||
|
||||
-l,--logout Session logout dialog
|
||||
|
||||
|
||||
Without any options -r,--run will be opened.
|
||||
|
||||
EOF
|
||||
|
@ -1,30 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
Name=$(basename "$0")
|
||||
Version="0.3"
|
||||
NAME=$(basename "$0")
|
||||
VER="0.3"
|
||||
|
||||
_usage() {
|
||||
usage() {
|
||||
cat <<EOF
|
||||
|
||||
USAGE:
|
||||
$Name [OPTIONS [ADDITIONAL]]
|
||||
USAGE: $NAME [OPTIONS [ADDITIONAL]]
|
||||
|
||||
OPTIONS:
|
||||
-h,--help Display this message
|
||||
|
||||
-v,--version Display script version
|
||||
-h,--help Display this message
|
||||
|
||||
-p,--polybar Toggle the configured polybar session, NO additional options
|
||||
-v,--version Display script version
|
||||
|
||||
-c,--compton Toggle compton or daemon monitoring icon, can use toggle option
|
||||
-p,--polybar Toggle the configured polybar session, NO additional options
|
||||
|
||||
-r,--redshift Toggle redshift or daemon monitoring icon, can use toggle option
|
||||
-c,--compton Toggle compton or daemon monitoring icon, can use toggle option
|
||||
|
||||
-f,--caffeine Toggle caffeine or daemon monitoring icon, can use toggle option
|
||||
-r,--redshift Toggle redshift or daemon monitoring icon, can use toggle option
|
||||
|
||||
-f,--caffeine Toggle caffeine or daemon monitoring icon, can use toggle option
|
||||
|
||||
ADDITIONAL:
|
||||
|
||||
-tg,--toggle Toggle the program off/on, without this flag a monitor process will be started
|
||||
-t,--toggle Toggle the program off/on, without this flag a monitor process will be started
|
||||
|
||||
EOF
|
||||
}
|
||||
@ -112,38 +112,29 @@ toggle_caffeine() {
|
||||
|
||||
# Catch command line options
|
||||
case $1 in
|
||||
-h|--help)
|
||||
usage
|
||||
;;
|
||||
-v|--version)
|
||||
echo -e "$NAME -- Version $VER"
|
||||
;;
|
||||
-p|--polybar)
|
||||
toggle_polybar
|
||||
;;
|
||||
-c|--compton)
|
||||
case $2 in
|
||||
-tg|--toggle)
|
||||
opt=1
|
||||
esac
|
||||
[[ $2 =~ (-t|--toggle) ]] && opt=1
|
||||
toggle_compton
|
||||
;;
|
||||
-r|--redshift)
|
||||
case $2 in
|
||||
-tg|--toggle)
|
||||
opt=1
|
||||
esac
|
||||
[[ $2 =~ (-t|--toggle) ]] && opt=1
|
||||
toggle_redshift
|
||||
;;
|
||||
-f|--caffeine)
|
||||
case $2 in
|
||||
-tg|--toggle)
|
||||
opt=1
|
||||
esac
|
||||
[[ $2 =~ (-t|--toggle) ]] && opt=1
|
||||
toggle_caffeine
|
||||
;;
|
||||
-h|--help)
|
||||
_usage
|
||||
;;
|
||||
-v|--version)
|
||||
echo -e "$Name -- Version $Version"
|
||||
;;
|
||||
*)
|
||||
echo -e "Option does not exist: $1" && _usage && exit 1
|
||||
echo -e "Option does not exist: $1" && usage && exit 1
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
@ -8,24 +8,27 @@ get_total_updates() { UPDATES=$(checkupdates 2>/dev/null | wc -l); }
|
||||
while true; do
|
||||
get_total_updates
|
||||
|
||||
# notify user with varying levels of urgency depending on amount of updates
|
||||
# notify user of updates
|
||||
if hash notify-send &>/dev/null; then
|
||||
if (( UPDATES > 50 )); then
|
||||
notify-send -u critical -i $NOTIFY_ICON "You really need to update!!" "$UPD New packages"
|
||||
notify-send -u critical -i $NOTIFY_ICON \
|
||||
"You really need to update!!" "$UPDATES New packages"
|
||||
elif (( UPDATES > 25 )); then
|
||||
notify-send -u normal -i $NOTIFY_ICON "You should update soon" "$UPD New packages"
|
||||
notify-send -u normal -i $NOTIFY_ICON \
|
||||
"You should update soon" "$UPDATES New packages"
|
||||
elif (( UPDATES > 2 )); then
|
||||
notify-send -u low -i $NOTIFY_ICON "$UPD New packages"
|
||||
notify-send -u low -i $NOTIFY_ICON \
|
||||
"$UPDATES New packages"
|
||||
fi
|
||||
fi
|
||||
|
||||
# loop while updates are greater than zero
|
||||
# during which every 10 seconds another check for fresh updates is done
|
||||
# when there are updates available
|
||||
# every 10 seconds another check for updates is done
|
||||
while (( UPDATES > 0 )); do
|
||||
if (( UPDATES == 1 )); then
|
||||
echo "$UPD Update"
|
||||
echo "$UPDATES Update"
|
||||
elif (( UPDATES > 1 )); then
|
||||
echo "$UPD Updates"
|
||||
echo "$UPDATES Updates"
|
||||
else
|
||||
echo $BAR_ICON
|
||||
fi
|
||||
@ -33,8 +36,8 @@ while true; do
|
||||
get_total_updates
|
||||
done
|
||||
|
||||
# when no updates are available we go into a much longer loop to save cpu time
|
||||
# and only check once every 30 min for new updates
|
||||
# when no updates are available, use a longer loop, this saves on CPU
|
||||
# and network uptime, only checking once every 30 min for new updates
|
||||
while (( UPDATES == 0 )); do
|
||||
echo $BAR_ICON
|
||||
sleep 1800
|
||||
|
Reference in New Issue
Block a user