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