Skip to content

Use trackpads as mouse inputs on Linux - #5

Merged
LennardKittner merged 2 commits into
LennardKittner:devfrom
LAK132:mouse-output
Jul 14, 2026
Merged

Use trackpads as mouse inputs on Linux#5
LennardKittner merged 2 commits into
LennardKittner:devfrom
LAK132:mouse-output

Conversation

@LAK132

@LAK132 LAK132 commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

This adds a second uinput device on Linux which acts as a mouse input, controlled by the left and right trackpads.
I tried adding the events directly to the controller device but it completely messed up how the virtual controller was registered on my system.
Scroll is implemented in 2D, but could easily be changed to the 1D circle input that steam input uses.
Both trackpads attempt to accumulate fractional error so that sub-integer movements aren't lost.
Position tracking is reset every time a touch event is received to prevent sudden jumps.

@LennardKittner LennardKittner left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks :)
To mimic the Steam Controller's mouse mode more closely, I would suggest adding:
left click = Steam button + right trigger
right click = Stream button + left trigger

(You can check out

fn parse_button_combinations(
for an example on how this was done for similar button combinations)

But I am happy to merge the PR as is. So let me know if you are interested in implementing this; otherwise, I would merge your PR and add this later myself.

@LAK132

LAK132 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Sure, I'll give it a go

@LAK132

LAK132 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

hmmm, I get the feeling it would be better to have holding the home button change the virtual controller behaviour, rather than pushing more events into the queue. You wouldn't want the virtual controller outputting L2/R2 events at all while in the home-button-held layout

@LennardKittner

Copy link
Copy Markdown
Owner

Good point. I think it makes sense to suppress button presses while the steam button is pressed. But then we also have to release all buttons when the steam button is pressed or still forward the release of buttons.

However, I would not move this into the virtual controller because then we would have to implement this behavior for each system separately. Instead, we should keep the suppression and button combination handling in the Steam controller struct or maybe move it into AbstractVirtualController. However, moving this into AbstractVirtualController would prevent controller-specific button combinations, which may be useful in case more controllers are added in the future.

@LAK132

LAK132 commented Jul 14, 2026

Copy link
Copy Markdown
Contributor Author

Maybe we should leave this PR as is and I'll open another with some ideas for how to implement the alt layout

@LennardKittner

Copy link
Copy Markdown
Owner

Ok sounds good :)

@LennardKittner
LennardKittner merged commit aebc418 into LennardKittner:dev Jul 14, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants