Removed individual dwmscripts and moved to single file to get rid of dwmblocks

This commit is contained in:
_N0x 2021-10-11 22:19:15 +02:00
parent e6c5c43300
commit 55ea37de07
10 changed files with 77 additions and 63 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
# Start dwmblocks as statusbar
dwmblocks &
# Start statusbar script
statusbar &
# Start dunst as notificationserver
dunst &

View File

@ -1,7 +0,0 @@
#!/bin/bash
icon=""
#battery="$(acpi | awk -F '[, :]' '{ print $6 " ~" $8":"$9 }')" # with time remaning
battery="$(acpi | awk -F '[, :]' '{ print $6 }')" # without time
printf " %s %s \\n" "$icon" "$battery"

View File

@ -1,11 +0,0 @@
#!/bin/bash
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
icon=""
printf " %s %s \\n" "$icon" "$cpu%"

View File

@ -1,8 +0,0 @@
#!/bin/bash
icon=""
hdd1="$(df / | awk '/^\// { print $5 }')"
hdd2="$(df /home | awk '/^\// { print $5 }')"
printf " %s / %s | %s /home %s \\n" "$icon" "$hdd1" "$icon" "$hdd2"

View File

@ -1,7 +0,0 @@
#!/bin/bash
icon=""
mem="$(free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g)"
printf " %s %s \\n" "$icon" "$mem"

View File

@ -1,18 +0,0 @@
#!/bin/bash
icon="龍"
iface="enp4s0"
up=""
down=""
R1="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T1="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
sleep 1
R2="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T2="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
TBPS="$(expr $T2 - $T1)"
RBPS="$(expr $R2 - $R1)"
TKBPS="$(expr $TBPS / 1024)"
RKBPS="$(expr $RBPS / 1024)"
printf " %s %s %skB/s %s %skB/s \\n" "$icon" "$up" "$TKBPS" "$down" "$RKBPS"
#echo "tx $iface: $TKBPS kB/s rx $iface: $RKBPS kB/s"

View File

@ -1,9 +0,0 @@
#!/bin/bash
icon=""
iface="enp4s0"
IPADDR="$(ip a show dev $iface | awk '/inet / { print $2 } ')"
printf " %s %s [%s] \n" "$icon" "$iface" "$IPADDR"
#echo "tx $iface: $TKBPS kB/s rx $iface: $RKBPS kB/s"

75
localbin/.local/bin/statusbar Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
interval=0
datetime() {
icon=""
time="$(date "+%a, %d %b %H:%M")"
printf "^b#408977^^c#eeeeee^ %s ^d^ %s" "$icon" "$time"
}
battery() {
icon=""
battery="$(acpi | awk -F '[, :]' '{ print $6 }')" # without time
printf "^b#408977^^c#eeeeee^ %s ^d^ %s" "$icon" "$battery"
}
cpu() {
icon=""
read cpu a b c previdle rest < /proc/stat
prevtotal=$((a+b+c+previdle))
sleep 0.5
read cpu a b c idle rest < /proc/stat
total=$((a+b+c+idle))
cpu=$((100*( (total-prevtotal) - (idle-previdle) ) / (total-prevtotal) ))
printf "^b#408977^^c#eeeeee^ %s ^d^ %s" "$icon" "$cpu%"
}
memory() {
icon=""
mem="$(free -h | awk '/^Mem/ { print $3"/"$2 }' | sed s/i//g)"
printf "^b#408977^^c#eeeeee^ %s ^d^ %s" "$icon" "$mem"
}
disk() {
icon=""
root="$(df / | awk '/^\// { print $5 }')"
home="$(df /home | awk '/^\// { print $5 }')"
printf "^b#408977^^c#eeeeee^ %s ^d^ / %s | /home %s" "$icon" "$root" "$home"
}
networkspeed() {
icon="龍"
iface="enp4s0"
up=""
down=""
R1="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T1="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
sleep 1
R2="$(cat /sys/class/net/$iface/statistics/rx_bytes)"
T2="$(cat /sys/class/net/$iface/statistics/tx_bytes)"
TBPS="$(expr $T2 - $T1)"
RBPS="$(expr $R2 - $R1)"
TKBPS="$(expr $TBPS / 1024)"
RKBPS="$(expr $RBPS / 1024)"
printf "^b#408977^^c#eeeeee^ %s ^d^ %s %skB/s %s %skB/s" "$icon" "$up" "$TKBPS" "$down" "$RKBPS"
}
networkinfo() {
icon=""
iface="enp4s0"
IPADDR="$(ip a show dev $iface | awk '/inet / { print $2 } ')"
printf "^b#408977^^c#eeeeee^ %s ^d^ %s [%s]" "$icon" "$iface" "$IPADDR"
}
song() {
icon=""
song=$(playerctl --player=spotify,mpd metadata title)
artist=$(playerctl --player=spotify,mpd metadata artist)
printf "^b#408977^^c#eeeeee^ %s ^d^ %s - %s" "$icon" "$artist" "$song"
}
while true; do
xsetroot -name " $(cpu) $(memory) $(networkspeed) $(networkinfo) $(disk) $(song) $(datetime)"
sleep 5
done

View File

@ -2,7 +2,6 @@
if [[ $UID -ge 1000 && -d $HOME/.local/bin && -z $(echo $PATH | grep -o $HOME/.local/bin) ]]
then
export PATH="$HOME/.local/bin:${PATH}"
export PATH="$HOME/.local/bin/dwmscript:${PATH}"
fi
# start x -> starts dwm within .xinitrc