about summary refs log tree commit diff
path: root/modules/workstation/windowing/sway/status_command.in
blob: 58a77bcdfa6d6bb850ad28784a6fe8c643396813 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! @execline@/bin/execlineb

loopwhilex {
  foreground {
    backtick -i -n status { cat /sys/class/power_supply/BAT0/status }
    importas -i -u status status

    ifelse { test $status = Charging }
    { printf "↑" }

    printf "↓"
  }

  foreground {
    redirfd -r 0 /sys/class/power_supply/BAT0/capacity
    tr -d "\n"
  }

  foreground { printf "%%  " }

  foreground { date "+%Y-%m-%d %H:%M:%S" }

  sleep 1
}