Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- w_date(){
- w_date="$(date +" %B %d %H:%M")"
- echo -e "$w_date"
- }
- w_bat(){
- bat_cap="$(cat /sys/class/power_supply/BAT0/capacity)"
- bat_stat="$(cat /sys/class/power_supply/BAT0/status)"
- if [[ "$bat_stat" == "Charging" ]]
- then
- echo -e " $bat_cap%"
- elif [[ "$bat_cap" == "100" ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 90 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 80 ]] && [[ $bat_cap < 91 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 70 ]] && [[ $bat_cap < 81 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 60 ]] && [[ $bat_cap < 71 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 50 ]] && [[ $bat_cap < 61 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 40 ]] && [[ $bat_cap < 51 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 30 ]] && [[ $bat_cap < 41 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 20 ]] && [[ $bat_cap < 31 ]]
- then
- echo -e " $bat_cap%"
- elif [[ $bat_cap > 10 ]] && [[ $bat_cap < 21 ]]
- then
- echo -e " $bat_cap%"
- else
- echo -e " $bat_cap%"
- fi
- }
- w_vol(){
- vol="$(pamixer --get-volume-human)"
- if [[ "$vol" == "muted" ]]
- then
- echo " off"
- else
- vol_s="$(echo $vol | sed 's/.$//')"
- if [[ $vol_s > 50 ]] || [[ "$vol_s" == "100" ]]
- then
- echo " $vol"
- else
- echo " $vol"
- fi
- fi
- }
- set_name(){
- xsetroot -name "$(w_date) | $(w_bat) | $(w_vol) |"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement