browserd icon indicating copy to clipboard operation
browserd copied to clipboard

Stream existing electron apps

Open sabrehagen opened this issue 4 years ago β€’ 1 comments

From Ben's Medium writeup:

It’s important to note that in our solution, an app is simply any online resource that can be accessed and rendered in a browser by a configurable unique URL.

I'd like to use browserd for streaming existing electron apps, for example postman and dot. These apps would run in a container on a server and be streamed to a browserd/stream-consumer. This goal appears to be fundamentally different to the intention of the project which is for streaming a URL accessible web app, not an existing electron app.

From your experience on this project, do you know if it's possible to achieve my goal? Essentially SERVICE_URL would point to an electron app, however an electron app is not addressable by a URL.

sabrehagen avatar Sep 05 '19 07:09 sabrehagen

Short answer is yes this is possible, but requires some changes (not sure the size of em just yet, either).

The changes

https://github.com/bengreenier/browserd/blob/74110ed3c02a8fc04ee103398814fdfcbc4ce27c/components/stream-provider/src/node/application.ts#L95 would have to go, as we won't create a browser window ourselves to host the experience. then the captureWindowTitle would need to be passed, and match the window name of the process you want to capture.

https://github.com/bengreenier/browserd/blob/74110ed3c02a8fc04ee103398814fdfcbc4ce27c/components/stream-provider/src/node/application.ts#L116 which eventually chains to the actual window enumeration and filtering logic:

https://github.com/bengreenier/browserd/blob/74110ed3c02a8fc04ee103398814fdfcbc4ce27c/components/stream-provider/src/browser/application.ts#L85

At that point, you should be able to grab the window frames. The last tricky bit is mapping input, and i'm not sure our current approach allows doing this across different input windows...you'd have to see if this code

https://github.com/bengreenier/browserd/blob/74110ed3c02a8fc04ee103398814fdfcbc4ce27c/components/stream-provider/src/browser/input.ts#L24

that uses the sendInputEvent call works on processes that aren't owned by our application handle. If it does work, great input is easy - our code may even just work. However, if it doesn't...

Well, if our existing input approach doesn't work you've probably got to look at shelling out to some OS helper that can simulate input on an OS scale. I played with xdotool a bit - it might be capable of doing such a thing.

I'd be happy to field questions for this type of work (probably via this issue thread) if you (or anyone else, for that matter) wants to give this a go.

bengreenier avatar Sep 16 '19 08:09 bengreenier