add ctrl-q and ctrl-w for quit and close window

This commit is contained in:
Aaron Bieber 2023-06-06 06:29:35 -06:00
parent 09d938fd67
commit 8c666fb4b5
No known key found for this signature in database

View File

@ -418,6 +418,15 @@ func main() {
a := app.New()
w := a.NewWindow("xintray")
ctrlQ := &desktop.CustomShortcut{KeyName: fyne.KeyQ, Modifier: fyne.KeyModifierControl}
ctrlW := &desktop.CustomShortcut{KeyName: fyne.KeyW, Modifier: fyne.KeyModifierControl}
w.Canvas().AddShortcut(ctrlQ, func(shortcut fyne.Shortcut) {
a.Quit()
})
w.Canvas().AddShortcut(ctrlW, func(shortcut fyne.Shortcut) {
w.Hide()
})
tabs := container.NewAppTabs(
container.NewTabItemWithIcon("Status", theme.ComputerIcon(), buildCards(status)),
)