#!/bin/bash
set -x
input_list=$(dbus-send --session --print-reply --dest=com.kylin.Wlcom /org/kde/KWin/InputDevice org.freedesktop.DBus.Properties.Get string:org.kde.KWin.InputDeviceManager string:devicesSysNames)
for i in  $input_list
do
#  echo $i
  if [[ $i =~ event* ]];then
#    echo $i is event
    event=$(echo $i | cut -f 2 -d '"')
    if dbus-send --session --print-reply --dest=com.kylin.Wlcom /org/kde/KWin/InputDevice/$event org.freedesktop.DBus.Properties.Get string:org.kde.KWin.InputDevice string:touchpad|grep "boolean true" ;then
#      echo $i is touchpad
      dbus-send --session --print-reply --dest=com.kylin.Wlcom /org/kde/KWin/InputDevice/$event org.freedesktop.DBus.Properties.Set string:org.kde.KWin.InputDevice string:tapToClick variant:boolean:true
    fi
  fi
done

