I’ve long attempted to hack some touch interfaces for laptops in non-keyboard configurations.
The sad thing is that there aren’t really any good solutions in GNU/Linux. If you want to be able to respond to more complex events like “two finger drag”, you have to hack GTK and use Touchégg, and then it turns out that doesn’t really work on Wayland, and then most of the events disappeared from the X driver, and then…
In short, the situation is still a mess. And then my lug-around-the-apt-while-washing-TV-laptop died (ish), so I had to get a new one (a Lenovo X1 Yoga (2nd gen (which I had to buy from Australia, because nobody would sell it with the specs I wanted (i.e., LTE modem if I wanted to also take it travelling (the 3rd gen has an LTE modem that’s not supported by Linux))))):
And now, with Ubuntu 18.04, everything is even worse, and I’m not able to get any multi finger events at all! All the touch events are just translated into mouse events! Aaaargh!
After despairing for an eternity (OK, half a day), I remembered another touch interface that I quite like: The Perfect Reader.
It’s a bit hard to tell here, but the idea is that you divide the screen into areas, and then you just tap one of the areas to have the associated action happen.
Surely even Linux can’t have fucked up something so basic: It must be possible to get that kind of access.
And it’s possible! Behold!
Er… What’s going on on the other side of the backyard?
Eeek! Kitten! Go back inside!
That’s not a safe place to play! … *phew* It sat down, and turned around and went back inside. *heart attack averted*
ANYWAY!
The idea is that there’s one action grid overlay when Emacs is in the forefront, and another when the mpv video player is. All the events go via Emacs, though, which controls mpv via the mpv socket interface. (And, by the way, I have to say that I’m really impressed with mpv. It has all the commands you want it to have. The documentation is somewhat lacking, though.)
Here’s a demo:
Basically, I’m just reading the output from libinput-debug-events (which outputs everything that goes through /dev/input/event* (so you have to add your user to the input group to access them)), and then execute things based on that. libinput is allegedly the new hotness, and replaces libev and the synaptics X driver, and is supposed to be supported on both Wayland and Xorg, so hopefully this attempt at an interface will last a bit longer than the previous ones.
I wrote the controlling thing in Emacs, of course, and you can find it on Github. I’ve been using an Emacs-based movie/TV viewer since 2004, and I’m not giving up now! So there.
I guess it is not very different from the vim source code
https://github.com/QQ1598058687/termux-vim-Touch-screen-version