[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Custom configuration Re: Mouse / Tablet



On Mon 17 Oct 2022 at 13:12:50 (+0000), Maude Summerside wrote:
> 
> Does someone has some knowledge how to do some custom configuration for 
> a specific mouse / tablet ?
> 
> I have a tablet that gets recognized properly like a pointing device but 
> I'd like to modify some parameter. Mostly rotate the X and Y axis.

My method is probably more simple-minded that Nicolas's.
It doesn't handle VCs (non-graphical logins) for which I have
manual scripts.

My ~/.xsession calls ~/bin/xinput-xsession which contains the
following fragments:

  Printing="printf" Xinput="xinput" Unique="$(mktemp --suffix=.list "$(printf '%s%(%s)T%s' "${Uniquetrash:-/tmp}/xinput-" -1 "-XXXX")")"
  xinput > "$Unique"
  [ "$1" != quiet ] && cat "$Unique" || Printing=":" Xinput=":"

… which lists all the devices and their parameters when run
without arguments.

  Matrix="X 0 0 0 X 0 0 0 1"
  Devicetype="pointer"

  Device="Logitech M325" # purple wireless
  Id="$(grep "$Device[[:space:]]*id.*$Devicetype" "$Unique" | sed 's/^[^=]\+=//;s/\t.*//;')"
  [ -n "$Id" ] && "$Printing" '\nXID %2s %s ' "$Id" "$Devicetype" && "$Xinput" --list-props "$Id" && xinput --set-prop "$Id" "Coordinate Transformation Matrix" ${Matrix//X/.3} && xinput --set-prop "$Id" "libinput Middle Emulation Enabled" 1

… this last paragraph is repeated for each different pointer device.
Note that some devices appear as both a pointer and a keyboard.
I would imagine that the Matrix can transform the axes in any way
required. I just use it to tame the wild sensitivities of most mice.

  Devicetype="keyboard"

  Device="AT Translated Set 2 keyboard" # IBM model M, PS/2 plug, GB layout
  Id="$(grep "$Device[[:space:]]*id.*$Devicetype" "$Unique" | sed 's/^[^=]\+=//;s/\t.*//;')"
  [ -n "$Id" ] && "$Printing" '\nXID %2s %s ' "$Id" "$Devicetype" && "$Xinput" --list-props "$Id" && setxkbmap gb -device "$Id"

… again, repeated.

The reason it's in ~/bin/ is so that you can call it anytime to
examine the properties. More importantly, devices like mice can
lose the sensitivity settings when X blanks the screen, or
require setting when you plug in a new one. I have fvwm set up to
execute the script (quietly) with a Ctrl-Alt-Shift-/ keystroke.

Cheers,
David.


Reply to: