bsnotifier


Namebsnotifier JSON
Version 1.0.2 PyPI version JSON
download
home_pagehttps://github.com/eccanto/battery-status-notifier
SummaryCommand line application that shows a popup window when the battery is low
upload_time2023-01-08 20:11:55
maintainer
docs_urlNone
authorErik Ccanto
requires_python>=3.7.15, <4
licenseMIT
keywords battery notifier gui popup
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)


# 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](https://i3wm.org/) environments.

![Notifier Popup Window](documentation/images/popup-window.png)

# Table of contents

* [Get started](#get-started)
  * [Installation](#installation)
  * [Usage](#usage)
  * [How to use it with i3](#how-to-use-it-with-i3)
  * [Options](#options)
* [Developers](#developers)
  * [Testing release with Tox](#testing-release-with-Tox)
    * [Requirements](#requirements)
    * [Set Python versions](#set-python-versions)
    * [Run](#run)
  * [Static code analysis tools](#static-code-analysis-tools)
    * [Set up the Git hooks custom directory](#set-up-the-git-hooks-custom-directory)
    * [Python Static Checkers](#python-static-checkers)
    * [Shell Static Checkers](#shell-static-checkers)
    * [Run using Tox - recommended](#run-using-tox---recommended)
    * [Run manually](#run-manually)
* [License](#license)
* [Changelog](#changelog)

# Get started

## Installation

This application can be simply installed by running:

```bash
pip install bsnotifier
```

if you want to install from a source distribution:

```bash
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:

```bash
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 notifier application in i3:

1. Linking the application executable to make it accessible to other users.

    ```bash
    BSNOTIFIER_PATH="$(which bsnotifier)"
    sudo ln -s "${BSNOTIFIER_PATH}" /usr/bin/bsnotifier
    ```

2. Edit i3 config file.

    ```bash
    # ~/.config/i3/config
    ...
    exec --no-startup-id bsnotifier -o "$(mktemp)"
    ...
    ```

## Options

```bash
$ 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:

```bash
pip3 install -r requirements_testing.txt
```

### Set Python versions

1. Install [pyenv](https://github.com/pyenv/pyenv)
2. Install python versions:
    ```bash
    for python_version in "3.7" "3.8" "3.9" "3.10" "3.11" ; do pyenv install ${python_version}; done
    ```
3. Enable python versions:
    ```bash
    pyenv local "3.7" "3.8" "3.9" "3.10" "3.11"
    ```

### Run

We use [tox](https://tox.wiki/en/latest/) and [pytest](https://docs.pytest.org/en/6.2.x) to run the
test suite:

```bash
tox
```

to run the test suite for a particular Python version, you can do:


```bash
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:

```bash
git config core.hooksPath .githooks
```

### Python Static Checkers

Tools used:
- [brunette](https://github.com/odwyersoftware/brunette): A best practice Python code formatter.
- [isort](https://pycqa.github.io/isort/): Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.
- [prospector](https://github.com/PyCQA/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](https://github.com/PyCQA/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](https://github.com/PyCQA/bandit): Bandit is a tool designed to find common security issues.
  - [dodgy](https://github.com/landscapeio/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](https://github.com/PyCQA/mccabe): Complexity checker.
  - [mypy](https://github.com/python/mypy): Mypy is an optional static type checker for Python.
  - [pydocstyle](https://github.com/PyCQA/pydocstyle): pydocstyle is a static analysis tool for checking compliance with Python [PEP 257](https://peps.python.org/pep-0257/).
  - [pycodestyle](https://pycodestyle.pycqa.org/en/latest/): pycodestyle is a tool to check your Python code against some of the style conventions in [PEP 8](https://peps.python.org/pep-0008/).
  - [pyflakes](https://github.com/PyCQA/pyflakes): Pyflakes analyzes programs and detects various errors.
  - [pyroma](https://github.com/regebro/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](https://www.shellcheck.net/): Finds bugs in your shell scripts (bash).

  Installation:

  ```bash
  apt install shellcheck
  ```

### Run using Tox - recommended

```bash
tox -e code_checkers
```

### Run manually

```bash
bash scripts/code_checkers.sh
```

# License

[MIT](./LICENSE)

# Changelog

- 1.0.0 - Initial version.
- 1.0.1 - I3 support.
- 1.0.2 - Close the popup window when connecting the battery, and update the information in real time.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eccanto/battery-status-notifier",
    "name": "bsnotifier",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7.15, <4",
    "maintainer_email": "",
    "keywords": "battery,notifier,gui,popup",
    "author": "Erik Ccanto",
    "author_email": "ccanto.erik@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/bd/70/768ccf47671c9a61b03a11dd96cb85ed9845936bcd802e23cf88c01b0eb7/bsnotifier-1.0.2.tar.gz",
    "platform": null,
    "description": "[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)\n\n\n# Battery Status Notifier (bsnotifier)\n\nCommand line application that shows a popup window when the battery is low. This Python script can be used to notify\nbattery status in [i3wm](https://i3wm.org/) environments.\n\n![Notifier Popup Window](documentation/images/popup-window.png)\n\n# Table of contents\n\n* [Get started](#get-started)\n  * [Installation](#installation)\n  * [Usage](#usage)\n  * [How to use it with i3](#how-to-use-it-with-i3)\n  * [Options](#options)\n* [Developers](#developers)\n  * [Testing release with Tox](#testing-release-with-Tox)\n    * [Requirements](#requirements)\n    * [Set Python versions](#set-python-versions)\n    * [Run](#run)\n  * [Static code analysis tools](#static-code-analysis-tools)\n    * [Set up the Git hooks custom directory](#set-up-the-git-hooks-custom-directory)\n    * [Python Static Checkers](#python-static-checkers)\n    * [Shell Static Checkers](#shell-static-checkers)\n    * [Run using Tox - recommended](#run-using-tox---recommended)\n    * [Run manually](#run-manually)\n* [License](#license)\n* [Changelog](#changelog)\n\n# Get started\n\n## Installation\n\nThis application can be simply installed by running:\n\n```bash\npip install bsnotifier\n```\n\nif you want to install from a source distribution:\n\n```bash\ngit clone https://github.com/eccanto/battery-status-notifier\ncd battery-status-notifier/\npython setup.py install\n```\n\n## Usage\n\nTo start the notifier you must run the command line application:\n\n```bash\nbsnotifier\n```\n\nBy default the application will check the battery status every `1:30 minutes`, if the battery percentage is less than\n`10%` a popup window will be shown.\n\n## How to use it with i3\n\nAuto start the notifier application in i3:\n\n1. Linking the application executable to make it accessible to other users.\n\n    ```bash\n    BSNOTIFIER_PATH=\"$(which bsnotifier)\"\n    sudo ln -s \"${BSNOTIFIER_PATH}\" /usr/bin/bsnotifier\n    ```\n\n2. Edit i3 config file.\n\n    ```bash\n    # ~/.config/i3/config\n    ...\n    exec --no-startup-id bsnotifier -o \"$(mktemp)\"\n    ...\n    ```\n\n## Options\n\n```bash\n$ bsnotifier --help\n\nUsage: bsnotifier [OPTIONS]\n\n  Command line application that shows a popup window when the battery is low.\n\nOptions:\n  -i, --interval INTEGER  The time interval in seconds that the script waits\n                          before checking the battery again (default: 150.0\n                          seconds).\n  -l, --level INTEGER     The battery percentage at which the popup window is\n                          displayed (default: 10).\n  -s, --silent            Do not play the sound when popup window is\n                          displayed.\n  -o, --output PATH       Log file path (default: .bsnotifier.log).\n  --help                  Show this message and exit.\n```\n\n# Developers\n\n## Testing release with Tox\n\n### Requirements\n\nPython requirements:\n\n```bash\npip3 install -r requirements_testing.txt\n```\n\n### Set Python versions\n\n1. Install [pyenv](https://github.com/pyenv/pyenv)\n2. Install python versions:\n    ```bash\n    for python_version in \"3.7\" \"3.8\" \"3.9\" \"3.10\" \"3.11\" ; do pyenv install ${python_version}; done\n    ```\n3. Enable python versions:\n    ```bash\n    pyenv local \"3.7\" \"3.8\" \"3.9\" \"3.10\" \"3.11\"\n    ```\n\n### Run\n\nWe use [tox](https://tox.wiki/en/latest/) and [pytest](https://docs.pytest.org/en/6.2.x) to run the\ntest suite:\n\n```bash\ntox\n```\n\nto run the test suite for a particular Python version, you can do:\n\n\n```bash\ntox -e py37\n```\n\n## Static code analysis tools\n\nThese 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).\n\n### Set up the Git hooks custom directory\n\nAfter cloning the repository run the following command in the repository root:\n\n```bash\ngit config core.hooksPath .githooks\n```\n\n### Python Static Checkers\n\nTools used:\n- [brunette](https://github.com/odwyersoftware/brunette): A best practice Python code formatter.\n- [isort](https://pycqa.github.io/isort/): Python utility / library to sort imports alphabetically, and automatically separated into sections and by type.\n- [prospector](https://github.com/PyCQA/prospector): Prospector is a tool to analyse Python code and output information about errors, potential problems, convention violations and complexity.\n\n  Tools executed by Prospector:\n  - [pylint](https://github.com/PyCQA/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.\n  - [bandit](https://github.com/PyCQA/bandit): Bandit is a tool designed to find common security issues.\n  - [dodgy](https://github.com/landscapeio/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.\n  - [mccabe](https://github.com/PyCQA/mccabe): Complexity checker.\n  - [mypy](https://github.com/python/mypy): Mypy is an optional static type checker for Python.\n  - [pydocstyle](https://github.com/PyCQA/pydocstyle): pydocstyle is a static analysis tool for checking compliance with Python [PEP 257](https://peps.python.org/pep-0257/).\n  - [pycodestyle](https://pycodestyle.pycqa.org/en/latest/): pycodestyle is a tool to check your Python code against some of the style conventions in [PEP 8](https://peps.python.org/pep-0008/).\n  - [pyflakes](https://github.com/PyCQA/pyflakes): Pyflakes analyzes programs and detects various errors.\n  - [pyroma](https://github.com/regebro/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.\n\n### Shell Static Checkers\n\nTools used:\n- [shellcheck](https://www.shellcheck.net/): Finds bugs in your shell scripts (bash).\n\n  Installation:\n\n  ```bash\n  apt install shellcheck\n  ```\n\n### Run using Tox - recommended\n\n```bash\ntox -e code_checkers\n```\n\n### Run manually\n\n```bash\nbash scripts/code_checkers.sh\n```\n\n# License\n\n[MIT](./LICENSE)\n\n# Changelog\n\n- 1.0.0 - Initial version.\n- 1.0.1 - I3 support.\n- 1.0.2 - Close the popup window when connecting the battery, and update the information in real time.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Command line application that shows a popup window when the battery is low",
    "version": "1.0.2",
    "split_keywords": [
        "battery",
        "notifier",
        "gui",
        "popup"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "433226a84941d62937e920bf7a119253a7d821e0fbc8e1865dd54c2644784b24",
                "md5": "65a2d389cf1ef1d596bf11980fe22ad7",
                "sha256": "8611f5236a1f503f5270984f8434b9322e6a4912d8a70211ec92caf424badfcf"
            },
            "downloads": -1,
            "filename": "bsnotifier-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "65a2d389cf1ef1d596bf11980fe22ad7",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7.15, <4",
            "size": 125039,
            "upload_time": "2023-01-08T20:11:53",
            "upload_time_iso_8601": "2023-01-08T20:11:53.091003Z",
            "url": "https://files.pythonhosted.org/packages/43/32/26a84941d62937e920bf7a119253a7d821e0fbc8e1865dd54c2644784b24/bsnotifier-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bd70768ccf47671c9a61b03a11dd96cb85ed9845936bcd802e23cf88c01b0eb7",
                "md5": "161ac61e581d57e9ebe2af4d57af9c56",
                "sha256": "bb91da98423e5106d1c85cfb1b0af093e4e62ca817274f2940ad98a0f47e72b9"
            },
            "downloads": -1,
            "filename": "bsnotifier-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "161ac61e581d57e9ebe2af4d57af9c56",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7.15, <4",
            "size": 128530,
            "upload_time": "2023-01-08T20:11:55",
            "upload_time_iso_8601": "2023-01-08T20:11:55.194572Z",
            "url": "https://files.pythonhosted.org/packages/bd/70/768ccf47671c9a61b03a11dd96cb85ed9845936bcd802e23cf88c01b0eb7/bsnotifier-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-08 20:11:55",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "eccanto",
    "github_project": "battery-status-notifier",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "bsnotifier"
}
        
Elapsed time: 0.03510s