Skip to content

feat: swipe to type#451

Open
oneshinyboi wants to merge 21 commits intowayvr-org:mainfrom
oneshinyboi:main
Open

feat: swipe to type#451
oneshinyboi wants to merge 21 commits intowayvr-org:mainfrom
oneshinyboi:main

Conversation

@oneshinyboi
Copy link
Contributor

I found this new library a few days ago which supports swipe to type for rust, so Ive forked it here, adding some improvements to the prediction selection alg, and laying the groundwork for multi language support.

You can see a some debug output showing the predictions based on the swipe data here:

vid
for example the output

swipe path: tyuiopoiuytre
[Prediction { word: "type", score: 0.0, freq: 0.5063510374694056, bigram_prob: None }, Prediction { word: "types", score: 0.1, freq: 0.4162008418819938, bigram_prob: None }, Prediction { word: "topped", score: 0.0824621125123532, freq: 0.33165337313381665, bigram_prob: None }, Prediction { word: "tippee", score: 0.0, freq: 0.0, bigram_prob: None }, Prediction { word: "topee", score: 0.0, freq: 0.0, bigram_prob: None }]

is showing that I swiped over the keys "tyuiopoiuytre" in that order and its correctly predicting that I meant to type the word "type"

Before I continue to implement it properly with the gui and stuff I have a question:

Ive currently implemented the library such that it precompiles word counts and word bigrams into binaries for each language (currently only english) in the crate itself, so the engine can load faster at runtime. its too big for crates.io so it has to be installed via git. This also means the builds will be substantially larger for example the release build binary is now 70mb, compared to 43mb before. I estimate this will increase by about ~30mb per language added. is this acceptable?

@galister
Copy link
Collaborator

galister commented Feb 26, 2026

Impressive!

I think we will likely not want to bundle the dictionaries but load them from the internet on user request, like how many Android keyboards handle dictionary downloads.

The dictionaries could be in ~/.cache or ~/.local/share.

We can also implement a UI for the user to pick the desired word, as well as a way to render a trail line (@oo8dev might have ideas about the latter)

@oo8dev
Copy link
Collaborator

oo8dev commented Feb 26, 2026

Yup, I've implemented WidgetCustomDraw widget (in the separate branch) in which you can put your own callback to have direct access to drawing functions, for example rectangles or sprites. No polygon/line support though.

@oneshinyboi
Copy link
Contributor Author

Ok, the feature is pretty much done now, (apart from the swipe trail) and there are some important caveats: It only works for qwerty keyboards, and only English, but the predictions are much better now. this is because its now using ML (models are cached at runtime in /tmp) instead of a normal algorithm like before. Because its ML, it depends on ort now which is why the builds are failing, you'd need to build on a more modern version of Ubuntu. Anyway Here's the new demo:

vid

@oneshinyboi oneshinyboi marked this pull request as ready for review March 15, 2026 13:42
@oneshinyboi oneshinyboi marked this pull request as draft March 16, 2026 05:45
@oneshinyboi oneshinyboi marked this pull request as ready for review March 16, 2026 08:36
@oneshinyboi
Copy link
Contributor Author

Just flagging this as ready for review, checks should pass once the Ubuntu version is updated in the workflows eg: ff03f8a
The swipe trail isn't implemented but the existing key hover effect provides the same visual feedback so it's functional without it.
Closes #241

@galister
Copy link
Collaborator

i wonder if i'm doing something wrong, for me it just presses the button like normal. the recommendations field is empty

@oneshinyboi
Copy link
Contributor Author

oneshinyboi commented Mar 20, 2026

You have to hold the pointer down and drag across the keys to trigger it, but if you're already doing that then maybe its something to do with your keymap? It should work as long as the first string in KeyData.label for the keys is an english letter.
Could I see your logs?

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.

3 participants