Hotrian / OpenVRDesktopDisplayPortal

Put your favorite Desktop Window directly into any OpenVR game!
Other
445 stars 97 forks source link

Background Hotkey Input and Configurable Hotkeys #54

Closed ArmEagle closed 7 years ago

ArmEagle commented 7 years ago

It's great that I can toggle the overlay on and off with spacebar. But it would make things a lot easier if the program could use a (preferably configurable) hotkey that would work without it having focus.

Hotrian commented 7 years ago

Edit: See down below for a proper solution.

I could make the hotkey configurable, but unfortunately Unity can only capture input while the application has focus to prevent keyloggers, etc. It's probably possible to grab the keyboard input directly but I'm not certain this is possible with Unity.

Edit: See below for a version with Background Input.

Hotrian commented 7 years ago

Edit: See down below for a proper solution.

Okay, I made a custom version for now until these options are pushed into the repo.

OpenVRDesktopDisplayPortal-v1.0.6.2.zip

This version now uses custom Inputs, but there's a trick to accessing the Input options.

- Unzip the file somewhere, - Create a shortcut to the exe, - Right click the shortcut and go to Properties, - In the target box, add a space followed by -show-screen-selector. Example - Now, when you launch the shortcut, you will get this dialog. - Scroll down to "Toggle Overlay", and double click it the old hotkey to replace it. - I also added the Overlay shift hotkeys to the Input Manager as configurable hotkeys.

~~I also made a different version that always shows the screen selector: OpenVRDesktopDisplayPortal-v1.0.6.2.1.zip~~

This one doesn't require the shortkey trick, but will always show the screen selector when you launch it, which is an added step I prefer to avoid :P.

I'll probably skip the Input Manger and add a system for customizing the Hotkeys directly from within the app in the future, but for now either one of these will allow you to customize the Hotkeys.

(Edit: It seems launching the exe directly in 1.0.6.2 does not keep the Input changes like I thought it did :( In that case I recommend the second link, 10.6.2.1; Like I say down below, I'll make a custom input manager for configurable hotkeys in the future so you can skip the screen selector step)

Hotrian commented 7 years ago

Edit: See down below for a proper solution.

I have two more demo versions for you!

If you need any of the keys mapped to something else, just let me know and I'll throw up a custom version with special hotkeys for now. I'll probably derp up a Hotkey Customization panel in a little bit, but no promises on ETA.

Edit:

~~I forgot in these versions I accidentally renamed the save folder, just copy your folder at C:\Users\<USERNAME>\AppData\LocalLow\HeadlessOverlayToolkit\OpenVRDesktopDisplayPortal and rename it to OpenVRDesktopDisplayPortal v1_0_6_2 and you're good to go :o.~~

Hotrian commented 7 years ago

Okay, I have another experimental version for you! Sorry for spamming your inbox :).

This one has a new Hotkey Configuration panel that lets you change the hotkeys from within the application. It also has the ability to turn Background Input on/off for any of the hotkeys. Currently it does not save any Hotkey settings, so you'll have to reconfigure them each time you start OVRDDP (sorry for that, but it would take quite a bit of work and I wanted to get this out ASAP). This version also fixes the save bug mentioned in my last comment.

To change a Hotkey:

You can close the Hotkey Panel again by clicking the Hotkey Settings button again.

The toggle on the right of each hotkey controls whether or not that hotkeys works in the background. When checked on, that hotkey works in the background. When checked off, it only works while OVRDDP has focus.

There are still some things to work out, but right now it seems fully functional. I noticed if OVRDDP is getting a bad capture rate, and you hold the key down, it can sometimes keep pressing the key for a second or two. If OVRDDP is getting a good capture rate, this doesn't seem to be an issue, so this issue will go away once I implement a better capture method.

OpenVRDesktopDisplayPortal-v1.0.6.2.4.zip

Edit: Sorry for the funny version numbering also :). The .2 is because this is the second experimental build off the 1.0.6 main version. The .4 is because it is the fourth iteration of the second experimental build. It does not have the code changes from v1.0.6.1, which can be found here, so .2 is more like a sister branch off the main repo and not a direct upgrade from .1.

I have a few different pots in the fire right now ;]

ArmEagle commented 7 years ago

Wow! Such quick response! I tried out the .2.3 version for a bit.

I'm using OVRDDP to show a window inside Elite Dangerous. Setting it up to a position to my liking took some fiddling. But I don't think I'd go through the trouble of wanting dedicated background hotkeys for that. Though clumsy I could manage with quick moving the HMD up to my forehead and back and positioning my mouse cursor (couldn't get the grab&drag with controller to work then).

Any hotkey for the toggle could clash with something for whatever game. But in Elite I could free up the spacebar. So that simple version was just fine for my use case!

I should really look into getting the required tools running so I can play around with this code and compile it myself. But thank you so far!

... And just moments before I was ready to post you have a new version. I'll give that a run too. I'll probably stick with the default hotkeys as otherwise I'd have to set it up every time I start it as you mention.

Awesome work!

Hotrian commented 7 years ago

This is now in OVRdrop, which is the closed source Steam Release of OVRDDP. Since I will continue to incorporate feature requests from OVRDDP into OVRdrop, I am closing this issue now.

If you are interested, you can find OVRdrop on Steam here.