textual icon indicating copy to clipboard operation
textual copied to clipboard

Mouse input in the Linux console

Open devzero0 opened this issue 3 years ago • 5 comments

First off, amazing library and thanks for creating this.

Have you checked closed issues? https://github.com/Textualize/textual/issues?q=is%3Aissue+is%3Aclosed Yes

Please give a brief but clear explanation of the issue. Can Textual handle mouse input in the Linux console, i.e. without X Windows? I tried using gpm but mouse input is ignored.

What Operating System are you running on? Debian Bullseye 32-bit (Raspbian) on a Raspberry Pi 4

Feel free to add screenshots and/or videos. These can be very helpful!

If you can, include a complete working example that demonstrates the bug. Check it can run without modifications. I'm testing with the sample app python -m textual

devzero0 avatar Jan 02 '23 20:01 devzero0

We found the following entry in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

github-actions[bot] avatar Jan 02 '23 20:01 github-actions[bot]

Glad you like Textual.

It should be possible to make Textual work under the Linux console. It may be that gpm uses a different escape mechanism for mouse coords.

We will look in to it!

willmcgugan avatar Jan 04 '23 13:01 willmcgugan

BTW I stumbled upon a workaround by using LCXterm which, among other things, converts GPM mouse events into the X10 mouse protocol.

devzero0 avatar Jan 04 '23 16:01 devzero0

From what I've been able to find gpm does not provide mouse events via escape codes at all, but rather requires applications to explicitly connect to the gpm daemon via a unix domain socket and read the mouse events from there.

See

  • info gpm -n 'Gpm Internals' and/or http://www.fifi.org/cgi-bin/info2www?(gpm)Gpm+Internals
  • https://github.com/telmich/gpm/issues/29

trav-c avatar Jul 01 '23 10:07 trav-c

+1, this would be a great feature for certain embedded use cases where there is a touch screen available and no exposed ports for a keyboard. For example to make a configuration/management/diagnostic tool that runs before the proper gui can be loaded.

ExperimentalCyborg avatar Apr 05 '25 18:04 ExperimentalCyborg