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
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
Hashes for polybar_online-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba81579de08b93a5f0f61df09986986545e98a9e37602745ef709f06314c0f9 |
|
MD5 | 3d560115024b66b23c1a9158e9464c60 |
|
BLAKE2b-256 | aadf36a44c860a49e7bb07db7e93c9823dc5593731a13520e322cf9920b767d0 |