neovide: keyboard is non-responsive on startup because it doesn't detect FocusGained unless I switch away (via alt-tab) first.
EDIT: ignore everything and just jump here for reproduction steps & workaround.
tl;dr: workaround is here
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior: EDIT: a better/automated way is here
- Follow the log in another terminal via
$ tail -F neovide_rCURRENT.log
(must be in the same directory assomefile
from below) - Run the following from inside a
qterminal
:$ neovide --nosrgb --noidle --log somefile
- observe that any keys you press have no effect inside the neovide window and the log file doesn’t notice them, ie. the log file repeats these lines only:
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
- Now alt-tab away from neovide and notice the new log lines:
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
TRACE [neovide::channel_utils] neovide::bridge::ui_commands::UiCommand Parallel(FocusGained)
TRACE [neovide::redraw_scheduler] Next frame queued
TRACE [neovide::redraw_scheduler] Next frame queued
TRACE [neovide::redraw_scheduler] Next frame queued
TRACE [neovide::channel_utils] neovide::bridge::ui_commands::UiCommand Parallel(FocusLost)
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
TRACE [neovide::window] Settings geometry PhysicalSize { width: 164, height: 56 }
TRACE [neovide::window] Inner size: PhysicalSize { width: 1476, height: 952 }
That’s right, it finally sees a FocusGained
before the FocusLost
, and I think it’s due to the lack of seen FocusGained
that the keyboard isn’t responsive. This kind of behaviour doesn’t happen on any other program so far. The window is focused, judging by the title bar being blue.
Expected behavior Keyboard works in neovide without the need to first alt-tab away then alt-tab back.
Screenshots
See the window has focus, as far as the window manager is concerned, but neovide doesn’t seem to know that, as the keyboard is ignored:
Desktop (please complete the following information):
- OS: Linux Gentoo ~amd64
- Neovide Version 0.10.1
- Neovim Version v0.7.2
Please run neovide --log
and paste the contents of the .log
file created in the current directory here:
Maybe later because (unrelated) I just realized that I cannot copy the text seen inside neovide with the mouse, like I could in the (n)vim that runs in the terminal(when set mouse=
aka no mouse in vim, but neovide needs set mouse=a
if I want to use scroll) and thus I think I can’t use neovide due to this. Well actually there is an acceptable way: https://github.com/neovide/neovide/issues/1204#issuecomment-1033911753 and since MMB paste is already working it’s quite good enough for me, thank you very much 😃 it’s actually even better because now it doesn’t also copy the spaces at the end of the lines like it would do in the terminal!
Additional context using LXQT with xfwm4 on X11
$ X -version
X.Org X Server 1.21.1.4
X Protocol Version 11, Revision 0
Current Operating System: Linux i87k 5.18.19-gentoo-r1-x86_64 #1 SMP Tue Sep 6 08:59:43 CEST 2022 x86_64
Current version of pixman: 0.40.0
$ xfwm4 -V
This is xfwm4 version 4.16.1 (revision 5f61a84ad) for Xfce 4.16
Released under the terms of the GNU General Public License.
Compiled against GTK+-3.24.32, using GTK+-3.24.34.
Build configuration and supported features:
- Startup notification support: Yes
- XSync support: Yes
- Render support: Yes
- Xrandr support: Yes
- Xpresent support: Yes
- X Input 2 support: Yes
- Embedded compositor: Yes
- Epoxy support: Yes
- KDE systray proxy (deprecated): No
LXQt About Version
1.1.0
LXQt Version
1.1.0
Qt
5.15.5
Build type
Release
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 5
- Comments: 24 (1 by maintainers)
Just out of curiousity I tested what happens when I bind neovide to just the letter “c” (instead of super+c). As it seems that whichever modifier you use for the keybind gets “stuck” this seemed like an interesting experiment. Lo and behold, the keypresses get recognized immediately. Now “c” is not a very convenient binding but luckily my keyboard is QMK configurable. So I added a keymap for an unused F-Key (F17) in my keyboard layout and bound that to opening neovide in i3.
Finally I got at least a workaround.
I think this issue is the same as https://github.com/rust-windowing/winit/issues/2841, so we are still waiting for a winit fix.
I just tried again with same result. Perhaps I’m misunderstanding the instructions.
If I understand correctly you just need to change
active_window
fromNone
toSome(root)
in the winit directory and then update the Cargo.toml in the neovide directory to use the local version of winit. Afterwards update, build, and use the binary in target directory. The one-liners you provide are just for checking if it worked. All of that correct?same for me
Ok. That is interesting. It’s kind of the same for me. I use super+c to start it and the super key seems to be “stuck”.
Nothing. I don’t have a DE. Window manager only (i3).
Yes, correct.
With i3wm, I can reproduce the issue manually, eg. if I make sure the mouse doesn't hover on neovide when it starts up, sometimes it won't accept keyboard inputs, but if I move mouse to hover on it (it then receives the first FocusGained event and) then it starts working
Maybe I’m experiencing a different bug then. Key presses will always be recognized after switching focus back and forth. But never when I first launch neovide through a keybinding. It will work if I launch it via rofi or from terminal, but I’m guessing that’s because I switch focus (from rofi/terminal to neovide) in those cases.