Get notifications and unread messages count from Gmail (Waybar/Polybar module).
- Font Awesome: default badge
- Libcanberra: notification sound (optional).
To display notifications you must have a notification daemon running on your system.
Use one of the following methods.
https://aur.archlinux.org/packages/bar-gmail/
pip install --user bar-gmail
~/.local/bin/bar-gmailDepending on your system you may also need to add the --break-system-packages flag.
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-gmailFirst, you need to authenticate the client:
bar-gmail authThen 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.
~/.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;
}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/#inboxSee 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. -f1for example bar-gmail --sound message-new-instant.
If you have several mails you can specify the credentials.json file with the --credentials <path> flag.
