All Projects → imwally → Battstat

imwally / Battstat

Licence: isc
🔋 CLI battery status indicator for macOS, Linux, and OpenBSD ⚡

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Battstat

Vpn At Home
1-click, self-hosted deployment of OpenVPN with DNS ad blocking sinkhole
Stars: ✭ 1,106 (+737.88%)
Mutual labels:  openbsd
Iglance
Free system monitor for OSX and macOS. See all system information at a glance in the menu bar.
Stars: ✭ 1,358 (+928.79%)
Mutual labels:  battery
Fisy Fuzz
This is the full file system fuzzing framework that I presented at the Hack in the Box 2020 Lockdown Edition conference in April.
Stars: ✭ 110 (-16.67%)
Mutual labels:  openbsd
Ruby Vmstat
A focused and fast library to gather memory, cpu, network, load avg and disk information
Stars: ✭ 68 (-48.48%)
Mutual labels:  openbsd
Openbsd Cookbooks
Setup environment in OpenBSD using Ansible playbook
Stars: ✭ 80 (-39.39%)
Mutual labels:  openbsd
Pc Engines Apu Router Guide
Guide to building a Linux or BSD router on the PC Engines APU platform
Stars: ✭ 101 (-23.48%)
Mutual labels:  openbsd
Arcticfox Config
Configuration Tool for Vape Battery Mods with Arcticfox Firmware. ☁️ 🔧 Works on MacOS and Linux.
Stars: ✭ 58 (-56.06%)
Mutual labels:  battery
Signify
OpenBSD tool to signs and verify signatures on files. Portable version.
Stars: ✭ 122 (-7.58%)
Mutual labels:  openbsd
Snap
OpenBSD upgrade tool (OpenBSD,Shell)
Stars: ✭ 92 (-30.3%)
Mutual labels:  openbsd
Libtuntap
The portable Tun/Tap devices configuration utility
Stars: ✭ 107 (-18.94%)
Mutual labels:  openbsd
Zapret
Обход DPI в linux
Stars: ✭ 1,148 (+769.7%)
Mutual labels:  openbsd
Qtfm
Qt File Manager
Stars: ✭ 73 (-44.7%)
Mutual labels:  openbsd
Postinstall
💻 Bash Script to automate post-installation steps
Stars: ✭ 104 (-21.21%)
Mutual labels:  openbsd
Pyeis
PyEIS: A Python-based Electrochemical Impedance Spectroscopy simulator and analyzer
Stars: ✭ 60 (-54.55%)
Mutual labels:  battery
Battery.js
A tiny wrapper for the HTML5 Battery Status API.
Stars: ✭ 111 (-15.91%)
Mutual labels:  battery
Power
Python module that allows you to get power and battery status of the system. Windows, Mac OS X, Linux
Stars: ✭ 58 (-56.06%)
Mutual labels:  battery
Mdnsd
Mdns daemon for OpenBSD.
Stars: ✭ 100 (-24.24%)
Mutual labels:  openbsd
Glaucus
An independent Linux® distribution built from scratch
Stars: ✭ 130 (-1.52%)
Mutual labels:  openbsd
Mg
Micro (GNU) Emacs-like text editor ❤️ public-domain
Stars: ✭ 117 (-11.36%)
Mutual labels:  openbsd
Ttgo T Beam Car Tracker
TTGO-T-Beam Arduino Car Tracker - ESP32 + LoRa + GPS + GSM (optional)
Stars: ✭ 106 (-19.7%)
Mutual labels:  battery

battstat

battstat is a shell script that displays formatted information about the status of your battery.

Information is displayed in the order the format tokens are written. For example, the screenshots below show my tmux status line running the command battstat --percent-when-charged {i} {t} {p}. This will display an icon, the time remaining when charging and discharging, and finally the percentage but only when the battery is fully charged. Format tokens can be written in any order and as many times as you like.

battery charging battery discharging battery full charged

Examples

There are a few ways to customize the output of battstat. Charging and discharging icons can be replaced with single character or multi-character strings. The -c flag sets the charging string and the -d flag sets the discharging string.

$ battstat -d "🍕" {t} {i}
 10:30  🍕

$ battstat {t} {i}
 11:47  🔋

$ battstat -c "AC:" -d "BAT:" {i} {p} {t}
 BAT:  82%  12:11

$ battstat {i} {p}    
 🔋  81%

$ battstat -d "Battery:" {i} {p}
 Battery:  81%

macOS menu bar

bitbar screenshot

Using bitbar you can add the output of battstat to the menu bar on macOS. There are many ways to customize the output so I suggest reading over the writing plugins section to understand what's possible.

The screenshot above is using the following shell script. Make sure the script is executable and placed in the bitbar plugins path.

#!/bin/sh

time=$(/usr/local/bin/battstat {t})

echo "($time) | size=13"

Supported Operating Systems

  • macOS: Details are collected via pmset(1).
  • Linux: Details are collected via upower(1).
  • OpenBSD: Details are collected via apm(8).

Notes

The script does not account for laptops with multiple batteries. Newer ThinkPad models include both a swappable and non-swappable battery which may cause problems when searching for the battery with upower. I currently don't have the means necessary to test against these models but pull requests are of course welcomed.

Install

  1. Grab the script. Here are a few options:

    • Download and extract the zip.
    • $ git clone https://github.com/imwally/battstat
    • $ curl -O https://raw.githubusercontent.com/imwally/battstat/master/battstat
  2. Move it to your favorite binary path and make it executable.

$ mv battstat /usr/local/bin
$ chmod u+x /usr/local/bin/battstat

Usage

usage: battstat [options] format

options:
    -h, --help                display help information
    -c, --charging-icon       string to display in icon's place when battery is charging
    -d, --discharging-icon    string to display in icon's place when battery is discharging
    --percent-when-charged    only display percent when charged

format:
    {i}    display icon
    {t}    display time remaining
    {p}    display percent

    Note: There must be a space between each format token.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].