Help with touchpad configuration on laptops lxde lxqt xfce

These are my frequently used desktops on laptops, but I always find the drawback
that there is no default software to help us with the touchpad configuration, beyond enable, disable.
I have used this program without problems on lxde, lxqt and xfce desktops (other desktops have default settings)

  • the program requires packages: xinput (xorg-xinput), zenity, xmessage (optionally).
  • the program is designed not to run completely if these packages are missing from the computer, xmessage (optionally).
  • the program detects the desktops: lxde, lxqt, xfce and sends input to the program settings window to the menu, configures the autorun when starting session.
  1. to completely clean the program files run: rm ~/.config/autostart/xinput-touchpad-estado-al-inicio.desktop
  2. to completely clean the program files run: rm ~/.local/share/applications/xin-touchpad-conf.desktop

it is very easy to manually translate the program by any user, (feel free to do it if necessary)

  • the program can be given any name, it should be able to run without any problems. (in my case: xin-touchpad.sh)

  • the program has three ways of being called:
    xin-touchpad.sh --conf (launch the settings window)
    xin-touchpad.sh --auto (load the configuration at login)
    xin-touchpad.sh (switch state on > off and off > on, assign a keyboard shortcut to run the program)

My language is Spanish, so it is very likely that my English and Russian translations are wrong.

#!/usr/bin/bash
#dependencias: xinput -o xorg-xinput, xmessage, zenity
#configurcion rapida
dispositivo='Device'
atras='Back'
estado_al_inicio='Status en startup'
estado1='Enabled'
estado0='Disabled'
mas_opciones='More options'
columna_opciones='Options'
mas_ajustes='More settings'
velocidad='Speed'
abrir_hoja_datos='Open data sheet'
metodo_desplazamiento='Displacement method'
metodo_desplazamiento1='two fingers'
metodo_desplazamiento2='edge'
metodo_desplazamiento3='button'
desplazamiento_natural='Natural displacement'
desplazamiento_horizontal='Horizontal displacement'
click_al_tocar='Click when touch'
desactivado_al_escribir='Off when typing'
si='YES'
no='NO'
modo_zurdo_para='Left handed mode for'
refrescar='Refresh'
salir='Leave'
aceptar='Agree'
dispositivo_vacio='empty device'
timeout='0.8s'

#TRADUCIR CON CUIDADO
xin_touchpad_conf='xin touchpad conf'
conf='--conf'
xin_touchpad_auto='xin touchpad auto'
auto_start='--auto'

#modo auto inicio aplica la configuracion en bucle para todos los dispositivos listados
#siempre imprimir en hoja con linea blanca de seguridad hacia arriba"
znt=$(which 'zenity')
xin=$(which 'xinput')
if [[ "$znt" != '' ]] ; then
	v1=+1
else
	v1=+0
fi
if [[ "$xin" != '' ]] ; then
	v2=+1
else
	v2=+0
fi

if [ $(($v1 $v2)) == 2 ] ; then

demo=\
"$estado_al_inicio:$estado1
$velocidad:0.40
$metodo_desplazamiento:$metodo_desplazamiento1
$click_al_tocar:$si
$desactivado_al_escribir:$si
$desplazamiento_horizontal:$si
$desplazamiento_natural:$si"

ruta=$(dirname "$0")/.xin-conf.txt
	if [ ! -e "$ruta" ] ; then
		touch "$ruta"
#DESEKTOP ENTRY > menu
		escritorio=$(echo $XDG_CURRENT_DESKTOP)
		ok=$(grep -io "lxde\|lxqt\|xfce" <<< $escritorio)
		if [[ "$ok" != '' ]] ; then
			ok=1
		fi
		if [[ "$ok" == 1 ]] ; then
		echo "escritorio $escritorio detectado"
		RUTA_ARCHIVO_desktop_entry=~/.local/share/applications/xin-touchpad-conf.desktop
		TEXTO_desktop_entry=\
