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.

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
bar_gmail-1.0.6.tar.gz 7.4 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

1.0.6 This release

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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