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

WTF-33 gcal 'showAllDay' option added (#804)

When true, all-day events are displayed. When false, all-day
events are not displayed.

Defaults to true.

Closes #733

Signed-off-by: Chris Cummer <chriscummer@me.com>
This commit is contained in:
Chris Cummer 2019-12-30 22:25:10 -05:00 committed by GitHub
parent 5f1aeec5ae
commit cc169f1674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -33,6 +33,10 @@ func (widget *Widget) content() (string, string, bool) {
}
for _, calEvent := range calEvents {
if calEvent.AllDay() && !widget.settings.showAllDay {
continue
}
timestamp := fmt.Sprintf("[%s]%s", widget.eventTimeColor(calEvent), calEvent.Timestamp(widget.settings.hourFormat))
if calEvent.AllDay() {
timestamp = ""

View File

@ -33,6 +33,7 @@ type Settings struct {
hourFormat string `help:"The format of the clock." values:"12 or 24"`
multiCalendar bool `help:"Whether or not to display your primary calendar or all calendars you have access to." values:"true or false" optional:"true"`
secretFile string `help:"Your Google client secret JSON file." values:"A string representing a file path to the JSON secret file."`
showAllDay bool `help:"Whether or not to display all-day events" values:"true or false" optional:"true" default:"true"`
showDeclined bool `help:"Whether or not to display events youve declined to attend." values:"true or false" optional:"true"`
withLocation bool `help:"Whether or not to show the location of the appointment." values:"true or false"`
timezone string `help:"The time zone used to display calendar event times." values:"A valid TZ database time zone string" optional:"true"`
@ -52,6 +53,7 @@ func NewSettingsFromYAML(name string, ymlConfig *config.Config, globalConfig *co
hourFormat: ymlConfig.UString("hourFormat", "24"),
multiCalendar: ymlConfig.UBool("multiCalendar", false),
secretFile: ymlConfig.UString("secretFile", ""),
showAllDay: ymlConfig.UBool("showAllDay", true),
showDeclined: ymlConfig.UBool("showDeclined", false),
withLocation: ymlConfig.UBool("withLocation", true),
timezone: ymlConfig.UString("timezone", ""),