0

I'm running Android on a mobile device, but I really just use it as a computer. I have a wireless mouse/keyboard that I use to navigate windows, etc. The keyboard works well generally, but I find some features lacking. I really would like to map keypresses to the touch screen input. i.e. I can set W to send touch input from a part of the screen given by the pixel location or some such thing.

I have a background in computer system, so I'm not afraid to get my hands dirty. I am willing to root the device, install programs, or build in some additional hardware. I can probably do it from scratch, but I really would like to not waste that much time on it.

6
  • Have you tried the accessibility options? See: Use TalkBack keyboard shortcuts Apr 24, 2020 at 3:33
  • I want to map shortcuts to touch signals... I dont want to just map them to specific functions. (i.e. home, back, etc.) Apr 24, 2020 at 4:05
  • Perhaps you might want to give an example which won't map to specific functions (i.e. menu items, text fields, scrolling, buttons etc.) and applies to multiple apps as Android UI already has a concept of "focus" (which if the app is done correctly can be driven by d-pad) Apr 24, 2020 at 4:15
  • The whole point is I want to connect to the touch screen so that I can signal inside apps. For instance, a shortcut to open settings in the youtube app by pressing the screen... etc. Focus shifting works but is good enough for my taste. Apr 24, 2020 at 5:28
  • Theoretically, it's possible: Is it possible to simulate touch without root?, though need a way to map the keyboard to input tap command.
    – Andrew T.
    Apr 24, 2020 at 8:35

4 Answers 4

3

If you are willing to use a PC as the interface.

There appears to exist a modified version of the open-source scrcpy which has keyboard shortcut support for playing games, but should partially map to your requirement:

QtScrcpy - gitee repo or QtScrcpy - github repo

See project README for keyboard mapping feature: https://github.com/barry-ran/QtScrcpy/blob/master/README.md

README image of PUBG with keyboard shortcuts

It looks promising. Unfortunately I haven't used it, and while open source, most of the project UI/documentation isn't in English.

The issue thread for the keyboard mapping feature for scrcpy:

https://github.com/Genymobile/scrcpy/issues/712

you might want to look there for more options.

1
  • This works like a charm... highly recommend. Thanks for the help... Apr 25, 2020 at 17:50
1

Although this question has an accepted answer, I just thought I could add another option, for others looking for something like this.

You could use an automation app like Automate, Macrodroid, Tasker or Automagic(development stopped), to listen for the specific keyboard input, and execute the touch action.

Trigger: keyboard input Constraints/conditions: external keyboard sends input Action: UI interaction - touch screen

(Trigger constraints and actions are called differently in different apps.)

1

You can read mouse and keyboard data from /dev/input/event* and write data into touchScreen by write data into /dev/input/event* , use EVIOCGRAB to prevent event send to other program . Here is a simple tool for example https://github.com/DriverLin/mouse-keyboard-map-touch

1
  • Hi, thanks for your contribution, but looks like the readme is in Chinese. Since Stack Exchange is an international site with an English-only policy, could you edit and explain more on how to use this in English?
    – Andrew T.
    Nov 6, 2021 at 12:25
0

You can use a keymapper app like octopus. This app mirrors the original app and adds keymapper. https://play.google.com/store/apps/details?id=com.chaozhuo.gameassistant Here's the link for this app!

1
  • This is the type of thing I would like, but after researching it.... I see that some app ban you for having it. I don't really play mobile games that much, but it would be nice to be able to if I decided too. Ill mark this answer as a solution if I do get a more generalized one. Apr 24, 2020 at 17:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .