Add files via upload

This commit is contained in:
GabriWar 2021-12-02 16:13:47 +00:00 committed by GitHub
parent f32d2c0245
commit b3fa23487d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 103 additions and 107 deletions

View File

@ -4,34 +4,34 @@
# to charge status ( for plugged up,  for discharging on battery, etc.).
case $BLOCK_BUTTON in
3) notify-send " Battery module" ": discharging
3) notify-send " Battery module" ": discharging
: not charging
: stagnant charge
: charging
: charged
: battery very low!
- Scroll to change adjust xbacklight." ;;
4) xbacklight -inc 10 ;;
5) xbacklight -dec 10 ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
4) xbacklight -inc 10 ;;
5) xbacklight -dec 10 ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# Loop through all attached batteries and format the info
for battery in /sys/class/power_supply/BAT?*; do
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status" 2>&1)" in
"Full") status="" ;;
"Discharging") status="" ;;
"Charging") status="" ;;
"Not charging") status="" ;;
"Unknown") status="" ;;
*) exit 1 ;;
esac
capacity="$(cat "$battery/capacity" 2>&1)"
# Will make a warn variable if discharging and low
[ "$status" = "" ] && [ "$capacity" -le 25 ] && warn=""
# Prints the info
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
# If non-first battery, print a space separator.
[ -n "${capacity+x}" ] && printf " "
# Sets up the status and capacity
case "$(cat "$battery/status" 2>&1)" in
"Full") status="" ;;
"Discharging") status="" ;;
"Charging") status="" ;;
"Not charging") status="" ;;
"Unknown") status="" ;;
*) exit 1 ;;
esac
capacity="$(cat "$battery/capacity" 2>&1)"
# Will make a warn variable if discharging and low
[ "$status" = "" ] && [ "$capacity" -le 25 ] && warn=""
# Prints the info
printf "%s%s%d%%" "$status" "$warn" "$capacity"; unset warn
done && printf "\\n"

View File

@ -3,19 +3,19 @@
clock=$(date '+%I')
case "$clock" in
"00") icon="" ;;
"01") icon="" ;;
"02") icon="" ;;
"03") icon="" ;;
"04") icon="" ;;
"05") icon="" ;;
"06") icon="" ;;
"07") icon="" ;;
"08") icon="" ;;
"09") icon="" ;;
"10") icon="" ;;
"11") icon="" ;;
"12") icon="" ;;
"00") icon="" ;;
"01") icon="" ;;
"02") icon="" ;;
"03") icon="" ;;
"04") icon="" ;;
"05") icon="" ;;
"06") icon="" ;;
"07") icon="" ;;
"08") icon="" ;;
"09") icon="" ;;
"10") icon="" ;;
"11") icon="" ;;
"12") icon="" ;;
esac
case $BLOCK_BUTTON in

View File

@ -9,4 +9,4 @@ case $BLOCK_BUTTON in
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
sensors | awk '/Core 0/ {print "" $3}'
sensors | awk '/Core 0/ {print "" $3}'

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Displays todays precipication chance () and daily low () and high ().
# Displays todays precipication chance () and daily low () and high ().
# Usually intended for the statusbar.
# If we have internet, get a weather report from wttr.in and store it locally.
@ -13,23 +13,23 @@ getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
# precipitation chance and the daily high and low from the downloaded file and
# display them with coresponding emojis.
showweather() { printf "%s" "$(sed '16q;d' "$weatherreport" |
grep -wo "[0-9]*%" | sort -rn | sed "s/^//g;1q" | tr -d '\n')"
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 "°","" $2 "°"}' ;}
grep -wo "[0-9]*%" | sort -rn | sed "s/^//g;1q" | tr -d '\n')"
sed '13q;d' "$weatherreport" | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' | sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' | awk '{print " " $1 "°","" $2 "°"}' ;}
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
2) getforecast && showweather ;;
3) notify-send " Weather module" "\- Left click for full forecast.
1) setsid -f "$TERMINAL" -e less -Srf "$weatherreport" ;;
2) getforecast && showweather ;;
3) notify-send " Weather module" "\- Left click for full forecast.
- Middle click to update forecast.
: Chance of rain/snow
: Daily low
: Daily high" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
: Chance of rain/snow
: Daily low
: Daily high" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
# The test if our forcecast is updated to the day. If it isn't download a new
# weather report from wttr.in with the above function.
[ "$(stat -c %y "$weatherreport" 2>/dev/null | cut -d' ' -f1)" = "$(date '+%Y-%m-%d')" ] ||
getforecast
getforecast
showweather

View File

