From 541e28595f6c667259a8f9f2a6a47e02a7b016fe Mon Sep 17 00:00:00 2001 From: David JULIEN Date: Fri, 4 Nov 2022 10:06:07 +0100 Subject: [PATCH] [scripts] feat: automatic cursor setup --- .local/bin/cursor_setup | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100755 .local/bin/cursor_setup diff --git a/.local/bin/cursor_setup b/.local/bin/cursor_setup new file mode 100755 index 0000000..13b5e81 --- /dev/null +++ b/.local/bin/cursor_setup @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +###################################################################### +# @author : swytch (adapted from Luke Smith - lukesmith.xyz) +# @file : cursor_setup +# @license : GPLv3 +# @created : Friday Nov 04, 2022 10:02:12 CET +# +# @description : handles cursor setup in cas `xinput` lists the same +# device several times +###################################################################### + + +if [ "$1" = "" ]; then + exit 1 +fi + +ids=$(xinput --list | awk -v search="$1" \ + '$0 ~ search {match($0, /id=[0-9]+/);\ + if (RSTART) \ + print substr($0, RSTART+3, RLENGTH-3)\ + }'\ + ) + +for i in $ids +do + [ "trackpad" = "$2" ] && xinput set-prop $i 'libinput Tapping Enabled' 1 & + xinput set-prop $i 'libinput Natural Scrolling Enabled' 1 & + xinput set-prop $i 'libinput Accel Speed' 0.4 & +done +