I'd like to execute xinput disable bcm5974 when Gnome Terminal (and maybe some other application) gets focused, and xinput enable bcm5974 when it loses focus.This is because libinput and my macbook's touchpad are not friends, libinput's palm rejection barely works, it's really driving me nuts when editing code in Vim and it scrolls by accident, or when typing a command at the terminal.libinput 1.1.4-1xf86-input-libinput 0.16.0-1ArchLinux
How to execute a command on window focus/unfocus?
scripting;x11;gnome;xinput;libinput
This following command will give you the name of focused applicationxdotool getwindowfocus getwindownameUsing this, You can write a wrapper-script to achieve your goal.e.g.while [ true ]do  FocusApp=`xdotool getwindowfocus getwindowname`  if [ xTerminal -eq x$FocusApp ]; then          xinput disable bcm5974  else          xinput enable bcm5974  fidoneAbove code will run forever checking for focused application. If get the expected result then execute the if condition otherwise execute else condition.You can fine tune this script to suit your bill.