Prefer to have widgets force a draw when their data changes. This should
reduce draws (unless the user has a module installed that updates >=
1/sec, the old draw default).
This should also remove a source of some of the race conditions that
users were experiencing (though not all, there are still many).
When there are lot of events, the content in teh widget is hidden and there is no way to view the upcoming events. Making the widget focussable allows for one to scroll through the list of calendar events using the arrow keys
When no widget has focus, press the letter key to focus on the widget
assigned to that letter.
Example:
GitHub (d)
Press "d" to focus on the GitHub widget.
As discussed in issue #223 (which has pictures that better explain
the changes here), this change:
- Removes the date from individual events, instead centering a
title at the start of each day with the date (which uses a new
configurable color, `wtf.mods.gcal.colors.day`)
- Consolidates 3 lines per event down to 2, moving timestamp to
front of each event
- Makes the time-until-event text turn red when under 30 minutes
(wasn't discussed in the issue but was another thing I added
locally for this, feel free to discard if unwanted)
New format is:
```
Monday, Jun 25
x 13:00 Super Cool Meeting Title 2h
Event location
x 14:00 Also Super Cool Meeting 3h
Event location
Tuesday, Jun 26
...
```
While it's reasonable to have a refresh interval of several minutes
between the GCal module hitting the server, the fact that the module
(helpfully) displays the time until an event means that as times
approach zero, they become relatively inaccurate - "3m" might show
up next to a meeting that you were supposed to be in 2 minutes ago.
(don't worry, that hasn't happened to me yet)
This change introduces a goroutine to the GCal module that will
update the module text using the most recently cached copy of
events. By default, it runs every 30 seconds (this could be changed
to 0 to make it opt-in if desired) or however many seconds is
specified by the new config option `wtf.mods.gcal.textInterval`.
To make sure the goroutine doesn't cause any synchronization issues
if a text update were to trigger at the same time as a module
refresh, this change also adds the use of `sync.Mutex` to gate
setting GCal's text. Since both mutexes and having a goroutine within
individual modules are not the sort of thing any other code in
`wtf` does at this point in time, I'm definitely open to feedback
on whether there might be better ways to do this.
Additionally, the change in `wtf.go` fixes an issue I noticed when
testing if my `Disable()` function worked - the main `Widgets`
array wasn't being cleared out after disabling all widgets before
re-creating new copies of them, so it still held pointers to the
old ones.
Widget titles can now be specified in the config file via a 'title' key.
Example:
wtf:
mods:
todo:
title: Tada
which can include emoji. No need to force everyone to look at my emoji,
now they can define their own.
Widgets can inform whether or not they should get tab focus.
Widgets that provide additional functionality should return true.
Widgets that have no extra capability should return false.
This allows the FocusTracker to only tab through and focus on widgets
for which it provides value.