battery_notifier

command module
v2.1.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2019 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Battery Notifier 🔋

This is a simple application to show current battery status (percentage and charging status). It can also watch the battery continuously and send periodic desktop notifications when the battery goes below a threshold percentage.

Development

Install govendor, sync or get vendor packages and with go build or govendor build make the notifier!

Options 👷

  • -v: show application version.

  • -t: battery percentage threshold, below which the battery will be condiered as low and the user will start getting desktop notifications about low battery.

  • -l: battery check interval during low (< threshold) battery.

  • -n: battery check interval during good/normal (> threshold) battery.

  • -w: continuously watch battery level at preset interval. The interval depends on values of '-n' and '-l'.

  • -p: show the remaining percentage of the battery and exit.

  • -h: get help message and default values of flags/options.

Creating a Systemd Service to keep watching battery even across reboots

  • Copy the executable to /usr/local/bin/

  • Create a systemd service unit file like below:

$ cat /lib/systemd/system/battery-notifier.service 
[Unit]
Description=System Battery Monitor and Notifier
After=multi-user.target

[Service]
User=<normal system username but not root>
ExecStart=/usr/local/bin/battery_notifier -w
Restart=on-failure
RestartSec=30s

[Install]
WantedBy=multi-user.target
  • Save the above file and perform the following to always start the battery-notifier service:
$ sudo systemctl daemon-reload
$ sudo systemctl start battery-notifier
$ sudo systemctl enable battery-notifier

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址