scripts added

This commit is contained in:
Filip Rojek 2023-02-24 10:48:23 +01:00
parent d15f3ea237
commit a3a8eb13d8
5 changed files with 36 additions and 16 deletions

View File

@ -1,7 +1,8 @@
//Modify this file to change what commands output to your statusbar, and recompile using the make command.
static const Block blocks[] = {
/*Icon*/ /*Command*/ /*Update Interval*/ /*Update Signal*/
{ " NET ", "/opt/dwmblocks_scripts/dwm_ipaddr", 30, 0 },
{ " SSID ", "/opt/dwmblocks_scripts/dwm_ssid", 1, 0 },
{ "NET ", "/opt/dwmblocks_scripts/dwm_ipaddr", 1, 0 },
{ "MEM ", "/opt/dwmblocks_scripts/dwm_memory", 30, 0 },
{ "", "/opt/dwmblocks_scripts/dwm_volume withicon", 1, 10 },
{ "", "/opt/dwmblocks_scripts/dwm_battery withicon", 1, 10 },

View File

@ -1,17 +1,7 @@
#!/bin/bash
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/^.* //')
prct=$(acpi | grep 'Discharging' | awk '{print $4}' | sed 's/,//')
batid=$(acpi | grep 'Discharging' | awk '{print $2}' | sed 's/://')
## if any argument
if [ $# -gt 0 ]; then
if [[ $stat == "charging" ]]; then
echo "BAT $prct +"
exit
fi
echo "BAT $prct -"
exit
fi
echo "BAT$batid $prct -"
echo $prct

View File

@ -0,0 +1,17 @@
#!/bin/bash
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 "BAT $prct +"
exit
fi
echo "BAT $prct -"
exit
fi
echo $prct

View File

@ -1,6 +1,6 @@
#!/bin/bash
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}')"
eth="$(ip -4 addr show eth0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
wlp="$(ip -4 addr show wlan0 | grep -oP '(?<=inet\s)\d+(\.\d+){3}')"
if [[ $(echo $eth | wc -c) -gt 1 ]]
then

12
dwmblocks_scripts/dwm_ssid Executable file
View File

@ -0,0 +1,12 @@
#!/bin/bash
ssid="$(wpa_cli status | grep ssid | sed -n '2p' | awk -F '=' '{print $2}')"
if [[ $(echo $ssid | wc -c) -gt 1 ]]
then
echo "$ssid"
exit;
fi
echo ""