Detect meta (special) keys (Ctrl, Shift, Alt, Tab, Esc, Backspace) from Shell Input

前端 未结 2 1701
遇见更好的自我
遇见更好的自我 2021-01-13 10:31

I want to know if anybody knows how to detect meta (special) keys (Ctrl, Shift, Alt, Tab, Esc, Backspace)

2条回答
  •  不思量自难忘°
    2021-01-13 10:56

    In general, you cannot do it. That said:

    • X11 sends KeyPress and KeyRelease events.
    • The Linux console provides a set of ioctls that allow low-level access to the keyboard, documented at console_ioctl(4). You would set the keyboard to RAW or MEDIUMRAW mode (don't confuse these modes with termios' raw mode, they are not related at all).

提交回复
热议问题