Off-Topic > Off-Topic - Tiny Core Lounge
how to automatically get xinput id of keyboard?
Rich:
Hi GNUser
Those master and slave messages in the square brackets at the end of each line are creating a lot of unnecessary noise:
--- Code: ---tc@box:~$ xinput --list
â¡ Virtual core pointer id=2 [master pointer (3)]
â â³ Virtual core XTEST pointer id=4 [slave pointer (2)]
â â³ Mouse0 id=7 [slave pointer (2)]
⣠Virtual core keyboard id=3 [master keyboard (2)]
â³ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
â³ Keyboard0 id=6 [slave keyboard (3)]
tc@box:~$
--- End code ---
Time to cut them out:
--- Code: ---tc@box:~$ xinput --list | cut -d\[ -f1
â¡ Virtual core pointer id=2
â â³ Virtual core XTEST pointer id=4
â â³ Mouse0 id=7
⣠Virtual core keyboard id=3
â³ Virtual core XTEST keyboard id=5
â³ Keyboard0 id=6
tc@box:~$
--- End code ---
The -d\[ sets the field delimiter to [ and the -f1 says to output field number 1 (everything before the left square bracket).
Try this:
--- Code: ---tc@box:~$ LANG=C xinput --list | cut -d\[ -f1 | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
6
tc@box:~$
--- End code ---
Rich:
Hi GNUser
Here's a brief writeup that provides some insight to the various devices listed by xinput:
https://www.linux.org/threads/cool-tricks-with-xinput-device.10345/
GNUser:
Thank you very much, Rich. Your last suggestion worked on all systems I tested, even on wife's Vaio:
--- Code: ---eileen@vaio:~$ LANG=C xinput --list | cut -d\[ -f1 | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
12
--- End code ---
Cutting out the slave/master column at far right was key. Very nice. Thank you.
I will look over the link and educate myself.
xor:
--- Quote from: GNUser on September 14, 2019, 07:25:54 PM ---Thank you very much, Rich. Your last suggestion worked on all systems I tested, even on wife's Vaio:
--- Code: ---eileen@vaio:~$ LANG=C xinput --list | cut -d\[ -f1 | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
12
--- End code ---
Cutting out the slave/master column at far right was key. Very nice. Thank you.
I will look over the link and educate myself.
--- End quote ---
Thanks to this feature; It is nice to have the KMAPS setting of languages other than English set automatically :)
will this be standard in the next TCL version in particular!?
xor:
--- Quote from: GNUser on September 14, 2019, 07:25:54 PM ---Thank you very much, Rich. Your last suggestion worked on all systems I tested, even on wife's Vaio:
--- Code: ---eileen@vaio:~$ LANG=C xinput --list | cut -d\[ -f1 | grep -i keyboard | egrep -iv 'virtual|video|button|bus' | egrep -o 'id=[0-9]+' | egrep -o '[0-9]+'
12
--- End code ---
Cutting out the slave/master column at far right was key. Very nice. Thank you.
I will look over the link and educate myself.
--- End quote ---
for non-English keyboards,
(automatic keyboard recognition feature),
Will there be a new standard feature for TCL !?
I want this feature to be a standard feature.
In my country "Q" keyboard and "F" keyboard are used equally.
automatically localized keyboard settings,
Provides a universal convenience for all local regions! :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version