@ -1,12 +1,8 @@
#!/bin/sh
# Show wifi 📶 and percent strength or 📡 if none.
# Show 🌐 if connected to ethernet or ❎ if none.
# Show 🔒 if a vpn connection is active
case $BLOCK_BUTTON in
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
3) notify-send " Internet module" "\- Click to connect
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
3) notify-send " Internet module" "\- Click to connect
: wifi disabled
: no wifi connection
: wifi connection with quality
@ -14,13 +10,13 @@ case $BLOCK_BUTTON in
: ethernet working
: vpn is active
" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then
wifiicon="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
wifiicon="$(awk '/^\s*w/ { print "", int($3 * 100 / 70) "% " }' /proc/net/wireless)"
elif grep -xq 'down' /sys/class/net/w*/operstate 2>/dev/null ; then
grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon="📡 " || wifiicon="❌ "
grep -xq '0x1003' /sys/class/net/w*/flags && wifiicon=" " || wifiicon=" "
fi
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down//;s/up//" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*/🔒/" /sys/class/net/tun*/operstate 2>/dev/null)"
printf "%s%s%s\n" "$wifiicon" "$(sed "s/down//;s/up//" /sys/class/net/e*/operstate 2>/dev/null)" "$(sed "s/.*//" /sys/class/net/tun*/operstate 2>/dev/null)"

View File

@ -1,12 +1,12 @@
#!/bin/sh
case $BLOCK_BUTTON in
1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send " Memory module" "\- Shows Memory Used/Total.
1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send " Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs.
- Middle click to open htop." ;;
6) "$TERMINAL" "$EDITOR" "$0" ;;
6) "$TERMINAL" "$EDITOR" "$0" ;;
esac
free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'
free --mebi | sed -n '2{p;q}' | awk '{printf (" %2.2fGiB/%2.2fGiB\n", ( $3 / 1024), ($2 / 1024))}'

View File

@ -10,28 +10,28 @@ moonfile="${XDG_DATA_HOME:-$HOME/.local/share}/moonphase"
icon="$(cat "$moonfile")"
case "$icon" in
🌑) name="New" ;;
🌒) name="Waxing Crescent" ;;
🌓) name="First Quarter" ;;
🌔) name="Waxing Gibbous" ;;
🌕) name="Full" ;;
🌖) name="Waning Gibbous" ;;
🌗) name="Last Quarter" ;;
🌘) name="Waning Crescent" ;;
) name="New" ;;
) name="Waxing Crescent" ;;
) name="First Quarter" ;;
) name="Waxing Gibbous" ;;
) name="Full" ;;
) name="Waning Gibbous" ;;
) name="Last Quarter" ;;
) name="Waning Crescent" ;;
*) exit 1 ;;
esac
echo "${icon-?}"
case $BLOCK_BUTTON in
3) notify-send "🌜 Moon phase module" "Displays current moon phase.
- 🌑: New
- 🌒: Waxing Crescent
- 🌓: First Quarter
- 🌔: Waxing Gibbous
- 🌕: Full
- 🌖: Waning Gibbous
- 🌗: Last Quarter
- 🌘: Waning Crescent" ;;
3) notify-send " Moon phase module" "Displays current moon phase.
- : New
- : Waxing Crescent
- : First Quarter
- : Waxing Gibbous
- : Full
- : Waning Gibbous
- : Last Quarter
- : Waning Crescent" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac

View File

@ -5,25 +5,25 @@
# second, gives network traffic per second.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e bmon ;;
3) notify-send " Network traffic module" ": Traffic received
: Traffic transmitted" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
1) setsid -f "$TERMINAL" -e bmon ;;
3) notify-send " Network traffic module" ": Traffic received
: Traffic transmitted" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
update() {
sum=0
for arg; do
read -r i < "$arg"
sum=$(( sum + i ))
done
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache"
printf %d\\n $(( sum - old ))
sum=0
for arg; do
read -r i < "$arg"
sum=$(( sum + i ))
done
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache"
printf %d\\n $(( sum - old ))
}
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_bytes)
printf "%4s %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)
printf "%4s %4sB\\n" $(numfmt --to=iec $rx) $(numfmt --to=iec $tx)

View File

@ -18,12 +18,12 @@
# Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send " Upgrade module" ": number of upgradable packages
1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send " Upgrade module"": number of upgradable packages
- Left click to upgrade packages
- Middle click to show upgradable packages" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
pacman -Qu | grep -Fcv "[ignored]" | sed "s/^//;s/^0$//g"
pacman -Qu | grep -Fcv "[ignored]" | sed "s/^//;s/^0$//g"

View File

@ -1,16 +1,16 @@
#!/bin/sh
# Prints the current volume or 🔇 if muted.
# Prints the current volume or if muted.
case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;;
2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;;
3) notify-send " Volume module" "\- Shows volume , if muted.
1) setsid -f "$TERMINAL" -e pulsemixer ;;
2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;;
3) notify-send " Volume module" "\- Shows volume , if muted.
- Middle click to mute.
- Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac
[ $(pamixer --get-mute) = true ] && echo  && exit
@ -18,13 +18,13 @@ esac
vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then
icon=""
icon=""
elif [ "$vol" -gt "30" ]; then
icon=""
icon=""
elif [ "$vol" -gt "0" ]; then
icon=""
icon=""
else
echo  && exit
echo 婢 && exit
fi
echo "$icon$vol%"