Feature Request: Option to prevent Android from utilizing controller home button during stream
Is your feature request related to a problem? Please describe. I'm transitioning from a Windows Thin Client to a Shield TV Pro (2019) for game streaming through Moonlight, as my old Windows Thin Client isn't powerful enough for 4K. I normally use the home button for multiple server-side actions, such as overlays and other server-side hotkeys. Currently with the Shield TV Pro, when pressing the home button on my controller, Android goes back to the home screen instead of passing through the home button to the server.
Describe the solution you'd like When I press the home button on my controller during a stream, I would like that to be passed through to the server instead of going back to the client's home menu.
Describe alternatives you've considered Enabling the option to Override native Xbox gamepad support does allow compatible controllers to pass through the home button, with the caveat that the stream can no longer be exited with the LB + RB + Start + Select hotkey, and once the stream is over, the controller is no longer usable by the OS until it is unplugged and plugged back in. (In my case, using a DS3 controller with an old USB XInput adapter to achieve rumble support)
I'm sure I can re-design a lot of my server-side functions to use alternative hotkeys, I would just rather avoid doing so if at all possible.
Additional context I'm not sure if this issue is unique to a specific version of Android, or the NVIDIA Shield specifically. I don't recall this occurring the last time I tested using the app directly from a Sony Google TV, but I am not currently able to test that scenario.
Unfortunately it is not possible for applications to capture the home button. Android prohibits that since it could be used maliciously.
For anyone landing here from a Shield TV: Moonlight can't capture Home, but you can work around it with Button Mapper Pro (the advanced keycode features need Pro).
- Install Button Mapper, enable its accessibility service, and unlock Pro.
- Enable Network debugging on the Shield, then from a PC:
adb connect <shield-ip>:5555adb shell pm grant flar2.homebutton android.permission.WRITE_SECURE_SETTINGS - Remap the controller's Home button to
KEYCODE_BUTTON_MODE (110). I used the keycode method that survives reboots; it adds a bit of latency, but that doesn't matter for Guide.
Moonlight forwards BUTTON_MODE to the host as Guide, so the Xbox button opens Steam/Big Picture. Since Home is remapped system-wide, exclude other apps in Button Mapper or use the remote to get home.
Another option for anyone landing here, with no extra paid app needed: Artemide (an Artemis/Moonlight fork) ships its own accessibility service (KeyboardAccessibilityService) that sees hardware keys before Android TV's system key handling, so controller buttons the TV normally grabs reach the PC instead. In my case that was a DualShock 4's R3 opening TV menus on a Google TV. Stock, it also captures the TV remote, so I built a version that routes per device: controllers and keyboards go to the stream, while the TV remote stays with the TV.
Free, GPL-3.0, ready-to-install APKs with steps: https://github.com/ThrowStuff/moonlight-android/releases/tag/artemide-steam-mouse-2 (code offered upstream as ClassicOldSong/moonlight-android#620 and derflacco/moonlight-android#43). I haven't tested the Shield's Home button specifically, but it uses the same mechanism.