fvim icon indicating copy to clipboard operation
fvim copied to clipboard

Navigation between X windows is surprising

Open jruere opened this issue 11 months ago • 4 comments

Hi! Thanks for this excellent improvement over Neovim!

The feature which caught my attention was the ability to move a vi window into an X window while still being part of the same session. Have been wanting to handle vi and X windows in a single way for a while!

Nevertheless, I encounter a very surprising behaviour. When a vi window is moved into an X window, I can navigate between them using the window manager (WM), but when I try to use the focused window, focus jumps to the one where vi would be "focused". Does this explanation make sense?

I'll give you an example.

  1. Start fvim on file 1.
  2. :sp file 2. Now there are two vi windows visible in one X window, and the vi focus is on file 2.
  3. Ctrl-w ge. Now there are two X windows, each with one vi window.
  4. With the WM, change focus to the X window which has file 1.
  5. When I type, I'd expect that input goes to file 1, but X window focus jumps to the X window with file 2, where the vi focus was.

Another thing I found surprising was that pressing Ctrl-ww changes the X window focus. I'd have expected for focus to switch between the windows within an X window, not among them.

Is this the intended behaviour?

jruere avatar Jan 08 '25 11:01 jruere

Hi! I think this is kinda expected behavior, because activating the "X window" does not activate the corresponding vi window (if so, which vi window shall I activate?).

I vaguely remember that fvim will send a focus grab request when switching between multiple grids. If I understand correctly, you want the other way around? That is, send multigrid focus switching when X window focus has changed.

The idea of X window embedding is interesting. We may assemble an IDE-ish environment with this capability :)

yatli avatar Feb 15 '25 02:02 yatli

Hi! I think this is kinda expected behavior, because activating the "X window" does not activate the corresponding vi window (if so, which vi window shall I activate?).

Whichever was active on that X window. Would this not be the expected behaviour for any application? The focus stays where it was.

I vaguely remember that fvim will send a focus grab request when switching between multiple grids. If I understand correctly, you want the other way around? That is, send multigrid focus switching when X window focus has changed.

I don't understand what you are saying. Sorry.

The idea of X window embedding is interesting. We may assemble an IDE-ish environment with this capability :)

I don't understand how this would be X window embedding. I had not considered this. Currently, there are two "window managers" at play. Regular vim has only its thing but outside vim, there's always one more. I guess it would be possible to never use vim's WM, and just use X windows for windows. This means that only X's WM could be used to switch between windows. I like it, but I think most vim users would find that jarring.

jruere avatar Feb 15 '25 16:02 jruere

Whichever was active on that X window.

What if there are multiple? Do I keep track of them?

yatli avatar Feb 16 '25 07:02 yatli

Whichever was active on that X window.

What if there are multiple? Do I keep track of them?

I'd assume so.

Please, consider if this is something that makes sense. It could be that vim users just don't work like this.

jruere avatar Feb 17 '25 11:02 jruere