Yellow-Dog-Man / Resonite-Issues

Issue repository for Resonite.
https://resonite.com
132 stars 2 forks source link

VirtualDesktopKey / VirtualDesktopMultiKey userspace components to send button presses to your host machine #2585

Open JackTheFoxOtter opened 1 month ago

JackTheFoxOtter commented 1 month ago

Is your feature request related to a problem? Please describe.

At Z-Rave, I have to constantly toggle the mute state of my microphone in Resonite and on our internal Discord call. Currently, I can only do this through the Desktop tab of my dash, which is slow and often frustrating. I would like to make an in-game facet to trigger my global Discord mute toggle keybind, but the VirtualKey component only forwards key presses to the host when the desktop tab has input focus.

Describe the solution you'd like

I would like a userspace only VirtualDesktopKey / VirtualDesktopMultiKey component that always forwards the key press to the host machine, regardless of the desktop tab being in focus.

Describe alternatives you've considered

Alternative ways to trigger mute commands in other applications. Global keybinds are generally the most adopted way to control software that isn't in focus, and for Discord in particular, I don't think there is another alternative that wouldn't violate their ToS.

Additional Context

I'm aware there are some security concerns with this, but I would think both being exclusive to userspace and requiring a button event should make this safe-ish enough.

Requesters

Myself

shiftyscales commented 1 month ago

I think in this case the better option would be if we implemented a similar form of hotkey system as a native feature- as you noted- there are security implications with being able to read arbitrary key presses in userspace which is why the existing components we already have work as they do.

This could possibly be something considered in the scope of action / key rebinding #23.

JackTheFoxOtter commented 1 month ago

I think in this case the better option would be if we implemented a similar form of hotkey system as a native feature [...]

How would such a feature look like? I do think this would be immensely overengineering what is effectively pretending to press a button on a keyboard connected to the host machine. A "whitelist" of allowed buttons to be triggered globally might work, but I'm questioning the usefulness of that. Perhaps a on / off toggle for this feature would be sufficient as a security measure, that would prevent users that don't need this functionality from accidentally triggering it through a custom facet they've installed.

[...] there are security implications with being able to read arbitrary key presses in userspace [...]

My suggested component would only allow triggering keypresses, not reading them. Which is still something to be careful about, but I would think this shouldn't introduce much additional security concern, considering the ability to send keypresses to the host is already implemented when the desktop tab has input focus, the component would be limited to userspace and would require a button press event to execute.

This could possibly be something considered in the scope of action / key rebinding https://github.com/Yellow-Dog-Man/Resonite-Issues/issues/23.

I don't really see how this is relevant? This wouldn't be processing inputs, it would be triggering key pressed events when the user clicks a button using those components.