Sunday, May 5, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1435  / 2 Years ago, wed, december 1, 2021, 5:16:03

Kubuntu 20.04 with extended display. Laptop screen has no touch. External screen is a touchscreen. When touching the center of the external screen, the mouse points at the border between two screens. It's calculated as if the touchscreen's width is the width of both screens together.


How can I make the touchscreen fit only the external screen? Also, it's a portable screen. So I would like to make the change permanent between disconnects.


sza@sza-Lenovo-ThinkBook-15-IIL:~$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech M705 id=12 [slave pointer (2)]
⎜ ↳ Logitech K750 id=13 [slave pointer (2)]
⎜ ↳ G2Touch Multi-Touch by G2TSP id=9 [slave pointer (2)]
⎜ ↳ Elan Touchpad id=14 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Integrated Camera: Integrated C id=11 [slave keyboard (3)]
↳ Ideapad extra buttons id=15 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=16 [slave keyboard (3)]
↳ Logitech K750 id=17 [slave keyboard (3)]

sza@sza-Lenovo-ThinkBook-15-IIL:~$ xinput list-props 9
Device 'G2Touch Multi-Touch by G2TSP':
Device Enabled (172): 1
Coordinate Transformation Matrix (174): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix (312): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Calibration Matrix Default (313): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Send Events Modes Available (295): 1, 0
libinput Send Events Mode Enabled (296): 0, 0
libinput Send Events Mode Enabled Default (297): 0, 0
Device Node (298): "/dev/input/event4"
Device Product ID (299): 10900, 22093

sza@sza-Lenovo-ThinkBook-15-IIL:~$ xrandr
Screen 0: minimum 320 x 200, current 3840 x 1080, maximum 16384 x 16384
eDP-1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1920x1080 60.06*+ 60.01 59.97 59.96 59.93
...
DP-1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 344mm x 195mm
1920x1080 60.00*+ 50.00 59.94 30.00 29.97
...
HDMI-1 disconnected (normal left inverted right x axis y axis)

More From » kubuntu

 Answers
2

You may find the following xinput option to be of interest:


--map-to-output device crtc
Restricts the movements of the absolute device to the RandR
crtc. The output name must match a currently connected output
(see xrandr(1)). If the NVIDIA binary driver is detected or
RandR 1.2 or later is not available, a Xinerama output may be
specified as "HEAD-N", with N being the Xinerama screen number.
This option has no effect on relative devices.

Based on info you've provided, the following command may do what you need:


xinput --map-to-output "G2Touch Multi-Touch by G2TSP" DP-1

If this command does what you want, you can set up udev to run it whenever the touch screen is connected. However, xinput will not work when called directly because udev is a system service that runs outside of X. It's necessary to create a watcher script inside of X that udev can notify.



  • Install inotify-tools.



  • Create the watcher script. Set it up to run after the user has logged into X. This can be done via the display manager or desktop environment, depending on whether you want the script running for all users or select users.


    #!/usr/bin/env bash
    inotifywait -m /tmp |
    while read path action file; do
    if [[ "$file" =~ touchscreen-attach ]] ; then
    [[ "$action" = "OPEN" ]] &&
    sleep 1 &&
    xinput --map-to-output "G2Touch Multi-Touch by G2TSP" DP-1
    fi
    done


  • Use lsusb to get the device id of the touch screen. It will be in the form idVendor:idProduct (eg, 2a94:564d).



  • Create a file /etc/udev/rules.d/10-touchscreen.rules:


    ACTION=="add", SUBSYSTEM=="usb", ATTRS{idVendor}=="2a94", ATTRS{idProduct}=="564d", RUN+="touch /tmp/touchscreen-attach"



See also:





JackDaniels points out that KDE has input settings associated with Graphic Tablets. They work for my Wacom tablet, but not my laptop touch screen. If this works with your external touch screen, it would be much easier to set up than what I've described above.


KDE Shortcuts
KDE Settings
KDE Remap Output


[#2396] Thursday, December 2, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
diket

Total Points: 167
Total Questions: 124
Total Answers: 109

Location: Somalia
Member since Wed, Mar 15, 2023
1 Year ago
;