Add a context menu option to stream an app in a new window - #1977
Add a context menu option to stream an app in a new window#1977yassinsolim wants to merge 1 commit into
Conversation
moonlight-common-c maintains a single global connection per process, so concurrent sessions to different hosts require a second process. Add a 'Launch in New Window' item to the app context menu that spawns one already streaming the selected app. On macOS, Session::initialize() disables SDL_HINT_VIDEO_MAC_FULLSCREEN_SPACES when the configured resolution exactly matches a notched display's native mode, which would place both streams on the same Space and defeat the purpose of a second window. Request the safe area resolution for the new instance in that case only.
|
I'll leave the code review to the maintainer, but I don't see anything obviously wrong with your code. The Steam Link build might be an issue, as an embedded device without a window manager, I'm not sure how launching another process with another window would be handled. Also so you know, you can create (or switch) a pull request to be a draft if you want to clearly mark it as work-in-progress. |
|
Sounds good. The PR should be ready for review, it has everything you need to be able to run two instances of moonlight at the same time by right clicking the application on the host and clicking "Launch in New Window". This works on ARM-based macs so far. I believe it should work via command line for other computer architectures. |
|
Hey @jorys-paulin do you know how to get the workflow approved? Is there a specific person that needs to run it? |
Problem
moonlight-common-c maintains a single global connection per process —
LiStopConnection()andLiInterruptConnection()take no connection handle. Streaming two hosts concurrently therefore requires a second process, which users currently achieve by duplicating the app bundle (#1205).Change
Adds a Launch in New Window item to the app context menu that spawns a second instance already streaming the selected app.
open -nso LaunchServices starts a genuine second instance; other platforms re-execQCoreApplication::applicationFilePath().SystemProperties.hasDesktopEnvironment, matching existing usage inSettingsView.qml, so it does not appear on Steam Link or embedded builds.macOS Spaces interaction
Session::initialize()disablesSDL_HINT_VIDEO_MAC_FULLSCREEN_SPACESwhen the configured resolution exactly matches a notched display's native mode. Left alone, both streams land on the same Space, which defeats the purpose of a second window.The new instance is asked for the safe area resolution in that case only. Values come from
StreamUtils::getNativeDesktopMode()at runtime — nothing is hardcoded. Non-notched displays, Intel Macs (the heuristic is inside#if TARGET_CPU_ARM64), and any non-native resolution are unaffected, and the whole block is inside#ifdef Q_OS_DARWINso other platforms do not compile it. Command line options do not persist:StreamingPreferences::save()is only called from the settings screen.Happy to drop this hunk if you would rather the client not adjust resolution implicitly. The feature works without it; separate Spaces on notched Macs is what is lost.
Testing
Verified on macOS (arm64, notched display) against a Sunshine host, built with Qt 6.11.1:
Video stream is 3024x1890x60).Overriding default fullscreen mode for native fullscreen resolution(hint 0); with the substitution it reportsOverriding default fullscreen mode for native safe area resolution(hint 1).Not verified, stated plainly:
#elsepath has not been exercised at runtime on any of them.Feedback welcome on both gaps before this is considered mergeable.
Fixes #1205