-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disable ttyxi input processing (but not clipboard access!) under wayland #2041
Comments
Probably another symptom of this bug is that you still have to press ESC twice even in ttyxi mode if it's a Wayland session. So using
makes input in GNOME Terminal working without delay even under Wayland, also clipboard works as expected and one ESC press is enough. Would be great to add whose two switches under Wayland by default. |
In fact, XWayland allows you to listen to keyboard events of other applications, but only if these applications also use XWayland: So probably this workarounds also might work:
or
or even may be
etc UPD: made some tests, this does not affect delays actually. |
Few words from the theory. While running multiple GUI applications, Xorg does not isolate them from each other. Wayland does, which is a more secure approach. XWayland keyboard grabbing This protocol is application-specific to meet the needs of the X11 protocol through Xwayland. It provides a way for Xwayland to request all keyboard events to be forwarded to a surface even when the surface does not have keyboard focus. In the X11 protocol, a client may request an "active grab" on the keyboard. On success, all key events are reported only to the grabbing X11 client. The core Wayland protocol does not have a notion of an active keyboard grab. When running in Xwayland, X11 applications may acquire an active grab inside Xwayland but that cannot be translated to the Wayland compositor who may set the input focus to some other surface. In doing so, it breaks the X11 client assumption that all key events are reported to the grabbing client. https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/6170 Programs running in XWayland can only read keyboard input if another XWayland program is focused. For example, I have a keybind which automatically mutes my mic in Discord. The keybind does not function when the current focused app is not being displayed with XWayland. So, wayland apps are not allowed to get global keyboard input via compositor, unless you require some permission and/or directly get keyboard events from device, this is a security feature. What does it mean at practice? From Wayland point of view, the active window is the terminal one and it is alone application that should consume the typing keys. So, all "nested" applications should interact with terminal itself to get user input. In other words, the tty Xi module is attempt to break security model of the Wayland. Fortunately, Wayland have an "exceptional case" names XWayland and it means we have a backdoor to loot the keys without terminal window help. But as every workaround, it might have side effects... like one of in the ticket. Returning back to the theory, terminal + Far2l should work unless it both launched as XWayland clients, e.g. GDK backend should be enforced to X11 for both applications. |
@akruphi это бы документировать! Что под Вэйлендом отключается xi и включается --ee. А кому без xi не хватает работы нужных ему кнопок, пусть под kovidgoyal's kitty гоняют, она в свежих убунтах есть и теперь адекватной версии, ок работающей с фаром. |
Because far2l GUI work properly only under XWayland, may be add in main() at first start additional check and show information message? For example change:
to
If we decide that this information is necesary let's think up short correct text. |
Сейчас это частично и немного размазано есть в помощи в разделе @Far2lGettingStarted "FAR2L features - Getting Started" / "Особенности FAR2L - начало работы", но мне не нравится как получилось. Как подправить на более кратко и чётче не соображу. |
А что там ломается в GUI на Вэйленде? Я не смотрел ещё. Там-то нет хаков типа слушать весь ввод в системе |
Насколько я понял (в том числе из жалоб в тг-чате и нескольких issue тут) в GUI без XWayland ни клавиатура полноценно не работает, ни буфер обмена. Т.е. получается ограниченный функционал. Также как в нынешнем TTY|Xi без XWayland буфер обмена недоступен. Пока вчерне это описано в https://github.com/akruphi/far2l/wiki#wayland и более кратко в far2l help. Но я сам Wayland у себя отрубил - сижу довольный в x11 и пока проверять не тянет. К тому же, судя по отзывам, некоторые баги Wayland жутко бесившие на моей Ubuntu 22.04 уже в более свежих не проявляются (возможно пофикшены на стороне Wayland). |
Так так так, стопэ, у меня буфер обмена чудесно работает в ttyx без ttyxi, и он так может работать только через xwayland, потому что нативного модуля для клипборда через апи вэйленда пока нет |
В Ubuntu 23.10 на far2l-gui из PPA в GUI версии, запущенной в Wayland сессии, никаких тормозов ввода нет. Только что тщательно проверил дважды. |
It looks like keyboard event interception may work in Wayland under KWin in some future version. If there is a reliable way to determine KWin, we can add an appropriate condition (after this change is in the version used by default in Ubuntu LTS, probably?). |
Fix accepted to Ubuntu 24.04 updates and should be delivered to all users within 56 hours. |
Wayland security model does not allow and app to "listen" keystrokes that belong to other windows. So our x11 API-based input helpers are useless with XWayland. More of this, under Wayland ttyxi introduces severe input delay. Steps to reproduce it:
Still, ttyx module is helpful for clipboard access. So we should disable ttyx[i] input processing under Wayland automatically, but still use x11 clipboard API.
See also:
#2040
The text was updated successfully, but these errors were encountered: