- Updated files to no longer use device id's for mac or windows keyboards, only chromebooks will make use of device id's for external keyboards. Closes #5

This commit is contained in:
Ben Reaves
2019-08-09 17:43:54 -05:00
parent 2d27c18529
commit 1bb36cb1b6
2 changed files with 47 additions and 48 deletions

View File

@@ -25,6 +25,9 @@ def keyboard_detect():
global internalid, usbid, chromeswap, system_type global internalid, usbid, chromeswap, system_type
internal_kbname = "" internal_kbname = ""
usb_kbname = "" usb_kbname = ""
# If chromebook
if system_type == "2":
print() print()
print("Looking for keyboards...") print("Looking for keyboards...")
print() print()
@@ -42,7 +45,7 @@ def keyboard_detect():
usbid = "" usbid = ""
usbcount=0 usbcount=0
while usbid == "": while usbid == "":
usbid = subprocess.check_output('udevadm info -e | stdbuf -oL grep -o -P "(?<=event-kbd /dev/input/by-path/pci-0000:00:).*(?=.0-usb)";exit 0', shell=True).decode('utf-8') usbid = subprocess.check_output('udevadm info -e | stdbuf -oL grep -o -P "(?<=event-kbd /dev/input/by-path/pci-0000:00:).*(?=.0-usb) | head -n 1";exit 0', shell=True).decode('utf-8')
if usbid == "": if usbid == "":
usbcount += 1 usbcount += 1
# print('usbid not found '+ str(usbcount)) # print('usbid not found '+ str(usbcount))
@@ -120,7 +123,7 @@ sys.stdout.write(reset)
print() print()
input("Press Enter to begin...") input("Press Enter to begin...")
system_type = input("\nWhat type of system are you using?\n\ system_type = input("\nWhat type of keyboard are you using? (If Mac and Windows then select Mac)\n\
1) Windows\n\ 1) Windows\n\
2) Chromebook\n\ 2) Chromebook\n\
3) Mac\n") 3) Mac\n")

View File

@@ -53,7 +53,6 @@ while read -r id; do
if [ $timediff -gt 0 ]; then if [ $timediff -gt 0 ]; then
if [ -n "$class" ]; then if [ -n "$class" ]; then
# Set keymap for terminal, Alt is Super, Ctrl is Ctrl, Super is Alt # Set keymap for terminal, Alt is Super, Ctrl is Ctrl, Super is Alt
if [[ $internalid -gt 0 ]]; then
eval "$check_gt" eval "$check_gt"
echo $? echo $?
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@@ -68,10 +67,8 @@ while read -r id; do
check_tg="setxkbmap -query | grep -v 'ctrl_alt_win' 1>/dev/null" check_tg="setxkbmap -query | grep -v 'ctrl_alt_win' 1>/dev/null"
fi fi
fi fi
fi
else else
# Set keymap for gui, Alt is Ctrl,Super is Alt, Ctrl is Super # Set keymap for gui, Alt is Ctrl,Super is Alt, Ctrl is Super
if [[ $internalid -gt 0 ]]; then
eval "$check_tg" eval "$check_tg"
echo $? echo $?
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
@@ -84,7 +81,6 @@ while read -r id; do
fi fi
fi fi
fi fi
fi
timestp=$(date +%s) timestp=$(date +%s)
fi fi
done done