Skip to main content

Script for Polybar that checks connection to the Internet

Project description

Polybar Online

Polybar Online is a script for Polybar that displays an internet connection indicator in a panel with the ability to send a notification when the connection is broken and restored.

Why another one?

I've been looking for a similar module for myself and even found a couple. But they didn't run on my machine... So I decided that it would be faster to write my own than to poke around in someone else's. (and others are not able to send notifications!!!)

Requirements

The script does not use any third-party libraries, but you will need to install some Nerd fonts in order for the icons to be displayed.

It's not necessary if you're going to use your own icons from other fonts, though.

Installing

Clone the repository to a convenient location. For example, in ~/.config/polybar/:

cd ~/.config/polybar/
git clone https://github.com/Leetovskiy/polybar-online 

You can also install Polybar Online from PyPI using pip. In this case, you may want to run the script as a regular console program. To do this, make sure that the directory of installed pip packages is available in the PATH variable.

pip install polybar-online

Configuration

The script takes some arguments from the terminal to control its operation. These are, for example, enabling and disabling Internet connection status change notifications, setting icons, etc.

Use the command polybar-online -h to see the full list of available options.

  -h, --help            show this help message and exit
  -n, --notify, --no-notify
                        send a notification if the internet connection is broken (default: False)
  --online-icon ONLINE_ICON
                        icon that will be displayed when the Internet connection is available (default: 度)
  --offline-icon OFFLINE_ICON
                        icon that will be displayed when there is no Internet connection (default: ﴹ)
  -ci CHECK_INTERVAL, --check-interval CHECK_INTERVAL
                        Interval between checks (in seconds)
  -ri RETRY_INTERVAL, --retry-interval RETRY_INTERVAL
                        Interval between checks when Internet connection is unavailable (in seconds)

Using

You need to put the script path in a special custom/script section of your Polybar configuration file. You also need the tail parameter set to true. And don't forget to add the new module to your panel's module list.

Example:

[bar/mybar]
modules-right = online

[module/online]
type = custom/script
exec = python ~/.config/polybar/polybar-online/polybar_online/main.py --notify -ci 5
tail = true

License

This little project is licensed under the Apache 2.0 license, so you are free to use it according to the terms of the license.

Contribution

If you know how to improve this project or would like to contribute yourself, you are welcome. I'm open to suggestions on Telegram (@leetovskiy) and email (dev.zaitsev@gmail.com), and I'll consider pull requests from you as well.

Roadmap

  • Localization in Russian and other languages
  • Distribution as a binary (using nuitka)
  • AUR package

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

polybar_online-1.0.0.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

polybar_online-1.0.0-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file polybar_online-1.0.0.tar.gz.

File metadata

  • Download URL: polybar_online-1.0.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for polybar_online-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d9b5128f55024979bb2dfa571f0a91850b2ef6c64785e5e6e50c2d86ed980ce4
MD5 3d8c4d2e681a66dc1692ab67d8a7f79d
BLAKE2b-256 dd64f64139c9a6ee757739fc898127146837b0f76f3a8b31471f9fbb9612a721

See more details on using hashes here.

File details

Details for the file polybar_online-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: polybar_online-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.9

File hashes

Hashes for polybar_online-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2ba81579de08b93a5f0f61df09986986545e98a9e37602745ef709f06314c0f9
MD5 3d560115024b66b23c1a9158e9464c60
BLAKE2b-256 aadf36a44c860a49e7bb07db7e93c9823dc5593731a13520e322cf9920b767d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page