Skip to content

Commit

Permalink
support checks in the menu
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Jun 17, 2024
1 parent 08403b0 commit bb9b5f6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/systray/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,13 @@ func (t *tray) parseMenuItem(id int32, menu *menu.Dbusmenu, in interface{}, pos
}
} else {
ret.Label = fmt.Sprintf("%s", data["label"].Value())
if checkType, ok := data["toggle-type"]; ok && checkType.Value() == "checkmark" {
if checkState, ok := data["toggle-state"]; ok && checkState.Value().(int32) > 0 {
ret.Checked = true
}
}
ret.Action = func() {
err := menu.Event(t.conn.Context(), int32(id), "clicked", dbus.MakeVariant(id), uint32(time.Now().Unix()))
err := menu.Event(t.conn.Context(), id, "clicked", dbus.MakeVariant(id), uint32(time.Now().Unix()))
if err != nil {
fyne.LogError("Failed to message menu tap", err)
}
Expand Down

0 comments on commit bb9b5f6

Please sign in to comment.