add Ctrl+R shortcut for reload

This commit is contained in:
Drew Weymouth
2023-01-22 12:29:24 -08:00
parent 8691a0762c
commit c1aaed4b3e
+4
View File
@@ -16,6 +16,7 @@ import (
var (
ShortcutBack = desktop.CustomShortcut{KeyName: fyne.KeyLeft, Modifier: AltModifier}
ShortcutForward = desktop.CustomShortcut{KeyName: fyne.KeyRight, Modifier: AltModifier}
ShortcutReload = desktop.CustomShortcut{KeyName: fyne.KeyR, Modifier: ControlModifier}
ShortcutSearch = desktop.CustomShortcut{KeyName: fyne.KeyF, Modifier: ControlModifier}
)
@@ -98,6 +99,9 @@ func (m *MainWindow) addShortcuts() {
m.BrowsingPane.GoForward()
m.Canvas().Focus(nil)
})
m.Canvas().AddShortcut(&ShortcutReload, func(_ fyne.Shortcut) {
m.BrowsingPane.Reload()
})
m.Canvas().AddShortcut(&ShortcutSearch, func(_ fyne.Shortcut) {
if s := m.BrowsingPane.GetSearchBarIfAny(); s != nil {
m.Window.Canvas().Focus(s)