From 17542f36d4046eac2b7acf92df04ec77a462e63a Mon Sep 17 00:00:00 2001 From: Gardouille Date: Mon, 1 Feb 2021 15:16:35 +0100 Subject: [PATCH] Manage Dell laptop keymap --- keyboard.sh | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/keyboard.sh b/keyboard.sh index 743b57b..b160927 100755 --- a/keyboard.sh +++ b/keyboard.sh @@ -1,9 +1,7 @@ #!/bin/sh -# Manage keyboard disposition if TypeMatrix keyboard is available. - +# Manage keyboard disposition for TypeMatrix if keyboard is available. TM_ID="1e54:2030" - TM_AVAILABLE=$(lsusb | grep -i -- "$TM_ID") if [ "${TM_AVAILABLE}" ]; then @@ -11,6 +9,24 @@ if [ "${TM_AVAILABLE}" ]; then && exit 0 fi -setxkbmap -model latitude -layout fr -variant bepo +# Manage keyboard disposition for Dell if it's a Dell +IS_DELL=$(lsusb | grep -i -- "dell") +IS_LAPTOP=$(grep -qE "^10" /sys/devices/virtual/dmi/id/chassis_type) +if [ "${IS_DELL}" ]; then + # Manage keyboard disposition for Dell laptop if it's a laptop + if [ "${IS_LAPTOP}" ]; then + setxkbmap -model latitude -layout fr -variant bepo \ + && exit 0 + else + # Default Dell map to pc104 and bepo + setxkbmap -model pc104 -layout fr -variant bepo \ + && exit 0 + fi +else + # Default map to pc104 and bepo + setxkbmap -model pc104 -layout fr -variant bepo \ + && exit 0 +fi -exit 0 + +exit 255