Skip to content

Commit

Permalink
WTF-33 gcal 'showAllDay' option added
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
senorprogrammer committed Dec 28, 2019
1 parent ac28176 commit ff3bc66
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/gcal/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down
2 changes: 2 additions & 0 deletions modules/gcal/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 you’ve 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"`
Expand All @@ -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", ""),
Expand Down

0 comments on commit ff3bc66

Please sign in to comment.