Command line application that shows a popup window when the battery is low
Project description
Battery Status Notifier (bsnotifier)
Command line application that shows a popup window when the battery is low. This Python script can be used to notify battery status in i3wm environments.
Table of contents
Get started
Installation
This application can be simply installed by running:
pip install bsnotifier
if you want to install from a source distribution:
git clone https://github.com/eccanto/battery-status-notifier
cd battery-status-notifier/
python setup.py install
Usage
To start the notifier you must run the command line application:
bsnotifier
By default the application will check the battery status every 1:30 minutes
, if the battery percentage is less than
10%
a popup window will be shown.
How to use it with i3
Auto start the application in your i3 config file:
# ~/.config/i3/config
...
exec --no-startup-id bsnotifier
...
Options
$ bsnotifier --help
Usage: bsnotifier [OPTIONS]
Command line application that shows a popup window when the battery is low.
Options:
-i, --interval INTEGER The time interval in seconds that the script waits
before checking the battery again (default: 150.0
seconds).
-l, --level INTEGER The battery percentage at which the popup window is
displayed (default: 10).
-s, --silent Do not play the sound when popup window is
displayed.
-o, --output PATH Log file path (default: .bsnotifier.log).
--help Show this message and exit.
Developers
Testing release with Tox
Requirements
Python requirements:
pip3 install -r requirements_testing.txt
Set Python versions
- Install pyenv
- Install python versions:
for python_version in "3.7" "3.8" "3.9" "3.10" "3.11" ; do pyenv install ${python_version}; done
- Enable python versions:
pyenv local "3.7" "3.8" "3.9" "3.10" "3.11"
Run
We use tox and pytest to run the test suite:
tox
to run the test suite for a particular Python version, you can do:
tox -e py37
Static code analysis tools
These are the linters that will help us to follow good practices and style guides of our source code. We will be using the following static analysis tools, which will be executed when generating a new push in the repository (git hooks).
Set up the Git hooks custom directory
After cloning the repository run the following command in the repository root:
git config core.hooksPath .githooks
Python Static Checkers
Tools used:
-
brunette: A best practice Python code formatter.
-
isort: Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.
-
prospector: Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and complexity.
Tools executed by Prospector:
- pylint: Pylint is a Python static code analysis tool which looks for programming errors, helps enforcing a coding standard, sniffs for code smells and offers simple refactoring suggestions.
- bandit: Bandit is a tool designed to find common security issues.
- dodgy: It is a series of simple regular expressions designed to detect things such as accidental SCM diff checkins, or passwords or secret keys hard coded into files.
- mccabe: Complexity checker.
- mypy: Mypy is an optional static type checker for Python.
- pydocstyle: pydocstyle is a static analysis tool for checking compliance with Python PEP 257.
- pycodestyle: pycodestyle is a tool to check your Python code against some of the style conventions in PEP 8.
- pyflakes: Pyflakes analyzes programs and detects various errors.
- pyroma: Pyroma is a product aimed at giving a rating of how well a Python project complies with the best practices of the Python packaging ecosystem, primarily PyPI, pip, Distribute etc, as well as a list of issues that could be improved.
Shell Static Checkers
Tools used:
-
shellcheck: Finds bugs in your shell scripts (bash).
Installation:
apt install shellcheck
Run using Tox - recommended
tox -e code_checkers
Run manually
cd data_collectors
bash scripts/code_checkers.sh
cd -
License
Changelog
- 1.0.0 - Initial version.
- 1.0.1 - I3 support.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file bsnotifier-1.0.1.tar.gz
.
File metadata
- Download URL: bsnotifier-1.0.1.tar.gz
- Upload date:
- Size: 128.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e6443225673e31b3bd62c87b116a813f713f92e204acbb57e2fc7c14969654d |
|
MD5 | 037cb8aea9105a9b57a9d686e61aa93b |
|
BLAKE2b-256 | 3cfd1fc48cc2fdc3130e6a0b8c753059e8ae9cd47bd5d17d83540bb08d4f3c1a |
File details
Details for the file bsnotifier-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: bsnotifier-1.0.1-py3-none-any.whl
- Upload date:
- Size: 124.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90f69df94d9926d3f3e6bd021a840c6dd389f39d3b9d3fe683acd02fae70e586 |
|
MD5 | e6427b536b7ae191fafa3173dbce70ad |
|
BLAKE2b-256 | 29885196e96bbbf127c2283e3ae754a4030f607a30da7c65f7f0ae15a5596ccb |