"[Desktop Entry]
Exec=\"$(readlink -f "$0")\" $conf
Type=Application
Name=$xin_touchpad_conf
Terminal=false
Icon=
Categories=Settings;
StartupNotify=true" # Exec=si se usa rutas cortas del tipo ~/ la accion personalizada no se ejecuta correctamente. desactivar: NotShowIn=LXDE;
			if [ ! -e "${RUTA_ARCHIVO_desktop_entry%/*}" ] ; then
				mkdir -p "${RUTA_ARCHIVO_desktop_entry%/*}"
			fi
			if [[ "$TEXTO_desktop_entry" != "$(cat "$RUTA_ARCHIVO_desktop_entry")" ]] ; then
				cat <<< "$TEXTO_desktop_entry" > $RUTA_ARCHIVO_desktop_entry
			fi
		else
			cat <<< "$TEXTO_desktop_entry" > "$(dirname "$0")/xin-touchpad-conf.desktop"
		fi

#DESEKTOP ENTRY > menu
		escritorio=$(echo $XDG_CURRENT_DESKTOP)
		ok=$(grep -io "lxde\|lxqt\|xfce" <<< $escritorio)
		if [[ "$ok" != '' ]] ; then
			ok=1
		fi
		if [[ "$ok" == 1 ]] ; then
		echo "escritorio $escritorio detectado"
		RUTA_ARCHIVO_desktop_entry=~/.config/autostart/xinput-touchpad-estado-al-inicio.desktop
		TEXTO_desktop_entry=\
"[Desktop Entry]
Exec=\"$(readlink -f "$0")\" $auto_start
Name=$xin_touchpad_auto
Type=Application
Version=1.0" # Exec=si se usa rutas cortas del tipo ~/ la accion personalizada no se ejecuta correctamente. desactivar: NotShowIn=LXDE;
		if [ ! -e "${RUTA_ARCHIVO_desktop_entry%/*}" ] ; then
				mkdir -p "${RUTA_ARCHIVO_desktop_entry%/*}"
			fi
			if [[ "$TEXTO_desktop_entry" != "$(cat "$RUTA_ARCHIVO_desktop_entry")" ]] ; then
				cat <<< "$TEXTO_desktop_entry" > $RUTA_ARCHIVO_desktop_entry
			fi
		else
			cat <<< "$TEXTO_desktop_entry" > "$(dirname "$0")/xin-touchpad-auto.desktop"
		fi
	fi

	if [ $(wc -w < "$ruta") == 0 ] ; then
		cat <<< "$demo" > "$ruta" # el achivo no se escribe si no existe primero (touch)
	fi

	if [[ "$0 $1" == "$0 $conf" ]] ; then
#motor
	prm=true
	while $prm ; do

		dat=$(cat "$ruta")
		dat_clean=$(grep -v "^$" <<< $dat)
		if [[ "$dat" != "$dat_clean" ]] ; then
			cat <<< "$dat_clean" > "$ruta"
		fi
		dat="$dat_clean"

		ls_disp=$(xinput list --name-only | tr '\n' '|' | sed 's/|$//g')
		ls_disp_dat=$(grep "^$dispositivo:" <<< $dat | sed 's/^'"$dispositivo"'://g')

		out=$(zenity --forms --separator=$'\n' --extra-button="$refrescar" --cancel-label="$salir" --ok-label="$aceptar" --add-combo="$estado_al_inicio" --combo-values="|$estado1|$estado0" --add-combo="$dispositivo" --combo-values="|$ls_disp" --add-combo="$modo_zurdo_para" --combo-values="|$ls_disp" --add-combo="$mas_opciones" --combo-values="|$mas_ajustes|$velocidad|$abrir_hoja_datos" --text=\
"$dat")
		res=$?

		if [ $res == 0 ] ; then
			est=$(sed -n 1p <<< $out)
			dsp=$(sed -n 2p <<< $out)
			mdz=$(sed -n 3p <<< $out)
			mop=$(sed -n 4p <<< $out)
			if [ $(wc -w <<< $est) != 0 ] ; then
				if [[ "$est" == "$estado1" ]] ; then
					sed -i "s/^$estado_al_inicio:.*/$estado_al_inicio:$est/g" "$ruta"
				elif [[ "$est" == "$estado0" ]] ; then
					sed -i "s/^$estado_al_inicio:.*/$estado_al_inicio:$est/g" "$ruta"
				fi
			fi
			if [ $(wc -w <<< $dsp) != 0 ] ; then
				disp_dat=$(grep "^$dispositivo" <<< $dat)
				name=$(sed 's/.*://g' <<< $disp_dat)
				if [[ "$dsp" == "$name" ]] ; then
					sed -i '/^'"$dispositivo"'.*/d' "$ruta"
				else
					sed -i '/^'"$dispositivo"'.*/d' "$ruta"
					if [ $(tail -n1 < "$ruta" | wc -w) == 0 ] ; then
						cat <<< \
