Added status bar script
This commit is contained in:
parent
806c440f89
commit
13195834e7
|
@ -0,0 +1,35 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Sets xsetroot name
|
||||||
|
# Copy to any location (e.g. ~/.config/dwm), modify as needed, and set this script to run
|
||||||
|
# in .xinitrc. Note make sure it is nonblocking (add & to end) or this will freeze the
|
||||||
|
# system
|
||||||
|
|
||||||
|
print_date(){
|
||||||
|
echo $(date "+%a, %b %d %R")
|
||||||
|
}
|
||||||
|
|
||||||
|
print_mem(){
|
||||||
|
available=$(cat /proc/meminfo | grep MemAvailable | awk '{print $2}')
|
||||||
|
echo "$((available/1024))M"
|
||||||
|
}
|
||||||
|
|
||||||
|
print_ip(){
|
||||||
|
# Print normal ip
|
||||||
|
normal_ip="$(ip addr show | grep enp4s0 | grep inet | awk '{print $2}' | awk -F/ '{print $1}')"
|
||||||
|
|
||||||
|
# If I'm connected to a vpn, print vpn ip
|
||||||
|
vpn_ip="$(ip addr show | grep tun0 | grep inet | awk '{print $2}' | awk -F/ '{print $1}')"
|
||||||
|
if [ -z $vpn_ip ];
|
||||||
|
then
|
||||||
|
echo "$normal_ip"
|
||||||
|
else
|
||||||
|
echo "$normal_ip | $vpn_ip"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
xsetroot -name "$(print_ip) | $(print_mem) | $(print_date)"
|
||||||
|
sleep 1
|
||||||
|
done
|
Loading…
Reference in New Issue