From 3cd2a690fb007cc61b695fae131c31e14eeef062 Mon Sep 17 00:00:00 2001 From: Saumit Dinesan Date: Wed, 25 May 2022 20:51:06 +0530 Subject: better approach --- .scripts/kbesccaps | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to '.scripts/kbesccaps') diff --git a/.scripts/kbesccaps b/.scripts/kbesccaps index d4978d6..b6b187c 100755 --- a/.scripts/kbesccaps +++ b/.scripts/kbesccaps @@ -4,7 +4,15 @@ ##whenever I plug in any of my keyboard (wired or wireless) #PreRequisite lsusb/usbutils -[ -z "command -v lsusb" ] && echo "Install usbutils" && exit +[ -z "$(command -v lsusb)" ] && echo "Install usbutils" && exit + +#for cronjob +export DISPLAY=:0 + +#If setxkbmap query string is of zero length +#then setxkbmap set caps lock as esc key +[[ -z "$(setxkbmap -query | grep "caps:escape")" ]] && setxkbmap -option caps:escape + +#[ -n "$(lsusb | grep -e 04f3:152e -e 25a7:fa67)" ] && setxkbmap -option caps:escape || exit -[[ 'lsusb | grep -e 04f3:152e -e 25a7:fa67' ]] && setxkbmap -option caps:escape -- cgit v1.2.3