mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Merge branch 'master' into twitter-module
This commit is contained in:
commit
0ba4f60701
@ -122,3 +122,6 @@ Values: A positive integer, `0..n`.
|
||||
Your <a href="https://developers.google.com/calendar/quickstart/go">Google client secret</a> JSON file. <br />
|
||||
Values: A string representing a file path to the JSON secret file.
|
||||
|
||||
`showDeclined` <br />
|
||||
Whether or not to display events you've declined to attend. <br />
|
||||
Values: `true`, or `false`
|
||||
|
@ -247,6 +247,10 @@ Values: A positive integer, <code>0..n</code>.</p>
|
||||
Your <a href="https://developers.google.com/calendar/quickstart/go">Google client secret</a> JSON file. <br />
|
||||
Values: A string representing a file path to the JSON secret file.</p>
|
||||
|
||||
<p><code>showDeclined</code> <br />
|
||||
Whether or not to display events you’ve declined to attend. <br />
|
||||
Values: <code>true</code>, or <code>false</code></p>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="footer">
|
||||
|
@ -44,6 +44,10 @@ func (widget *Widget) contentFrom(calEvents []*CalEvent) string {
|
||||
var str string
|
||||
var prevEvent *CalEvent
|
||||
|
||||
if !wtf.Config.UBool("wtf.mods.gcal.showDeclined", false) {
|
||||
calEvents = removeDeclined(calEvents)
|
||||
}
|
||||
|
||||
for _, calEvent := range calEvents {
|
||||
timestamp := fmt.Sprintf("[%s]%s", widget.descriptionColor(calEvent), calEvent.Timestamp())
|
||||
|
||||
@ -83,7 +87,15 @@ func (widget *Widget) dayDivider(event, prevEvent *CalEvent) string {
|
||||
prevStartTime = prevEvent.Start()
|
||||
}
|
||||
|
||||
if event.Start().Day() != prevStartTime.Day() {
|
||||
// round times to midnight for comparison
|
||||
toMidnight := func(t time.Time) time.Time {
|
||||
t = t.Local()
|
||||
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, t.Location())
|
||||
}
|
||||
prevStartDay := toMidnight(prevStartTime)
|
||||
eventStartDay := toMidnight(event.Start())
|
||||
|
||||
if !eventStartDay.Equal(prevStartDay) {
|
||||
|
||||
return fmt.Sprintf("[%s::b]",
|
||||
wtf.Config.UString("wtf.mods.gcal.colors.day", "forestgreen")) +
|
||||
@ -215,3 +227,13 @@ func (widget *Widget) responseIcon(calEvent *CalEvent) string {
|
||||
|
||||
return " "
|
||||
}
|
||||
|
||||
func removeDeclined(events []*CalEvent) []*CalEvent {
|
||||
var ret []*CalEvent
|
||||
for _, e := range events {
|
||||
if e.ResponseFor(wtf.Config.UString("wtf.mods.gcal.email")) != "declined" {
|
||||
ret = append(ret, e)
|
||||
}
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
@ -128,9 +128,10 @@ func (tracker *FocusTracker) focus(idx int) {
|
||||
}
|
||||
|
||||
view := widget.TextView()
|
||||
view.SetBorderColor(colorFor(Config.UString("wtf.colors.border.focused", "gray")))
|
||||
|
||||
tracker.App.SetFocus(view)
|
||||
view.SetBorderColor(colorFor(Config.UString("wtf.colors.border.focused", "gray")))
|
||||
tracker.App.Draw()
|
||||
}
|
||||
|
||||
func (tracker *FocusTracker) focusables() []Wtfable {
|
||||
|
Loading…
x
Reference in New Issue
Block a user