Skip to content

Commit

Permalink
fix: electron menu support checkbox
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Oct 1, 2024
1 parent a89ad8b commit 7881f23
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/main/src/tipc/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface ActionMenuItem {
shortcut?: string
icon?: string
submenu?: MenuItem[]
checked?: boolean
}
export const menuRoute = {
showContextMenu: t.procedure
Expand All @@ -28,10 +29,13 @@ export const menuRoute = {
type: "separator" as const,
}
}

return {
label: item.label,
enabled: item.enabled ?? true,
accelerator: item.shortcut?.replace("Meta", "CmdOrCtrl"),
checked: typeof item.checked === "boolean" ? item.checked : undefined,
type: typeof item.checked === "boolean" ? "checkbox" : undefined,
click() {
context.sender.send(
"menu-click",
Expand Down

0 comments on commit 7881f23

Please sign in to comment.