]> git.madduck.net Git - etc/awesome.git/blob - imap.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Updated cpu (markdown)
[etc/awesome.git] / imap.md
1 [<- widgets](https://github.com/copycat-killer/lain/wiki/Widgets)
2
3 Shows mail status in a textbox over IMAP protocol.
4
5 Dependencies:
6
7 - python3
8
9 New mails are notified through a notification like this:
10
11         +---------------------------------------------------+
12         | +---+                                             |
13         | |\ /| donald@disney.org has 3 new messages        |
14         | +---+                                             |
15         |       Latest From: Mickey Mouse <boss@disney.org> |
16     |       Subject: Re: pay raise                      |
17     |                                                   |
18     |       Not after what you did yesterday.           |
19     |       Daisy told me everything [...]              |
20         |                                                   |
21         +---------------------------------------------------+
22
23 Text will be cut if the mail is too long.
24
25         myimapcheck = lain.widgets.imap(args)
26
27 The function takes a table as argument. Required table parameters are:
28
29 Variable | Type
30 --- | --- 
31 `server` | string
32 `mail` | string
33 `password` | string
34
35 while the optional are:
36
37 Variable | Meaning | Type | Default
38 --- | --- | --- | ---
39 `port` | IMAP port | int | 993
40 `refresh_timeout` | Refresh timeout seconds | int | 60
41 `header` | Text to show before value | string | " Mail "
42 `header_color` | Header color | string | `beautiful.fg_normal` or "#FFFFFF"
43 `color` | Mail value color | string | `beautiful.fg_focus` or "#FFFFFF"
44 `mail_encoding` | Mail character encoding | string | autodetected
45 `maxlen` | Maximum chars to display in notification | int | 200
46 `app` | Mail program to spawn on click | string | "mutt"
47 `shadow` | Hide widget when there are no mails | boolean | false
48 `is_plain` | Define whether `password` is a plain password (true) or a function that retrieves it (false) | boolean | false
49
50 Let's focus better on `is_plain`.
51
52 You can just set your password like this:
53
54     args.is_plain = false
55     args.password = "mypassword"
56
57 and you'll have the same security provided by `~/.netrc`.
58
59 **Or** you can use a keyring, like [python keyring](https://pypi.python.org/pypi/keyring):
60
61     args.password = "keyring get password"
62
63 When `is_plain == false`, it *executes* `password` before using it, so you can also use whatever password fetching solution you want.
64
65 You can also define your custom icon for the naughty notification. Just set `lain_mail_notify` into `theme.lua`:
66
67     theme.lain_mail_notify = "/path/to/my/icon"