| 1 | Clock Widget |
| 2 | ============ |
| 3 | |
| 4 | This widget is a powerful clock. It has a normal view, a roll-over view, and |
| 5 | configurable, time-based alarms. When an alarm is shown, the clock will change |
| 6 | its colour to indicate that. If you then click on it, all alarms since the |
| 7 | last click are shown. |
| 8 | |
| 9 | Settings Available: |
| 10 | ------------------- |
| 11 | * `set_editor("xterm -e vim")`: Set which editor to use. There is no default, |
| 12 | so this is needed. |
| 13 | * `set_shortformat("%a %b %d")`: Set the format of the short display. You may |
| 14 | specify either a string which has a format that os.date() can understand |
| 15 | (man date has the formats), or a function that returns the usable format. |
| 16 | * `set_longformat(function () return "%T %a %b %d %Y" end)`: Set the format of |
| 17 | the long display. You may specify either a string which has a format that |
| 18 | `os.date()` can understand (`man date` has the formats), or a function that |
| 19 | returns the usable format. |
| 20 | * `set_shorttimer(n)`: Set the delay between updates to `n` |
| 21 | * `set_longtimer(n)`: Set the long delay between updates to `n`, this is used |
| 22 | when obvious is suspended. |
| 23 | |
| 24 | To set one of these settings, simply do something like: |
| 25 | |
| 26 | ```lua |
| 27 | local clock = require("obvious.clock") |
| 28 | clock.set_editor("xterm -e vim") |
| 29 | ``` |
| 30 | |
| 31 | Implementation: |
| 32 | --------------- |
| 33 | To use it, include it into your rc.lua by inserting this line: |
| 34 | |
| 35 | ```lua |
| 36 | local clock = require("obvious.clock") |
| 37 | ``` |
| 38 | |
| 39 | Then configure at least the editor setting (see Settings Available). |
| 40 | |
| 41 | To finish your rc.lua changes, add the clock widget to your wibox's |
| 42 | widget list by adding: |
| 43 | |
| 44 | ```lua |
| 45 | clock() |
| 46 | ``` |
| 47 | |
| 48 | Finally, you want to create the alarm file. The alarm file is contained |
| 49 | in `${XDG_CONFIG_HOME}/awesome/alarms`. In most cases this would be |
| 50 | `~/.config/awesome/alarms`. The alarm file has a format like: |
| 51 | |
| 52 | 14:30 |
| 53 | get pizza from oven |
| 54 | |
| 55 | These alarms (each consisting of two lines) are shown with naughty. The first |
| 56 | line of each entry is a Lua regular expression to match against the time in |
| 57 | strftime format `%a-%d-%m-%Y:%H:%M`, which looks like this: |
| 58 | |
| 59 | Tue-26-05-2009:22:01 |
| 60 | |
| 61 | The second line contains the message to show. You can use `\n` inside the |
| 62 | message body if you want a newline. |