Repository: fyne-io/fyne
File: internal/driver/glfw/window.go (Go)

Code before:
			fyne.CurrentApp().Lifecycle().(*app.Lifecycle).TriggerEnteredForeground()
		}
		curWindow = w
		w.canvas.FocusGained()
	} else {
		w.canvas.FocusLost()
		w.mouseLock.Lock()
		w.mousePos = fyne.Position{}
		w.mouseLock.Unlock()

		go func() { // check whether another window was focused or not
			time.Sleep(time.Millisecond * 100)
			if curWindow != w {
				return
			}

			curWindow = nil
			fyne.CurrentApp().Lifecycle().(*app.Lifecycle).TriggerExitedForeground()
		}()
	}
}

func (w *window) triggersShortcut(localizedKeyName fyne.KeyName, key fyne.KeyName, modifier fyne.KeyModifier) bool {
	var shortcut fyne.Shortcut
	ctrlMod := fyne.KeyModifierControl
	if runtime.GOOS == "darwin" || isMacOSBrowser() {
		ctrlMod = fyne.KeyModifierSuper
	}
	// User pressing physical keys Ctrl+V while using a Russian (or any non-ASCII) keyboard layout
	// is reported as a fyne.KeyUnknown key with Control modifier. We should still consider this
	// as a "Paste" shortcut.
	// See https://github.com/fyne-io/fyne/pull/2587 for discussion.
	keyName := localizedKeyName
	resemblesShortcut := (modifier&(fyne.KeyModifierControl|fyne.KeyModifierSuper) != 0)
	if (localizedKeyName == fyne.KeyUnknown) && resemblesShortcut {
		if key != fyne.KeyUnknown {
			keyName = key
		}
	}
	if modifier == ctrlMod {
		switch keyName {
		case fyne.KeyV:
			// detect paste shortcut
			shortcut = &fyne.ShortcutPaste{
				Clipboard: w.Clipboard(),
			}
		case fyne.KeyC, fyne.KeyInsert:
			// detect copy shortcut
			shortcut = &fyne.ShortcutCopy{
				Clipboard: w.Clipboard(),
			}

Review comment (suggestion):
This could be simplified - put the GOOS check in place if "false" in the shortcuts_other and call it "isMacOSRuntime instead.
It will also fix the issue where you are running the server on macOS but accessing from a windows browser.

Code after:
	} else {
		w.canvas.FocusLost()
		w.mouseLock.Lock()
		w.mousePos = fyne.Position{}
		w.mouseLock.Unlock()

		go func() { // check whether another window was focused or not
			time.Sleep(time.Millisecond * 100)
			if curWindow != w {
				return
			}

			curWindow = nil
			fyne.CurrentApp().Lifecycle().(*app.Lifecycle).TriggerExitedForeground()
		}()
	}
}

func (w *window) triggersShortcut(localizedKeyName fyne.KeyName, key fyne.KeyName, modifier fyne.KeyModifier) bool {
	var shortcut fyne.Shortcut
	ctrlMod := fyne.KeyModifierControl
	if isMacOSRuntime() {
		ctrlMod = fyne.KeyModifierSuper
	}
	// User pressing physical keys Ctrl+V while using a Russian (or any non-ASCII) keyboard layout
	// is reported as a fyne.KeyUnknown key with Control modifier. We should still consider this
	// as a "Paste" shortcut.
	// See https://github.com/fyne-io/fyne/pull/2587 for discussion.
	keyName := localizedKeyName
	resemblesShortcut := (modifier&(fyne.KeyModifierControl|fyne.KeyModifierSuper) != 0)
	if (localizedKeyName == fyne.KeyUnknown) && resemblesShortcut {
		if key != fyne.KeyUnknown {
			keyName = key
		}
	}
	if modifier == ctrlMod {
		switch keyName {
		case fyne.KeyZ:
			// detect undo shortcut
			shortcut = &fyne.ShortcutUndo{}
		case fyne.KeyY:
			// detect redo shortcut
			shortcut = &fyne.ShortcutRedo{}
		case fyne.KeyV:
			// detect paste shortcut
			shortcut = &fyne.ShortcutPaste{
				Clipboard: w.Clipboard(),
			}
		case fyne.KeyC, fyne.KeyInsert:
			// detect copy shortcut
			shortcut = &fyne.ShortcutCopy{