dotfiles/files/dwm/dwm-start.sh

40 lines
1.1 KiB
Bash
Raw Normal View History

2023-10-14 22:38:07 +02:00
#!/bin/sh
2023-10-14 22:38:10 +02:00
LITE=${LITE:-no}
2023-10-14 22:38:07 +02:00
xsetroot -solid black
#while loop to update statusbar with some goodies
while true; do
2023-10-14 22:38:08 +02:00
#memfreak to get it in MB
memfree=$(grep MemFree /proc/meminfo | awk '{ print $2 }')
memtotal=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
memfreak=$(((memtotal - memfree) / 1024))
#time
CLK=$(date +'%a %b %d %R:%S %Z')
#volume
VOL=$(amixer get Master | tail -1 | awk '{ print $5 }' | tr -d '[]')
#loadavg
AVG=$(cat /proc/loadavg | cut -d ' ' -f -3)
#network stats in Bytes
NW=$(dstat -n --nocolor 1 1 | tail -1 | awk '{ print $1, $2}')
battper=$(cat /sys/class/power_supply/BAT0/capacity)
#this one is not so good, increases a delay of 1-2s of the updating.
#put it in the xsetrootname plz (tip of the day, do not put | as first char after "
xsetroot -name "$AVG | $memfreak MB | Bat: $battper% | Vol: $VOL | $CLK | "
sleep 1
2023-10-14 22:38:07 +02:00
done &
2023-10-14 22:38:07 +02:00
feh -z -Z --bg-scale $HOME/Pictures/background.*
2023-10-14 22:38:07 +02:00
2023-10-14 22:38:08 +02:00
start_apps() {
2023-10-14 22:38:10 +02:00
nm-applet &
flameshot &
2023-10-14 22:38:08 +02:00
discord &
firefox &
}
2023-10-14 22:38:10 +02:00
[ "$LITE" = "yes" ] || (sleep 1 && start_apps) &
2023-10-14 22:38:08 +02:00
2023-10-14 22:38:10 +02:00
[ "${NO_DWM:-no}" = "yes" ] || exec dwm >/dev/null