diff --git a/blocks.def.h b/blocks.def.h index 30521a1..993b7b8 100644 --- a/blocks.def.h +++ b/blocks.def.h @@ -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 }, diff --git a/dwmblocks_scripts/dwm_battery b/dwmblocks_scripts/dwm_battery index c931b45..9e44acc 100755 --- a/dwmblocks_scripts/dwm_battery +++ b/dwmblocks_scripts/dwm_battery @@ -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 diff --git a/dwmblocks_scripts/dwm_battery.old b/dwmblocks_scripts/dwm_battery.old new file mode 100755 index 0000000..c931b45 --- /dev/null +++ b/dwmblocks_scripts/dwm_battery.old @@ -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 diff --git a/dwmblocks_scripts/dwm_ipaddr b/dwmblocks_scripts/dwm_ipaddr index 6b4aba3..c720355 100755 --- a/dwmblocks_scripts/dwm_ipaddr +++ b/dwmblocks_scripts/dwm_ipaddr @@ -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 diff --git a/dwmblocks_scripts/dwm_ssid b/dwmblocks_scripts/dwm_ssid new file mode 100755 index 0000000..b24e746 --- /dev/null +++ b/dwmblocks_scripts/dwm_ssid @@ -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 "" +