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

View File

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

View File

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

View File

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

View File

@ -1,12 +1,8 @@
#!/bin/sh #!/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 case $BLOCK_BUTTON in
1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;; 1) "$TERMINAL" -e nmtui; pkill -RTMIN+4 dwmblocks ;;
3) notify-send " Internet module" "\- Click to connect 3) notify-send " Internet module" "\- Click to connect
: wifi disabled : wifi disabled
: no wifi connection : no wifi connection
: wifi connection with quality : wifi connection with quality
@ -14,13 +10,13 @@ case $BLOCK_BUTTON in
: ethernet working : ethernet working
: vpn is active : vpn is active
" ;; " ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
if grep -xq 'up' /sys/class/net/w*/operstate 2>/dev/null ; then 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 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 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 #!/bin/sh
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;; 1) notify-send " Memory hogs" "$(ps axch -o cmd:15,%mem --sort=-%mem | head)" ;;
2) setsid -f "$TERMINAL" -e htop ;; 2) setsid -f "$TERMINAL" -e htop ;;
3) notify-send " Memory module" "\- Shows Memory Used/Total. 3) notify-send " Memory module" "\- Shows Memory Used/Total.
- Click to show memory hogs. - Click to show memory hogs.
- Middle click to open htop." ;; - Middle click to open htop." ;;
6) "$TERMINAL" "$EDITOR" "$0" ;; 6) "$TERMINAL" "$EDITOR" "$0" ;;
esac 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")" icon="$(cat "$moonfile")"
case "$icon" in case "$icon" in
🌑) name="New" ;; ) name="New" ;;
🌒) name="Waxing Crescent" ;; ) name="Waxing Crescent" ;;
🌓) name="First Quarter" ;; ) name="First Quarter" ;;
🌔) name="Waxing Gibbous" ;; ) name="Waxing Gibbous" ;;
🌕) name="Full" ;; ) name="Full" ;;
🌖) name="Waning Gibbous" ;; ) name="Waning Gibbous" ;;
🌗) name="Last Quarter" ;; ) name="Last Quarter" ;;
🌘) name="Waning Crescent" ;; ) name="Waning Crescent" ;;
*) exit 1 ;; *) exit 1 ;;
esac esac
echo "${icon-?}" echo "${icon-?}"
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
3) notify-send "🌜 Moon phase module" "Displays current moon phase. 3) notify-send " Moon phase module" "Displays current moon phase.
- 🌑: New - : New
- 🌒: Waxing Crescent - : Waxing Crescent
- 🌓: First Quarter - : First Quarter
- 🌔: Waxing Gibbous - : Waxing Gibbous
- 🌕: Full - : Full
- 🌖: Waning Gibbous - : Waning Gibbous
- 🌗: Last Quarter - : Last Quarter
- 🌘: Waning Crescent" ;; - : Waning Crescent" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac

View File

@ -5,25 +5,25 @@
# second, gives network traffic per second. # second, gives network traffic per second.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e bmon ;; 1) setsid -f "$TERMINAL" -e bmon ;;
3) notify-send " Network traffic module" ": Traffic received 3) notify-send " Network traffic module" ": Traffic received
: Traffic transmitted" ;; : Traffic transmitted" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
update() { update() {
sum=0 sum=0
for arg; do for arg; do
read -r i < "$arg" read -r i < "$arg"
sum=$(( sum + i )) sum=$(( sum + i ))
done done
cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/} cache=${XDG_CACHE_HOME:-$HOME/.cache}/${1##*/}
[ -f "$cache" ] && read -r old < "$cache" || old=0 [ -f "$cache" ] && read -r old < "$cache" || old=0
printf %d\\n "$sum" > "$cache" printf %d\\n "$sum" > "$cache"
printf %d\\n $(( sum - old )) printf %d\\n $(( sum - old ))
} }
rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes) rx=$(update /sys/class/net/[ew]*/statistics/rx_bytes)
tx=$(update /sys/class/net/[ew]*/statistics/tx_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. # Exec = /usr/bin/pkill -RTMIN+8 dwmblocks # Or i3blocks if using i3.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e sb-popupgrade ;; 1) setsid -f "$TERMINAL" -e sb-popupgrade ;;
2) notify-send "$(/usr/bin/pacman -Qu)" ;; 2) notify-send "$(/usr/bin/pacman -Qu)" ;;
3) notify-send " Upgrade module" ": number of upgradable packages 3) notify-send " Upgrade module"": number of upgradable packages
- Left click to upgrade packages - Left click to upgrade packages
- Middle click to show upgradable packages" ;; - Middle click to show upgradable packages" ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac 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 #!/bin/sh
# Prints the current volume or 🔇 if muted. # Prints the current volume or if muted.
case $BLOCK_BUTTON in case $BLOCK_BUTTON in
1) setsid -f "$TERMINAL" -e pulsemixer ;; 1) setsid -f "$TERMINAL" -e pulsemixer ;;
2) pamixer -t ;; 2) pamixer -t ;;
4) pamixer --allow-boost -i 1 ;; 4) pamixer --allow-boost -i 1 ;;
5) pamixer --allow-boost -d 1 ;; 5) pamixer --allow-boost -d 1 ;;
3) notify-send " Volume module" "\- Shows volume , if muted. 3) notify-send " Volume module" "\- Shows volume , if muted.
- Middle click to mute. - Middle click to mute.
- Scroll to change." ;; - Scroll to change." ;;
6) "$TERMINAL" -e "$EDITOR" "$0" ;; 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
esac esac
[ $(pamixer --get-mute) = true ] && echo  && exit [ $(pamixer --get-mute) = true ] && echo  && exit
@ -18,13 +18,13 @@ esac
vol="$(pamixer --get-volume)" vol="$(pamixer --get-volume)"
if [ "$vol" -gt "70" ]; then if [ "$vol" -gt "70" ]; then
icon="" icon=""
elif [ "$vol" -gt "30" ]; then elif [ "$vol" -gt "30" ]; then
icon="" icon=""
elif [ "$vol" -gt "0" ]; then elif [ "$vol" -gt "0" ]; then
icon="" icon=""
else else
echo  && exit echo 婢 && exit
fi fi
echo "$icon$vol%" echo "$icon$vol%"