hlwm: add df to statusbar
This commit is contained in:
parent
5fda4d6ab4
commit
1cc17efec2
2 changed files with 26 additions and 5 deletions
|
@ -44,6 +44,17 @@ do
|
|||
done
|
||||
) &
|
||||
|
||||
root_dev="$(stat --printf %Hd,%Ld /)"
|
||||
home_dev="$(stat --printf %Hd,%Ld "$HOME")"
|
||||
check_df() {
|
||||
df=""
|
||||
df="/:$(df --output=pcent / | tail -n+2 | xargs)"
|
||||
|
||||
[[ "$root_dev" = "$home_dev" ]] || df+="\t$USER:$(df --output pcent "$HOME" | tail -n+2 | xargs)"
|
||||
|
||||
update df "$df"
|
||||
}
|
||||
|
||||
while :
|
||||
do
|
||||
# shellcheck source=/sys/class/power_supply/BAT0/uevent # most likely
|
||||
|
@ -68,6 +79,7 @@ do
|
|||
|
||||
which iwctl &>/dev/null && update wifi "$(iwctl station wlan0 show |grep 'Connected network' | sed 's/ */ /g' | cut -d ' ' -f 4-)"
|
||||
|
||||
check_df
|
||||
#if [ -e /run/user/1000/cmus-socket ]
|
||||
#then
|
||||
#update player "$(printf '%s\t%s \t%s' "$(playerctl metadata artist | tr -d "'" )" "$(playerctl metadata xesam:comment)" "$(playerctl metadata title)")"
|
||||
|
|
|
@ -117,7 +117,7 @@ hc --idle | {
|
|||
### center
|
||||
#echo -n "%{c}%{U${colors[bright_orange]}}${windowtitle:0:150}%{U-}"
|
||||
### print the right
|
||||
res+="%{r}$playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
res+="%{r}$df $separator $playing $separator $volume $separator $wifi $separator $network $separator $temperature $separator $load $separator $date $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
#echo -en "%{r}$right $separator %{U#f2f229}$charge%{U-} $separator"
|
||||
done
|
||||
|
||||
|
@ -194,16 +194,16 @@ hc --idle | {
|
|||
charging)
|
||||
batt_sym="%{F#00aa00}$batt_sym%{F-}"
|
||||
ac="+"
|
||||
notify "Power" "Battery charging"
|
||||
notify "Power" "Battery charging"
|
||||
;;
|
||||
discharging)
|
||||
ac="-"
|
||||
batt_sym="%{F#ffdb00}$batt_sym%{F-}"
|
||||
notify "Power" "Battery discharging"
|
||||
notify "Power" "Battery discharging"
|
||||
;;
|
||||
idle)
|
||||
ac="="
|
||||
notify "Power" "Fully charged"
|
||||
notify "Power" "Fully charged"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
|
@ -230,7 +230,16 @@ hc --idle | {
|
|||
|
||||
charge="$batt_sym ${batt_perc}%%"
|
||||
|
||||
[ "$batt_perc" -le 15 ] && [ "$ac" != '+' ] && notify -u critical "Power" "Battery has only ${batt_perc}%"
|
||||
[ "$batt_perc" -le 15 ] && [ "$ac" != '+' ] && notify -u critical "Power" "Battery has only ${batt_perc}%"
|
||||
;;
|
||||
df)
|
||||
df=""
|
||||
for f in "${cmd[@]:1}"
|
||||
do
|
||||
IFS=: read -r name perc <<<"$f"
|
||||
[[ "${perc%%%}" -lt 80 ]] && continue
|
||||
df+=" $name $perc"
|
||||
done
|
||||
;;
|
||||
temperature)
|
||||
temperature=" ${cmd[1]}°C"
|
||||
|
|
Loading…
Add table
Reference in a new issue