Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # .xinitrc
- ############
- while true; do
- xsetroot -name "$(~/scripts/dwm-wifistat.sh) $(~/scripts/dwm-batstat.sh) $(date +"%e %b %Y %k:%M ")"
- sleep 5s
- done &
- # dwm-batstat.sh
- ##################
- #!/bin/sh
- bat_percent=$(upower -d | grep -Pom 1 '(?<=percentage: )\d+')
- bat_charging=$(upower -d | grep -Pom 1 'state:\s+charging')
- if [ $bat_percent -gt 90 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 80 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 70 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 60 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 50 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 40 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 30 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 20 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- elif [ $bat_percent -gt 10 ]; then
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- else
- if [ -z $bat_charging ]; then
- echo
- else
- echo
- fi
- fi
- # dwm-wifistat.sh
- ###################
- #!/bin/bash
- wifi_signal=$(nmcli device wifi list | grep '^*' | awk -F'[ ][ ]+' '{print $7}')
- if [ -z $wifi_signal ]; then
- echo
- elif [ $wifi_signal -gt 80 ]; then
- echo
- elif [ $wifi_signal -gt 60 ]; then
- echo
- elif [ $wifi_signal -gt 30 ]; then
- echo
- else
- echo
- fi
Advertisement
Add Comment
Please, Sign In to add comment