my dwmblocks setup

This commit is contained in:
2022-11-09 20:00:41 +01:00
parent a933ce0d61
commit 1528bb5fc9
6 changed files with 70 additions and 4 deletions

23
dwmblocks_scripts/dwm_battery Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh
prct=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //')
prctonly=$(upower -d | grep percentage | sed -n "1p" | sed -e 's/^.* //' | sed 's/%//')
stat=$(upower -d | grep -m1 state | sed -e 's/^.* //')
## if any argument
if [ $# -gt 0 ]; then
if [[ $stat == "charging" ]]; then
echo " ⚡ $prct"
exit
fi
if [[ $prctonly -gt 30 ]]; then
echo " 🔋 $prct"
exit
fi
echo " 🪫 $prct"
exit
fi
echo $prct

11
dwmblocks_scripts/dwm_ipaddr Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
eth="$(ip -4 addr show enp8s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
wlp="$(ip -4 addr show wlp7s0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
if [[ $(echo $eth | wc -c) -gt 1 ]]
then
echo "$eth"
exit;
fi
echo "$wlp"

5
dwmblocks_scripts/dwm_kernel Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
kern="$(uname -r | sed -re 's/(^[0-9]*\.[0-9]*\.[0-9]*-[0-9]*)(.*)/\1/')"
echo -e "$kern "

5
dwmblocks_scripts/dwm_memory Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
mem="$(free -h | awk '/^Mem:/ {print $3 "/" $2}')"
echo -e "$mem"

19
dwmblocks_scripts/dwm_volume Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
## if any argument
if [ $# -gt 0 ]; then
stat="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)].*/\1/')"
if [[ $(echo $stat) == "on" ]]; then
echo " 🔊 $vol"
exit
fi
echo " 🔇 $vol"
exit
fi
## just returns volume %
vol="$(amixer get Master | tail -n1 | sed -r 's/.*\[(.*)%\].*/\1/')"
echo -e "$vol"