better but still odd
- User
better but still odd
Assistant
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
better but still odd
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
If the touchscreen input still feels "odd" despite applying the correct calibration matrices, there could be a few subtle issues at play. Let’s troubleshoot and refine the solution further.
Touchscreen Coordinate Mapping is Still Off
Even with aspect ratio adjustments, some touchscreens may require more precise scaling or offsets due to hardware quirks.
Mixed Input Devices
If you have multiple input devices (e.g., touchpad + touchscreen), they might interfere with each other during rotation.
Incorrect Calibration Matrix
The matrix might need fine-tuning for your specific device.
Sway Version or Driver Issue
Some Sway versions or input drivers might not handle calibration perfectly.
Let’s take a systematic approach to debug and fix the issue.
Use libinput debug-events to observe raw touchscreen input:
sudo libinput debug-events
swaymsg output "*" transform <angle>), then test again.This helps verify if the issue is with Sway’s calibration or the touchscreen hardware/driver.
For 1920x1080, the default aspect ratio adjustment is:
Left Rotation (Portrait):
[ 0 -1.78 1 ]
[ 0.5625 0 0 ]
[ 0 0 1 ]
Right Rotation (Portrait):
[ 0 1.78 0 ]
[ -0.5625 0 1 ]
[ 0 0 1 ]
If these don’t feel right, try tweaking the values slightly:
Increase/Decrease Scaling Factor
For example, instead of 1.78, try 1.8 or 1.75. Similarly, adjust 0.5625 to 0.55 or 0.6.
Add Offset Adjustment
Add small offsets to the last column (translation). For example:
[ 0 -1.78 1.05 ] # Add slight vertical offset
[ 0.5625 0 0.02 ] # Add slight horizontal offset
[ 0 0 1 ]
Here’s an updated config block with tweakable parameters:
# ─── Normal Orientation ───
bindsym $mod+Shift+o exec swaymsg output "<OUTPUT>" transform normal \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix 1 0 0 0 1 0 0 0 1
# ─── Rotate 90° Left ───
bindsym $mod+Shift+l exec swaymsg output "<OUTPUT>" transform 90 \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix 0 -1.78 1.05 0.5625 0 0.02 0 0 1
# ─── Rotate 270° Right ───
bindsym $mod+Shift+r exec swaymsg output "<OUTPUT>" transform 270 \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix 0 1.78 0 -0.5625 0 1.05 0 0 1
# ─── Inverted Orientation ───
bindsym $mod+Shift+i exec swaymsg output "<OUTPUT>" transform 180 \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix -1 0 1 0 -1 1 0 0 1
Adjust the 1.05 or 0.02 offsets as needed based on testing.
Sometimes, other input devices (e.g., touchpads) can interfere with touchscreen behavior. Disable unnecessary inputs temporarily:
swaymsg input "<TOUCHPAD_DEVICE>" disable
Add this to your config if it helps:
# Disable touchpad when rotating
bindsym $mod+Shift+l exec swaymsg output "<OUTPUT>" transform 90 \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix 0 -1.78 1.05 0.5625 0 0.02 0 0 1 \
&& swaymsg input "<TOUCHPAD_DEVICE>" disable
# Re-enable touchpad when returning to normal
bindsym $mod+Shift+o exec swaymsg output "<OUTPUT>" transform normal \
&& swaymsg input "<TOUCHSCREEN>" calibration_matrix 1 0 0 0 1 0 0 0 1 \
&& swaymsg input "<TOUCHPAD_DEVICE>" enable
If manual tweaking isn’t solving the issue, consider using tools like:
weston-touch-calibrator
Generates a perfect calibration matrix for your touchscreen.
wlr-randr
Helps verify the exact resolution and orientation of your display.
Custom Calibration Script
Write a script that uses libinput events to dynamically calculate and apply the correct calibration matrix.
libinput debug-events to log raw touch input and compare it with expected behavior.Let me know if you’d like me to walk you through any of these steps in more detail!