You are not logged in.
Hi, just thought i would share something i have been working on, im not the best at scripting so it probably shows! Anyhow this is for anyone running dwm with the extrabar patch. You would need to modify the values to suit your setup such as the /dev/sda3 and network devices. This is the only way i think i could use dwm statusbar and extrabar to its full extent, conky will only output to one statusbar if using xsetroot -name to pipe it there.Its probably overkill and there is possibly a better way maybe putting some of the commands into a longer loop time? Im using startx so i just autostart it from .xinitrc.
https://dwm.suckless.org/patches/extrabar/
#!/usr/bin/env sh
while true; do
date '+| %A :: %B %d :: %R |' > /tmp/CurTime.tmp
sleep 60s
done &
while true; do
LOCALTIME=$(< /tmp/CurTime.tmp)
DISKFREE=$(df -Ph | grep "/dev/sda3" | awk {'print $4'})
DISKUSED=$(df -Ph | grep "/dev/sda3" | awk {'print $3'})
MEM=$(free -h | awk '/^Mem:/ {print $3 "/" $2}')
LINUX=$(uname -r)
NET=$(nmcli dev wifi | grep -E '^[*]' | awk '/*/ {print $8}')
TOTALDOWN=$(ifconfig wlp2s0| grep "RX packets" | awk {'print $6 $7'})
TOTALUP=$(ifconfig wlp2s0| grep "TX packets" | awk {'print $6 $7'})
xsetroot -name "$LOCALTIME ; | Kernel:$LINUX | Disk Free:$DISKFREE | Disk Used:$DISKUSED | Mem:$MEM | Net: $NET TotalUp: $TOTALUP TotalDown: $TOTALDOWN |"
sleep 10s
done &
scrot
Edit: removed the NETDOOWN and NETUP commands, too ugly. Using nmcli one liner just to show connection at the moment, yet to figure out how to properly implement totalup and totaldown how conky does it.
NETDOWN=$(ifconfig wlan0 | grep "RX" | head -n1 | cut -c39-49)
NETUP=$(ifconfig wlan0 | grep "TX" | head -n1 | cut -c38-58)
edited for the tenth time: how good is awk !
Last edited by clusterF (2019-09-28 11:23:58)
Offline
^ thanks for that, termbar looks rather interesting i will definitely look into it
Offline
edited op, found a way to have similar totalup and totaldown as conky does it with the use of better grep and awk commands.
TOTALDOWN=$(ifconfig wlp2s0| grep "RX packets" | awk {'print $6 $7'})
TOTALUP=$(ifconfig wlp2s0| grep "TX packets" | awk {'print $6 $7'})
Offline
here is an updated version for use on my debian/devuan machines.
have to use env bash or else wttr.in for the weather will not work.
#!/usr/bin/env bash
while true; do
date '+| %A :: %B %d :: %R |' > /tmp/CurTime.tmp
sleep 60s
done &
while true; do
LOCALTIME=$(< /tmp/CurTime.tmp)
DISKROOT=$(df -Ph | grep "/dev/sda1" | awk {'print $5'})
DISKHOME=$(df -Ph | grep "/dev/sda2" | awk {'print $5'})
MEM=$(free -h --kilo | awk '/^Mem:/ {print $3 "/" $2}')
LINUX=$(uname -r)
TOTALDOWN=$(sudo ifconfig wlan0 | grep "RX packets" | awk {'print $6 $7'})
TOTALUP=$(sudo ifconfig wlan0 | grep "TX packets" | awk {'print $6 $7'})
CPU=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1"%"}')
WEATHER=$(curl wttr.in/Brisbane?format="%l:+%m+%p+%w+%t+%c+%C")
xsetroot -name " $LOCALTIME;| Kernel: $LINUX | ROOT: $DISKROOT | HOME: $DISKHOME | MEM: $MEM | NET: T/UP: $TOTALUP T/DOWN: $TOTALDOWN | CPU: $CPU | $WEATHER |"
sleep 10s
done &
Offline
@clusterF Thank you for your excellent guidance. I made some mods to suit my needs and have produced the following on my dwm (MXLinux 21b2) setup. Included is a requisite scrot for 'proof-of-life' .
#!/usr/bin/env bash
# original script created by clusterF modified
# by ManyRoads
#
while true; do
date '+ %a. %d %b. %R ' > /tmp/CurTime.tmp
sleep 60s
done &
while true; do
LOCALTIME=$(< /tmp/CurTime.tmp)
DB=$(dropbox status)
VOL=$(pamixer --get-volume-human)
MEM=$(free -h --kilo | awk '/^Mem:/ {print $3 "/" $2}')
CPU=$(top -bn1 | grep "Cpu(s)" | sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | awk '{print 100 - $1}' )
TEMP=$(sensors|grep 'Core 0'|awk '{print $3}' )
DISK=$(df -Ph | grep "/dev/nvme0n1p2" | awk {'print $5'})
WIFI=$(nmcli -f ACTIVE,SIGNAL dev wifi list | awk '$1=="yes" {print $2}')
xsetroot -name " $MEM $CPU% $TEMP $DISK $VOL $WIFI% $DB $LOCALTIME "
sleep 10s
done &
Last edited by manyroads (2021-10-02 13:20:30)
Pax vobiscum,
Mark Rabideau - https://many-roads.com https:/eirenicon.org
i3wm, dwm, hlwm on sid/ arch ~ Reg. Linux User #449130
"For every complex problem there is an answer that is clear, simple, and wrong." H. L. Mencken
Offline