all repos — dotfiles @ 098a241f1a8b08ed0618c161bbd9ae87362c6c95

my *nix dotfiles

bin/bat (view raw)

 1#!/usr/bin/env bash
 2
 3cap="$(apm -l)"
 4is_charging="$(apm -a)"
 5
 6status="discharging"
 7
 8tmux_bat() {
 9    if [[ "$is_charging" -eq 1 ]]; then 
10        printf '%s%%' "+$cap"
11    else
12        printf '%s%%' "$cap"
13    fi
14}
15
16if [[ "$1" == "-q" ]]; then
17   tmux_bat 
18else
19    [[ "$is_charging" -eq 1 ]] &&
20        status="charging"
21    printf '%s%% [%s]\n' $cap $status 
22fi
23