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).

Dependencies

  • Font Awesome: default badge 
  • Libnotify: new email notifications, can be disabled with --no-notify flag.
  • Libcanberra: notification sound (optional).

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

Install

ArchLinux and derivatives

AUR package

Other distros

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 .

And now you can execute ~/.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 can be obtained with:

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

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

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.1.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

bar_gmail-1.0.1-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: bar_gmail-1.0.1.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.3-zen1-1-zen

File hashes

Hashes for bar_gmail-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c869288440891fadfb71b4e9ff032792d571066060d4e8e5cb76438ffa3cf87b
MD5 6d73c861e278f17500bbec9851dae83d
BLAKE2b-256 780f898e5185eb61675cffc4a30d5f341a80a9fe30307eb9b4a79b58848df783

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bar_gmail-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.5 Linux/6.5.3-zen1-1-zen

File hashes

Hashes for bar_gmail-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9f34a9881bdd987e1a5272f59bb2c0958bbd11c61410b2b683dfaf49a0b62ef1
MD5 0b4e233f861d12a52d7267a50c73e321
BLAKE2b-256 7fec66305f792f868df9239ea11f8ee3361db5a19e53a68158304e02aa6db76f

See more details on using hashes here.

Supported by

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