"$dispositivo:$dsp" >> "$ruta"
					else
						cat <<< \
"
$dispositivo:$dsp" >> "$ruta"
					fi
				fi
			fi
			if [ $(wc -w <<< $mdz) != 0 ] ; then
				disp_dat=$(grep "^$modo_zurdo_para:$mdz" <<< $dat)
				est_act=$(sed 's/.* > //g' <<< $disp_dat)
				code_x=$(xinput list-props "$mdz" | grep "libinput Left Handed Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				#mdz2=$(sed 's/[[:punct:]]/./g' <<< $mdz)
				if [[ "$disp_dat" == "" ]] ; then
					xinput set-prop "$mdz" "$code_x" 1
					if [ $(tail -n1 < "$ruta" | wc -w) == 0 ] ; then
						cat <<< \
"$modo_zurdo_para:$mdz" >> "$ruta"
					else
						cat <<< \
"
$modo_zurdo_para:$mdz" >> "$ruta"
					fi
				else
					xinput set-prop "$mdz" "$code_x" 0
					sed -i "/^$modo_zurdo_para.*/d" "$ruta"
				fi
			fi
			if [ $(wc -w <<< $mop) != 0 ] ; then
				if [[ "$mop" == "$mas_ajustes" ]] ; then
#bucle 2
					prm2=true
					while $prm2 ; do

						dat=$(cat "$ruta")
						ls_disp_dat=$(grep "^$dispositivo:" <<< $dat | sed 's/^'"$dispositivo"'://g')
						act_vl=$(grep "^$velocidad" <<< $dat | grep -o "[0-9]\.[0-9]*")
						act_md=$(grep "^$metodo_desplazamiento:" <<< $dat | sed "s/^$metodo_desplazamiento://g")
						act_dn=$(grep "^$desplazamiento_natural:" <<< $dat | sed "s/^$desplazamiento_natural://g")
						act_dh=$(grep "^$desplazamiento_horizontal:" <<< $dat | sed "s/^$desplazamiento_horizontal://g")
						act_ct=$(grep "^$click_al_tocar:" <<< $dat | sed "s/^$click_al_tocar://g")
						act_de=$(grep "^$desactivado_al_escribir:" <<< $dat | sed "s/^$desactivado_al_escribir://g")
#aplicar cambios nivel sistema
#metodo desp
						if [[ "$act_md" == "$metodo_desplazamiento1" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 1, 0, 0
						elif [[ "$act_md" == "$metodo_desplazamiento2" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0, 1, 0
						elif [[ "$act_md" == "$metodo_desplazamiento3" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0, 0, 1
						fi
#velocidad
						if [[ "$act_vl" == "" ]] ; then
							act_vl=0.40
						fi
						accel_speed=$(xinput list-props "$ls_disp_dat" | grep "libinput Accel Speed (" | grep -o "([0-9]*" | sed 's/^(//g')
						xinput set-prop "$ls_disp_dat" "$accel_speed" $act_vl
					#desp natural
						if [[ "$act_dn" == "$si" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 1
						elif [[ "$act_dn" == "$no" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0
						fi
					#desp horizontal
						if [[ "$act_dh" == "$si" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 1
						elif [[ "$act_dh" == "$no" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0
						fi
					#click al tocar
						if [[ "$act_ct" == "$si" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 1
						elif [[ "$act_ct" == "$no" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0
						fi
					#desac al escribir
						if [[ "$act_de" == "$si" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 1
						elif [[ "$act_de" == "$no" ]] ; then
							code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$code_x" 0
						fi

						out2=$(zenity --cancel-label="$atras" --ok-label="$aceptar" --list --width=600 --height=250 --column="$columna_opciones" "$metodo_desplazamiento > $act_md" "$desplazamiento_natural > $act_dn" "$desplazamiento_horizontal > $act_dh" "$click_al_tocar > $act_ct" "$desactivado_al_escribir > $act_de")
						if [ $? == 0 ] ; then
							out2_a=$(sed 's/ > .*$//g' <<< $out2)
							if [[ "$out2_a" == "$metodo_desplazamiento" ]] ; then
			#modo desplazamiento
								md1=$(grep "^$metodo_desplazamiento:$metodo_desplazamiento1" <<< "$dat")
								md2=$(grep "^$metodo_desplazamiento:$metodo_desplazamiento2" <<< "$dat")
								md3=$(grep "^$metodo_desplazamiento:$metodo_desplazamiento3" <<< "$dat")
								md=$(
									if [[ "$md1" != '' ]] ; then
										cat <<< \
"TRUE
$metodo_desplazamiento1"
									else
										cat <<< \
"FALSE
$metodo_desplazamiento1"
									fi
									if [[ "$md2" != '' ]] ; then
										cat <<< \
"TRUE
$metodo_desplazamiento2"
									else
										cat <<< \
"FALSE
$metodo_desplazamiento2"
									fi
									if [[ "$md3" != '' ]] ; then
										cat <<< \
"TRUE
$metodo_desplazamiento3"
									else
										cat <<< \
"FALSE
$metodo_desplazamiento3"
									fi
								)

								out3=$(IFS=$'\n' ; zenity --cancel-label="$atras" --ok-label="$aceptar" --list --radiolist --column='X' --column="$metodo_desplazamiento" $md)
								res3=$?
								if [ $res3 == 0 ] ; then
									xinput --enable "$ls_disp_dat"
									if [[ "$out3" == "$metodo_desplazamiento1" ]] ; then
										sed -i "s/^$metodo_desplazamiento:.*/$metodo_desplazamiento:$out3/g" "$ruta"
									elif [[ "$out3" == "$metodo_desplazamiento2" ]] ; then
										sed -i "s/^$metodo_desplazamiento:.*/$metodo_desplazamiento:$out3/g" "$ruta"
									elif [[ "$out3" == "$metodo_desplazamiento3" ]] ; then
										sed -i "s/^$metodo_desplazamiento:.*/$metodo_desplazamiento:$out3/g" "$ruta"
									fi
								elif [ $? == 1 ] ; then
									prm3=false
								fi
			#desp natural
							elif [[ "$out2_a" == "$desplazamiento_natural" ]] ; then
								xinput --enable "$ls_disp_dat"
								if [[ "$act_dn" == "$si" ]] ; then
									sed -i "s/^$desplazamiento_natural:.*/$desplazamiento_natural:$no/g" "$ruta"
								elif [[ "$act_dn" == "$no" ]] ; then
									sed -i "s/^$desplazamiento_natural:.*/$desplazamiento_natural:$si/g" "$ruta"
								fi
			#desp horizontal
							elif [[ "$out2_a" == "$desplazamiento_horizontal" ]] ; then
								xinput --enable "$ls_disp_dat"
								if [[ "$act_dh" == "$si" ]] ; then
									sed -i "s/^$desplazamiento_horizontal:.*/$desplazamiento_horizontal:$no/g" "$ruta"
								elif [[ "$act_dh" == "$no" ]] ; then
									sed -i "s/^$desplazamiento_horizontal:.*/$desplazamiento_horizontal:$si/g" "$ruta"
								fi
			#click al tocar
							elif [[ "$out2_a" == "$click_al_tocar" ]] ; then
								xinput --enable "$ls_disp_dat"
								if [[ "$act_ct" == "$si" ]] ; then
									sed -i "s/^$click_al_tocar:.*/$click_al_tocar:$no/g" "$ruta"
								elif [[ "$act_ct" == "$no" ]] ; then
									sed -i "s/^$click_al_tocar:.*/$click_al_tocar:$si/g" "$ruta"
								fi
			#desac mientras escribe
							elif [[ "$out2_a" == "$desactivado_al_escribir" ]] ; then
								xinput --enable "$ls_disp_dat"
								if [[ "$act_de" == "$si" ]] ; then
									sed -i "s/^$desactivado_al_escribir:.*/$desactivado_al_escribir:$no/g" "$ruta"
								elif [[ "$act_de" == "$no" ]] ; then
									sed -i "s/^$desactivado_al_escribir:.*/$desactivado_al_escribir:$si/g" "$ruta"
								fi
							fi
						elif [ $? == 1 ] ; then
							prm2=false
						fi
					done #bulce 2
				elif [[ "$mop" == "$velocidad" ]] ; then
#bucle 4
					prm4=true
					while $prm4 ; do

						dat=$(cat "$ruta")

						vel=$(grep "^$velocidad" <<< $dat | grep -o "[0-9]\.[0-9]*")
						if [[ "$vel" == "" ]] ; then
							vel=0
						else
							vel=$(
								if [[ "$vel" == '1.00' ]] ; then
									cat <<< "100"
								else
									global=$(grep -o "[0-9]" <<< $vel)
									n1=$(sed -n 1p <<< $global)
									n2=$(sed -n 2p <<< $global)
									n3=$(sed -n 3p <<< $global)
									cat <<< "$n2$n3"
								fi)
						fi
						out_vel=$(zenity --scale --step='10' --cancel-label="$atras" --ok-label="$aceptar" --value="$vel")
						res2=$?
						if [ $res2 == 0 ] ; then
							out_vel2=$(
								if [ $out_vel == 100 ] ; then
									cat <<< "1.00"
								else
									cat <<< "0.$out_vel"
								fi)

							xinput --enable "$ls_disp_dat"
							sed -i "s/^$estado_al_inicio.*/$estado_al_inicio:$estado1/g" "$ruta"
							accel_speed=$(xinput list-props "$ls_disp_dat" | grep "libinput Accel Speed (" | grep -o "([0-9]*" | sed 's/^(//g')
							xinput set-prop "$ls_disp_dat" "$accel_speed" "$out_vel2"
							sed -i "s/^$velocidad:.*/$velocidad:$out_vel2/g" "$ruta"
							#timeout 0.8s xmessage -center -bg green "$estado1"
						elif [ $res2 == 1 ] ; then
							prm4=false
						fi
					done #bucle
				elif [[ "$mop" == "$abrir_hoja_datos" ]] ; then
					xdg-open "$ruta"
				fi
			fi
		elif [[ "$out" == "$refrescar" ]] ; then
			echo "$refrescar"
		elif [ $res == 1 ] ; then
			prm=false
		fi

	done #bucle
######################################################## auto start
	elif [[ "$0 $1" == "$0 $auto_start" ]] ; then
		echo 'auto start'
		dat=$(cat "$ruta")
		ls_disp_dat=$(grep "^$dispositivo:" <<< $dat | sed 's/^'"$dispositivo"'://g')

		if [[ "$ls_disp_dat" == "" ]] ; then
			echo "$dispositivo_vacio"
		else
		act_vl=$(grep "^$velocidad" <<< $dat | grep -o "[0-9]\.[0-9]*")
		act_ei=$(grep "^$estado_al_inicio" <<< $dat | sed "s/$estado_al_inicio://g")
		act_md=$(grep "^$metodo_desplazamiento" <<< $dat | sed "s/$metodo_desplazamiento://g")
		act_dn=$(grep "^$desplazamiento_natural" <<< $dat | sed "s/$desplazamiento_natural://g")
		act_dh=$(grep "^$desplazamiento_horizontal" <<< $dat | sed "s/$desplazamiento_horizontal://g")
		act_ct=$(grep "^$click_al_tocar" <<< $dat | sed "s/$click_al_tocar://g")
		act_de=$(grep "^$desactivado_al_escribir" <<< $dat | sed "s/$desactivado_al_escribir://g")
	#estado
		if [[ "$act_ei" == "$estado1" ]] ; then
			xinput --enable "$ls_disp_dat"
		elif [[ "$act_ei" == "$estado0" ]] ; then
			xinput --disable "$ls_disp_dat"
		fi
	#metodo desp
		if [[ "$act_md" == "$metodo_desplazamiento1" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 1, 0, 0
		elif [[ "$act_md" == "$metodo_desplazamiento2" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0, 1, 0
		elif [[ "$act_md" == "$metodo_desplazamiento3" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0, 0, 1
		fi
	#velocidad
		if [[ "$act_vl" == "" ]] ; then
			act_vl=0.40
		fi
		accel_speed=$(xinput list-props "$ls_disp_dat" | grep "libinput Accel Speed (" | grep -o "([0-9]*" | sed 's/^(//g')
		xinput set-prop "$ls_disp_dat" "$accel_speed" $act_vl
	#desp natural
		if [[ "$act_dn" == "$si" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 1
		elif [[ "$act_dn" == "$no" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0
		fi
	#desp horizontal
		if [[ "$act_dh" == "$si" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 1
		elif [[ "$act_dh" == "$no" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0
		fi
	#click al tocar
		if [[ "$act_ct" == "$si" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 1
		elif [[ "$act_ct" == "$no" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0
		fi
	#desac al escribir
		if [[ "$act_de" == "$si" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 1
		elif [[ "$act_de" == "$no" ]] ; then
			code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$code_x" 0
		fi
		fi #puerta dispositivo vacio

	######################################################## toggle
	elif [[ "$0" == "$0" ]] ; then
		dat=$(cat "$ruta")
		ls_disp_dat=$(grep "^$dispositivo:" <<< $dat | sed 's/^'"$dispositivo"'://g')
		if [[ "$ls_disp_dat" == "" ]] ; then
			echo "$dispositivo_vacio"
		else
			if [[ "$timeout" == "" ]] ; then
				timeout='0.8s'
			fi
			act_est=$(xinput list-props "$ls_disp_dat" | grep "Device Enabled (" | awk '{print $NF}')
		#estado
			if [ $act_est == 0 ] ; then
				xinput --enable "$ls_disp_dat"
				timeout "$timeout" xmessage -center -bg green "$estado1"

		#parametros
			act_vl=$(grep "^$velocidad" <<< $dat | grep -o "[0-9]\.[0-9]*")
			act_ei=$(grep "^$estado_al_inicio" <<< $dat | sed "s/$estado_al_inicio://g")
			act_md=$(grep "^$metodo_desplazamiento" <<< $dat | sed "s/$metodo_desplazamiento://g")
			act_dn=$(grep "^$desplazamiento_natural" <<< $dat | sed "s/$desplazamiento_natural://g")
			act_dh=$(grep "^$desplazamiento_horizontal" <<< $dat | sed "s/$desplazamiento_horizontal://g")
			act_ct=$(grep "^$click_al_tocar" <<< $dat | sed "s/$click_al_tocar://g")
			act_de=$(grep "^$desactivado_al_escribir" <<< $dat | sed "s/$desactivado_al_escribir://g")
		#metodo desp
			if [[ "$act_md" == "$metodo_desplazamiento1" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 1, 0, 0
			elif [[ "$act_md" == "$metodo_desplazamiento2" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0, 1, 0
			elif [[ "$act_md" == "$metodo_desplazamiento3" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Scroll Method Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0, 0, 1
			fi
		#velocidad
			if [[ "$act_vl" == "" ]] ; then
				act_vl=0.40
			fi
			accel_speed=$(xinput list-props "$ls_disp_dat" | grep "libinput Accel Speed (" | grep -o "([0-9]*" | sed 's/^(//g')
			xinput set-prop "$ls_disp_dat" "$accel_speed" $act_vl
		#desp natural
			if [[ "$act_dn" == "$si" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 1
			elif [[ "$act_dn" == "$no" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Natural Scrolling Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0
			fi
		#desp horizontal
			if [[ "$act_dh" == "$si" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 1
			elif [[ "$act_dh" == "$no" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Horizontal Scroll Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0
			fi
		#click al tocar
			if [[ "$act_ct" == "$si" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 1
			elif [[ "$act_ct" == "$no" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Tapping Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0
			fi
		#desac al escribir
			if [[ "$act_de" == "$si" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 1
			elif [[ "$act_de" == "$no" ]] ; then
				code_x=$(xinput list-props "$ls_disp_dat" | grep "libinput Disable While Typing Enabled (" | grep -o "([0-9]*" | sed 's/^(//g')
				xinput set-prop "$ls_disp_dat" "$code_x" 0
			fi

			elif [ $act_est == 1 ] ; then
				xinput --disable "$ls_disp_dat"
				timeout "$timeout" xmessage -center -bg grey "$estado0"
			fi
		fi #puerta dispositivo vacio
	fi

fi

exit

español

dispositivo='Dispositivo'
atras='Atras'
estado_al_inicio='Estado al inicio'
estado1='Activado'
estado0='Desactivado'
mas_opciones='Mas opciones'
columna_opciones='Opciones'
mas_ajustes='Mas ajustes'
velocidad='Velocidad'
abrir_hoja_datos='Abrir hoja datos'
metodo_desplazamiento='Metodo de desplazamiento'
metodo_desplazamiento1='dos dedos'
metodo_desplazamiento2='borde'
metodo_desplazamiento3='boton'
desplazamiento_natural='Desplazamiento natural'
desplazamiento_horizontal='Desplazamiento horizontal'
click_al_tocar='Click al tocar'
desactivado_al_escribir='Desactivado al escribir'
si='SI'
no='NO'
modo_zurdo_para='Modo zurdo para'
refrescar='Refrescar'
salir='Salir'
aceptar='Aceptar'
dispositivo_vacio='dispositivo vacio'

русский

dispositivo='Устройство'
atras='Позади'
estado_al_inicio='Состояние в начале'
estado1='Активирован'
estado0='Недопустимый'
mas_opciones='Больше опций'
columna_opciones='Опции'
mas_ajustes='Больше настроек'
velocidad='Скорость'
abrir_hoja_datos='Открыть лист данных'
metodo_desplazamiento='Вытесняющий метод'
metodo_desplazamiento1='два пальца'
metodo_desplazamiento2='край'
metodo_desplazamiento3='кнопка'
desplazamiento_natural='Естественное смещение'
desplazamiento_horizontal='Горизонтальное смещение'
click_al_tocar='Нажмите на сенсорный'
desactivado_al_escribir='Выключается при наборе текста'
si='ДА'
no='НЕТ'
modo_zurdo_para='Режим левой руки для'
refrescar='Обновить'
salir='Выход'
aceptar='Принять'
dispositivo_vacio='пустое устройство'

To disable xmessage notification, add # to the beginning of the lines:
timeout "$timeout" xmessage -center -bg green "$estado1"
timeout "$timeout" xmessage -center -bg grey "$estado0"

This program is the replacement of this publication:

you can find useful instructions right there

2 Likes

Hello everyone, you can use a new version of the tool in Gitlab, same functions but with a more organized interface.

2 Likes