1
0
mirror of https://github.com/taigrr/wtf synced 2025-01-18 04:03:14 -08:00

New and improved multicalendar display format

This commit is contained in:
Chris Cummer 2018-06-29 15:24:34 -07:00
parent c64270e6ad
commit 89868c169c

View File

@ -53,18 +53,22 @@ func (widget *Widget) contentFrom(calEvents []*CalEvent) string {
) )
lineOne := fmt.Sprintf( lineOne := fmt.Sprintf(
"%s %s %s %s %s[white]", "%s %s %s %s[white]\n",
widget.dayDivider(calEvent, prevEvent), widget.dayDivider(calEvent, prevEvent),
widget.responseIcon(calEvent), widget.responseIcon(calEvent),
timestamp, timestamp,
title, title,
)
str = str + fmt.Sprintf("%s %s%s\n",
lineOne,
widget.location(calEvent),
widget.timeUntil(calEvent), widget.timeUntil(calEvent),
) )
str = str + fmt.Sprintf("%s%s\n\n", if (widget.location(calEvent) != "") || (widget.timeUntil(calEvent) != "") {
lineOne, str = str + "\n"
widget.location(calEvent), }
)
prevEvent = calEvent prevEvent = calEvent
} }
@ -80,11 +84,9 @@ func (widget *Widget) dayDivider(event, prevEvent *CalEvent) string {
} }
if event.Start().Day() != prevStartTime.Day() { if event.Start().Day() != prevStartTime.Day() {
//_, _, width, _ := widget.View.GetInnerRect()
return fmt.Sprintf("[%s::b]", return fmt.Sprintf("[%s::b]",
wtf.Config.UString("wtf.mods.gcal.colors.day", "forestgreen")) + wtf.Config.UString("wtf.mods.gcal.colors.day", "forestgreen")) +
//wtf.CenterText(event.Start().Format(wtf.FullDateFormat), width) +
event.Start().Format(wtf.FullDateFormat) + event.Start().Format(wtf.FullDateFormat) +
"\n" "\n"
} }
@ -185,7 +187,7 @@ func (widget *Widget) location(calEvent *CalEvent) string {
} }
return fmt.Sprintf( return fmt.Sprintf(
"\n [%s]%s", "[%s]%s ",
widget.descriptionColor(calEvent), widget.descriptionColor(calEvent),
calEvent.event.Location, calEvent.event.Location,
) )