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
...
```
The change in PR #211 to make the GCal module use all calendars
writable to the user is not desirable in all situations. At my
organization, I have write access to calendars for conference
rooms, for people's OOO events, etc. that fill my screen,
obscuring the events on my own calendar.
This change puts the behavior in that change behind a new config
flag, `wtf.mods.gcal.multiCalendar`. It defaults to `false`, but
feel free to change that if you think this is behavior that most
users would want (I tend to default towards preserving existing
behavior, in this case from before that change).
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.