Skip to main content

Bar Gmail

preview

Get notifications and unread messages count from Gmail (Waybar/Polybar module).

Requirements

  • Font Awesome: default badge 
  • Libcanberra: notification sound (optional).

To display notifications you must have a notification daemon running on your system.

Installation

Use one of the following methods.

AUR package on ArchLinux and derivatives

https://aur.archlinux.org/packages/bar-gmail/

With pip from pypi.org

pip install --user bar-gmail
~/.local/bin/bar-gmail

Depending on your system you may also need to add the --break-system-packages flag.

With pip from git repo

git clone https://github.com/crabvk/bar-gmail.git
cd bar-gmail
git describe --abbrev=0 --tags # Get latest tag.
git checkoug LATEST_TAG
pip install -e .
~/.local/bin/bar-gmail

Usage

First, you need to authenticate the client:

bar-gmail auth

Then just run bar-gmail or bar-gmail --format polybar periodically to get unread messages count and new message notifications.

Credentials and session are stored in ~/.cache/bar-gmail.

Waybar config example

~/.config/waybar/config

"modules-right": {
    "custom/gmail"
}

"custom/gmail": {
    "exec": "bar-gmail",
    "return-type": "json",
    "interval": 10,
    "tooltip": false,
    "on-click": "xdg-open https://mail.google.com/mail/u/0/#inbox"
}

~/.config/waybar/style.css

#custom-gmail.unread {
    color: white;
}
#custom-gmail.inaccurate {
    color: darkorange;
}
#custom-gmail.error {
    color: darkred;
}

Polybar config example

modules-right = gmail
...
[module/gmail]
type = custom/script
exec = bar-gmail -f polybar
interval = 10
click-left = xdg-open https://mail.google.com/mail/u/0/#inbox

Script arguments

See bar-gmail --help for the full list of available subcommands and command arguments.

Possible values for -s, --sound is obtained with:

ls /usr/share/sounds/freedesktop/stereo/ | cut -d. -f1

for example bar-gmail --sound message-new-instant.

If you have several mails you can specify the credentials.json file with the --credentials <path> flag.

Metadata

Release files for bar-gmail 1.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bar-gmail 1.0.6
File Size Uploaded Provenance Actions
bar_gmail-1.0.6.tar.gz 7.4 kB Without provenance Details for bar_gmail-1.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bar-gmail 1.0.6
File Interpreter ABI Platform Actions
bar_gmail-1.0.6-py3-none-any.whl Python 3 none any Details for bar_gmail-1.0.6-py3-none-any.whl

Total release size: 16.5 kB

Release files / bar_gmail-1.0.6.tar.gz

Download URL bar_gmail-1.0.6.tar.gz
Size 7.4 kB
Tags Source
SHA-256 checksum
How to use checksums
16a7353c2ff6e495b07291d006552dcc767c5ae4df4fd05918568c769ff208d6
BLAKE2b-256 checksum
How to use checksums
55843ac9967c5f3b95d6cd3dd06d6b9b2e039fa390f569d497c73e2850694cbc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

Release files / bar_gmail-1.0.6-py3-none-any.whl

Download URL bar_gmail-1.0.6-py3-none-any.whl
Size 9.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
842fcb97c392f39d141d68c530ca461bd878aaf6fb2c4b5d3e2bd2c516ccd838
BLAKE2b-256 checksum
How to use checksums
6120a08441e9be208596aea2b0cd6d84b4f56fb438216a6189857150b4abc18c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

Security for bar-gmail 1.0.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page