Skip to main content

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

Project description

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.

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

bar_gmail-1.0.6.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

bar_gmail-1.0.6-py3-none-any.whl (9.1 kB view details)

Uploaded Python 3

File details

Details for the file bar_gmail-1.0.6.tar.gz.

File metadata

  • Download URL: bar_gmail-1.0.6.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for bar_gmail-1.0.6.tar.gz
Algorithm Hash digest
SHA256 16a7353c2ff6e495b07291d006552dcc767c5ae4df4fd05918568c769ff208d6
MD5 3f1e0e89d941896adbdeaff3d80538eb
BLAKE2b-256 55843ac9967c5f3b95d6cd3dd06d6b9b2e039fa390f569d497c73e2850694cbc

See more details on using hashes here.

File details

Details for the file bar_gmail-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: bar_gmail-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.12.7 Linux/6.12.4-zen1-1-zen

File hashes

Hashes for bar_gmail-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 842fcb97c392f39d141d68c530ca461bd878aaf6fb2c4b5d3e2bd2c516ccd838
MD5 cecd4cec7b4fbfe3b49fa766fc42fe60
BLAKE2b-256 6120a08441e9be208596aea2b0cd6d84b4f56fb438216a6189857150b4abc18c

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