#terminal input delay

1 messages · Page 1 of 1 (latest)

hidden crater
#

How to eliminate delay after holding a key in terminal in raw mode ? I mean when you press for example 'i' and hold it, then a little delay occurs and only after a half a second it prints 'iiiiii'. Do I have to directly read from input device file on linux or it is completely not possible to eliminate that ?

#

Second of all how to get multiple ket strokes ? When i press two keys at once then it only get one of these two. It's not even queue these keys.

hallow crag
hallow crag
hidden crater
#

so these two keys can be described in one slice that is returned from read() function ?

#

cause now i read it take one key and discard the rest

hallow crag
hallow crag
hidden crater
static quest
#

terminal emulators don't provide the functionality to get key up events - the display server has nothing to do with it

hallow crag
#

What you get in stdin is exactly what the terminal gets from the display manager
If you want more fine tuned controls you can access the keyboard state directly with libudev or x11 or whatever
But thats generally not something tui apps should do imo

static quest
#

do you mean when there is a fullscreen terminal at boot? most of the time you use a terminal through a terminal emulator which is receiving events from x or wayland

hallow crag
static quest
#

the terminal emulator decides what to send to your program's stdin

hallow crag
static quest
#

x and wayland both provide key up events, the terminal emulator just doesn't pass them on to your program

hallow crag
#

yeah
I agree with you i think theres just a misunderstanding
Dw about it

hidden crater
#

thanks

hallow crag
#

if you really need this, using x11 apis isnt a bad choice
Just be careful ig
Since there isnt really an appropriate alternative on wayland since you cant get input events without a window you create being focused