summaryrefslogtreecommitdiff
path: root/dist/bar.sh
blob: d1cd835f162b197e53a1e91f6188d5a0ec198a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env bash
wifi() {
  iwgetid -r
}

battery() {
  c=$(cat /sys/class/power_supply/BAT1/capacity)

  if [[ $c > 85 ]]; then
    echo "  $c"
  elif [[ $c > 70 ]]; then
    echo "  $c"
  elif [[ $c > 50 ]]; then
    echo "  $c"
  elif [[ $c > 30 ]]; then
    echo "  $c"
  else
    echo "  $c"
  fi
}

charging() {
  if [[ "$(cat /sys/class/power_supply/BAT1/status)" == "Charging" ]]; then
    echo "+"
  fi
}

calendar() {
  date +'%a, %d %b %Y |   %H:%M'
}

volume() {
  pamixer --get-volume
}

while [[ true ]]; do
  dwlb -status all "| ^lm(alacritty -e nmtui-connect)  $(wifi)^lm() |   $(volume)% | $(battery)%$(charging) |   $(calendar) | λ |"
  sleep 1
done

# echo "|   $(wifi) |   $(volume)% | $(battery)%$(charging) |   $(calendar) | λ |"