From 4ec607dcdbf51d4feeee31e0920f07ecc5cd83b8 Mon Sep 17 00:00:00 2001 From: ken Date: Wed, 18 Oct 2023 13:41:32 +0800 Subject: [PATCH] Fix the error in the event Badge which currently does not allow empty strings. Change it to use a String pointer. --- dock.go | 2 +- event.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dock.go b/dock.go index 56113e4..7dc2318 100644 --- a/dock.go +++ b/dock.go @@ -92,7 +92,7 @@ func (d *Dock) SetBadge(badge string) (err error) { if err = d.ctx.Err(); err != nil { return } - _, err = synchronousEvent(d.ctx, d, d.w, Event{Name: eventNameDockCmdSetBadge, TargetID: d.id, Badge: badge}, eventNameDockEventBadgeSet) + _, err = synchronousEvent(d.ctx, d, d.w, Event{Name: eventNameDockCmdSetBadge, TargetID: d.id, Badge: &badge}, eventNameDockEventBadgeSet) return } diff --git a/event.go b/event.go index 6e02927..c27904c 100644 --- a/event.go +++ b/event.go @@ -21,7 +21,7 @@ type Event struct { // A choice was made not to use interfaces since it's a pain in the ass asserting each an every payload afterwards // We use pointers so that omitempty works AuthInfo *EventAuthInfo `json:"authInfo,omitempty"` - Badge string `json:"badge,omitempty"` + Badge *string `json:"badge,omitempty"` BounceType string `json:"bounceType,omitempty"` Bounds *RectangleOptions `json:"bounds,omitempty"` CallbackID string `json:"callbackId,omitempty"`