mitranim / gow

Missing watch mode for Go commands. Watch Go files and execute a command like "go run" or "go test"

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mac: reload from the same window that started the process, if possible

arthurspa opened this issue · comments

Hi, I have the following scenario:

  • monitor 1 (M1) running VSCode
  • monitor 2 (M2) running zsh, where I call gow run .

Desired behaviour:
First time the app is loaded on M2, then when I change the focus to M1 and update the code, gow will reload the app in M2.

Current behaviour:
First time the app is loaded on M2, then when I change the focus to M1 and update the code, gow will reload the app in M1

The reason why I want this is to be able to keep editing the code in VSCode in full screen and watch the changes at the same time.
Currently it switches to the app on reload and moves away from VSCode. So I have to switch back at each save.

I don't know if it's possible, maybe it's a Mac behaviour. But checking anyway.

monitor 2 (M2) running zsh, where I call gow run .

Requires clarification: running how? Via Terminal / iTerm2 / another VSCode window / something else?

when I change the focus to M1 and update the code, gow will reload the app in M1

Requires clarification. It was running on M2 (how?). Does the entire window get moved between monitors?

I use MacOS with one physical display, so I can't test this. I've heard horror stories about multi-monitor behaviors on MacOS. For now, I can tell you is that gow does absolutely nothing that should cause apps to change focus or move between displays or workspaces. This kind of stuff doesn't happen when using a single display.

Requires clarification: running how? Via Terminal / iTerm2 / another VSCode window / something else?

On M2 (display 2) I'm running go run . in apple Terminal, with tmux v3.3a

Requires clarification. It was running on M2 (how?). Does the entire window get moved between monitors?

When I move the focus to M1 (display 1) to work on VS Code window, then gow run . is still running on my Terminal in M2 (display 2). No, not the entire Terminal gets moved to M1, just the app window that is reloaded by the running gow run .

If your Go app opens its own GUI window, you should probably clarify this, since it's uncommon for Go apps. When gow restarts it, does the system reopen the window on the "current" monitor? I haven't experienced this issue because I haven't used multiple monitors. It might be possible to pin an app to a specific monitor, just like with virtual desktops / workspaces (right click in Dock → Options). But I'm sure you've already tried that...