# Bar Gmail
![preview](https://github.com/crabvk/polybar-gmail/raw/master/preview.png)
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](https://wiki.archlinux.org/title/Desktop_notifications#Notification_servers) 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
```sh
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
```sh
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:
```sh
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*
```json
"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*
```css
#custom-gmail.unread {
color: white;
}
#custom-gmail.inaccurate {
color: darkorange;
}
#custom-gmail.error {
color: darkred;
}
```
## Polybar config example
```ini
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:
```shell
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/crabvk/bar-gmail",
"name": "bar-gmail",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0.0,>=3.10.7",
"maintainer_email": null,
"keywords": "waybar, polybar, gmail",
"author": "Vyacheslav Konovalov",
"author_email": "crabvk@protonmail.com",
"download_url": "https://files.pythonhosted.org/packages/55/84/3ac9967c5f3b95d6cd3dd06d6b9b2e039fa390f569d497c73e2850694cbc/bar_gmail-1.0.6.tar.gz",
"platform": null,
"description": "# Bar Gmail\n\n![preview](https://github.com/crabvk/polybar-gmail/raw/master/preview.png)\n\nGet notifications and unread messages count from Gmail (Waybar/Polybar module).\n\n## Requirements\n\n* Font Awesome: default badge \uf0e0\n* Libcanberra: notification sound (optional).\n\nTo display notifications you must have a [notification daemon](https://wiki.archlinux.org/title/Desktop_notifications#Notification_servers) running on your system.\n\n## Installation\n\nUse one of the following methods.\n\n### AUR package on ArchLinux and derivatives\n\nhttps://aur.archlinux.org/packages/bar-gmail/\n\n### With pip from pypi.org\n\n```sh\npip install --user bar-gmail\n~/.local/bin/bar-gmail\n```\n\nDepending on your system you may also need to add the `--break-system-packages` flag.\n\n### With pip from git repo\n\n```sh\ngit clone https://github.com/crabvk/bar-gmail.git\ncd bar-gmail\ngit describe --abbrev=0 --tags # Get latest tag.\ngit checkoug LATEST_TAG\npip install -e .\n~/.local/bin/bar-gmail\n```\n\n## Usage\n\nFirst, you need to authenticate the client:\n\n```sh\nbar-gmail auth\n```\n\nThen just run `bar-gmail` or `bar-gmail --format polybar` periodically to get unread messages count and new message notifications.\n\nCredentials and session are stored in *~/.cache/bar-gmail*.\n\n## Waybar config example\n\n*~/.config/waybar/config*\n\n```json\n\"modules-right\": {\n \"custom/gmail\"\n}\n\n\"custom/gmail\": {\n \"exec\": \"bar-gmail\",\n \"return-type\": \"json\",\n \"interval\": 10,\n \"tooltip\": false,\n \"on-click\": \"xdg-open https://mail.google.com/mail/u/0/#inbox\"\n}\n```\n\n*~/.config/waybar/style.css*\n\n```css\n#custom-gmail.unread {\n color: white;\n}\n#custom-gmail.inaccurate {\n color: darkorange;\n}\n#custom-gmail.error {\n color: darkred;\n}\n```\n\n## Polybar config example\n\n```ini\nmodules-right = gmail\n...\n[module/gmail]\ntype = custom/script\nexec = bar-gmail -f polybar\ninterval = 10\nclick-left = xdg-open https://mail.google.com/mail/u/0/#inbox\n```\n\n## Script arguments\n\nSee `bar-gmail --help` for the full list of available subcommands and command arguments.\n\nPossible values for `-s`, `--sound` is obtained with:\n\n```shell\nls /usr/share/sounds/freedesktop/stereo/ | cut -d. -f1\n```\n\nfor example `bar-gmail --sound message-new-instant`.\n\nIf you have several mails you can specify the `credentials.json` file with the `--credentials <path>` flag.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Get notifications and unread messages count from Gmail (Waybar/Polybar module)",
"version": "1.0.6",
"project_urls": {
"Homepage": "https://github.com/crabvk/bar-gmail"
},
"split_keywords": [
"waybar",
" polybar",
" gmail"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6120a08441e9be208596aea2b0cd6d84b4f56fb438216a6189857150b4abc18c",
"md5": "cecd4cec7b4fbfe3b49fa766fc42fe60",
"sha256": "842fcb97c392f39d141d68c530ca461bd878aaf6fb2c4b5d3e2bd2c516ccd838"
},
"downloads": -1,
"filename": "bar_gmail-1.0.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "cecd4cec7b4fbfe3b49fa766fc42fe60",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0.0,>=3.10.7",
"size": 9094,
"upload_time": "2024-12-15T09:58:11",
"upload_time_iso_8601": "2024-12-15T09:58:11.242072Z",
"url": "https://files.pythonhosted.org/packages/61/20/a08441e9be208596aea2b0cd6d84b4f56fb438216a6189857150b4abc18c/bar_gmail-1.0.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "55843ac9967c5f3b95d6cd3dd06d6b9b2e039fa390f569d497c73e2850694cbc",
"md5": "3f1e0e89d941896adbdeaff3d80538eb",
"sha256": "16a7353c2ff6e495b07291d006552dcc767c5ae4df4fd05918568c769ff208d6"
},
"downloads": -1,
"filename": "bar_gmail-1.0.6.tar.gz",
"has_sig": false,
"md5_digest": "3f1e0e89d941896adbdeaff3d80538eb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0.0,>=3.10.7",
"size": 7362,
"upload_time": "2024-12-15T09:58:12",
"upload_time_iso_8601": "2024-12-15T09:58:12.593228Z",
"url": "https://files.pythonhosted.org/packages/55/84/3ac9967c5f3b95d6cd3dd06d6b9b2e039fa390f569d497c73e2850694cbc/bar_gmail-1.0.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-15 09:58:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "crabvk",
"github_project": "bar-gmail",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "bar-gmail"
}