Skip to content

Commit

Permalink
update from master
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Dec 7, 2023
1 parent b7df991 commit 42ccddb
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions _widgets/email-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,52 @@ layout: page
This widget consists of an icon with counter which shows number of unread emails: ![email icon](../awesome-wm-widgets/assets/img/widgets/screenshots/email-widget/em-wid-1.png)
and a popup message which appears when mouse hovers over an icon: ![email popup](../awesome-wm-widgets/assets/img/widgets/screenshots/email-widget/em-wid-2.png)

Note that widget uses the Arc icon theme, so it should be [installed](https://github.com/horst3180/arc-icon-theme#installation) first under **/usr/share/icons/Arc/** folder.

## Installation
1. Clone this repository to your awesome config folder:

To install it put **email.lua** and **email-widget** folder under **~/.config/awesome**. Then
```bash
git clone https://github.com/streetturtle/awesome-wm-widgets/email-widget ~/.config/awesome/email-widget
```
2. Make virtual environment and install dependencies:

- in **email.lua** change path to python scripts;
- in python scripts add your credentials (note that password should be encrypted using pgp for example);
- add widget to awesome:
```bash
cd ~/.config/awesome/email-widget
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
```
3. Fill .env file with your credentials:

```lua
local email_widget, email_icon = require("email")
```bash
cp .env.example .env
```
4. Add widget to awesome:

```lua
local email_widget = require("email-widget.email")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
layout = wibox.layout.fixed.horizontal,
...
email_icon,
email_widget,
email_widget,
...
```

If you want to reduce time of getting emails, you can change maximum number of emails to be fetched in .env file. Default is 10.
If you want to configure width of popup window, you can change this line in email.lua file:

```lua
width = 800,
```
After this you can change MAX_BODY_LENGTH variable in .env file to change number of characters to be displayed in popup window. Default is 100.
Next step is restarting awesome. You can do this by pressing Mod+Ctrl+r.

## How it works

This widget uses the output of two python scripts, first is called every 20 seconds - it returns number of unread emails and second is called when mouse hovers over an icon and displays content of those emails. For both of them you'll need to provide your credentials and imap server. For testing, they can simply be called from console:

``` bash
python ~/.config/awesome/email/count_unread_emails.py
python ~/.config/awesome/email/read_emails.py
python ~/.config/awesome/email-widget/count_unread_emails.py
python ~/.config/awesome/email-widget/read_emails.py
```
Binary file modified assets/img/widgets/screenshots/email-widget/em-wid-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/img/widgets/screenshots/email-widget/em-wid-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 42ccddb

Please sign in to comment.