nix/bin/bar.nix (view raw)
1{ pkgs, theme, ... }:
2
3let
4 name = "bar";
5 pamixer = "${pkgs.pamixer}/bin/pamixer";
6 lemonbar = "${pkgs.lemonbar-xft}/bin/lemonbar";
7in
8pkgs.writeShellScriptBin name
9 ''
10 dt() {
11 date +"%a, %d %b" | tr A-Z a-z
12 }
13
14 vol() {
15 ${pamixer} --get-volume
16 }
17
18 pad="%{015}"
19
20 while :; do
21 time="$(date +"%H:%M")"
22 echo "$pad $(dt) $pad $time %{r}bat $(bat) %{O14}vol $(vol)% $pad"
23 sleep 0.5
24 done | ${lemonbar} -n bar -f 'Input:style=Regular:size=12:antialias=true' -g x30 \
25 -F '${theme.base00}' -B '${theme.base07}'
26 ''