How could one check whether the SHIFT key is currently being held while in the Linux console? By the Linux console I mean the real text/framebuffer one, not an xterm.
Preferably with only the built-in/standard shell commands, if possible.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no command that I know of that gets the shift state of the keyboard. That said, looking at
console_ioctl(4), there is aioctlrequest for that:TIOCLINUX, subcode=6.So you could write a simple C program:
The result can be interpreted in accordance to
/usr/src/linux/include/linux/keyboard.h:The above is a shift amount, so Shift is 1, AltGr is 2, Ctrl is 4, and so on.