GithubHelp home page GithubHelp logo

Command Preparations run after checking Display, making it not possible to enable a dummy HDMI just for streaming about sunshine HOT 26 CLOSED

kinchahoy avatar kinchahoy commented on June 15, 2024
Command Preparations run after checking Display, making it not possible to enable a dummy HDMI just for streaming

from sunshine.

Comments (26)

mdrichardson avatar mdrichardson commented on June 15, 2024 1

I am confused on why this would prevent you from swapping monitors. I actually have a script I provide that does this, it doesn't even need to rely on Sunshine checking to see if the display is available or not. https://github.com/Nonary/MonitorSwapAutomation

I only skimmed your code, but it looks like yours only switches the primary monitor? We're talking about enabling it. When disabled, it doesn't show up with dxgi-info.exe, so Sunshine doesn't think it exists and won't run the Do command.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

I ran into this as well, for a similar use case: #1535

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I am confused on why this would prevent you from swapping monitors. I actually have a script I provide that does this, it doesn't even need to rely on Sunshine checking to see if the display is available or not. https://github.com/Nonary/MonitorSwapAutomation

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

Please elaborate more on the issue, as it stands this looks like a feature request, issues are meant for submitting bug reports so just double checking.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I am confused on why this would prevent you from swapping monitors. I actually have a script I provide that does this, it doesn't even need to rely on Sunshine checking to see if the display is available or not. https://github.com/Nonary/MonitorSwapAutomation

I only skimmed your code, but it looks like yours only switches the primary monitor? We're talking about enabling it. When disabled, it doesn't show up with dxgi-info.exe, so Sunshine doesn't think it exists and won't run the Do command.

That is a flaw with DXGI in general, it can only see active monitors.

But like I was saying, you can still use scripts to activate and deactivate displays. My script can activate or de-activate any display or multiple displays, it does not matter.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

I am confused on why this would prevent you from swapping monitors. I actually have a script I provide that does this, it doesn't even need to rely on Sunshine checking to see if the display is available or not. https://github.com/Nonary/MonitorSwapAutomation

I only skimmed your code, but it looks like yours only switches the primary monitor? We're talking about enabling it. When disabled, it doesn't show up with dxgi-info.exe, so Sunshine doesn't think it exists and won't run the Do command.

That is a flaw with DXGI in general, it can only see active monitors.

But like I was saying, you can still use scripts to activate and deactivate displays. My script can activate or de-activate any display or multiple displays, it does not matter.

Actually activated/enabled, or just set to primary? Like in Windows, if you go to Display Settings deactivated monitors will show grayed out. Sunshine does the monitor check prior to executing any DO commands, so your script won't even fire if the monitor is deactivated like this.

Can your MultiMonitorTool have a config that disallows the mouse or any windows to go to the monitor? That's all I'm really trying to accomplish by "deactivating" it (which I do when Sunshine isn't in use).

And I wouldn't say it's so much a flaw in DXGI or even a bug in Sunshine, more like a feature request to run the DO commands prior to the monitor/adapter check.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I am confused on why this would prevent you from swapping monitors. I actually have a script I provide that does this, it doesn't even need to rely on Sunshine checking to see if the display is available or not. https://github.com/Nonary/MonitorSwapAutomation

I only skimmed your code, but it looks like yours only switches the primary monitor? We're talking about enabling it. When disabled, it doesn't show up with dxgi-info.exe, so Sunshine doesn't think it exists and won't run the Do command.

That is a flaw with DXGI in general, it can only see active monitors.
But like I was saying, you can still use scripts to activate and deactivate displays. My script can activate or de-activate any display or multiple displays, it does not matter.

Actually activated/enabled, or just set to primary? Like in Windows, if you go to Display Settings deactivated monitors will show grayed out. Sunshine does the monitor check prior to executing any DO commands, so your script won't even fire if the monitor is deactivated like this.

Can your MultiMonitorTool have a config that disallows the mouse or any windows to go to the monitor? That's all I'm really trying to accomplish by "deactivating" it (which I do when Sunshine isn't in use).

And I wouldn't say it's so much a flaw in DXGI or even a bug in Sunshine, more like a feature request to run the DO commands prior to the monitor/adapter check.

So just so we're clear here, can you explain to me what you're trying to do. If the task is, can I script a way to swap to a dummy plug prior to connecting on Sunshine, the answer is yes.

As for being active vs deactivated, yes it does that. It does not swap the primary screen, because the main goal of the script was to deactivate all screens until only one was left, which indirectly forces the remaining screen as primary. Why? Because Windows is a lot better at automatically moving windows to other screens if you do it that way.

However, there is nothing stopping you from altering the backend of the script to use something like https://sourceforge.net/projects/monitorswitcher/ instead, which would give you more flexibility such as putting monitor to sleep or whatever, instead of de-activating it.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I missed the part about the mouse moving over to the other screen. Yeah my script technically disables all screens except the one you want. So you wouldn't be able to move the mouse over to the other monitors, sounds like it does exactly what you need.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

Yeah, let me clarify.

I can't speak for @kinchahoy, but I'd imagine our situations are similar. I have an UW monitor trying to stream to a 4K TV. I don't want my monitor resolution to change when streaming, so I set up a 4K virtual monitor using IddSampleDriver. I think @kinchahoy is doing the same thing via the adapter.

When I'm not streaming, I never want my mouse or windows to go to the virtual monitor. As far as I know it needs to be "disabled" in MultiMonitorTool, via the "Disable" button (I don't see one for "deactivate"). So, the DO commands have to run prior to the monitor/adapter check (unless I'm missing something)

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

For the most part you can do anything in the do/undo command portions of Sunshine, because they are executed synchronously. So your script can take as long as it wants to do whatever it needs and you wouldn't run into a situation where you can't run a command before a stream started officially.

Since it can execute code before and after a stream, the sky is basically the limit here.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

No no no. The problem is that Sunshine does the check to see if the monitor is enabled before the DO command runs. Since it can't find the disabled monitor, the DO command never gets called. This is a feature request to have the monitor check occur after the DO command is called, which would open the flexibility to do this.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

No no no. The problem is that Sunshine does the check to see if the monitor is enabled before the DO command runs. Since it can't find the disabled monitor, the DO command never gets called. This is a feature request to have the monitor check occur after the DO command is called, which would open the flexibility to do this.

You don't tell sunshine to stream a specific monitor then, you just leave that empty and then use a script to set the monitors. I am doing the exact same thing you're suggesting for months now.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I mean I even have this script available to download, just follow the instructions and you're basically good to go honestly

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

I don't want the virtual monitor to become the primary monitor, ever. I want the virtual monitor to always be disabled when not in use. I appreciate your help, but your script doesn't work for my use case.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I don't want the virtual monitor to become the primary monitor, ever. I want the virtual monitor to always be disabled when not in use. I appreciate your help, but your script doesn't work for my use case.

You are clearly misunderstanding what the script does. Either way from a technical level I can tell you that this feature request would be exceptionally challenging because of how DXGI works, there are certain steps that can only be done once in the lifetime of the process. We would have to setup a mechanism that essentially reboots sunshine and reconnects it, which is a lot of work for something that can be easily scripted like I've explained.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

I really do appreciate you trying to help and sharing your script. I do. Your script won't get called. It doesn't matter if it prints gold. It won't get called if the monitor is disabled.

And I think Sunshine can be refactored to support this. I haven't looked at the code, but if I start Sunshine with the monitor enabled, disable the monitor and then start a stream, I can see that Sunshine tries to connect to the monitor before calling the DO script. If it fails, could it not just run a check again?

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I really do appreciate you trying to help and sharing your script. I do. Your script won't get called. It doesn't matter if it prints gold. It won't get called if the monitor is disabled.

And I think Sunshine can be refactored to support this. I haven't looked at the code, but if I start Sunshine with the monitor enabled, disable the monitor and then start a stream, I can see that Sunshine tries to connect to the monitor before calling the DO script. If it fails, could it not just run a check again?

I was mistaken, I was thinking of GPU priority, that is the one that is challenging to do. Swapping monitors is something Sunshine already supports without much effort, its why swapping screens without a monitor selected works.

It would get called if you simply tell Sunshine not to stream a specific monitor and you handle all of the logic with your script. Since it doesn't care about monitors being disabled (when you tell it not to stream a specific monitor) it would get executed.

I am just not really understanding the need for it though, why does it even matter? The outcome is exactly the same, the only difference is you never want your primary monitor changed but you also want a virtual screen active. That alone will cause loads of problems, such as the mouse escaping the virtual screen.

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

It's far less about how the monitors are configured during the stream (which is maybe an hour or two a week) and far more about how the monitors are configured when not streaming (which is 40+ hours per week). I just want to have the streamed monitor unable to receive mouse or windows when not streaming, be able to run downstairs to stream while accidentally forgetting to enable the streaming monitor, launch Moonlight, have Sunshine enable the monitor, and start streaming without having to run back upstairs to enable the monitor myself.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

It's far less about how the monitors are configured during the stream (which is maybe an hour or two a week) and far more about how the monitors are configured when not streaming (which is 40+ hours per week). I just want to have the streamed monitor unable to receive mouse or windows when not streaming, be able to run downstairs to stream while accidentally forgetting to enable the streaming monitor, launch Moonlight, have Sunshine enable the monitor, and start streaming without having to run back upstairs to enable the monitor myself.

Which is why I am confused why scripting wouldn't work. As explained earlier, by removing the monitor name from Sunshine, it will no longer care that the monitor you picked is disabled.

It will then execute DO commands, using a script, you can turn on that virtual monitor.

When you're finished streaming, an UNDO command will run that will turn off the virtual monitor and enable your real monitor again.

Effectively meeting your requirement, which is swap to a virtual screen when streaming, and leave it disabled when not streaming...

from sunshine.

mdrichardson avatar mdrichardson commented on June 15, 2024

I'd call that a workaround, but not really meeting the feature request. I'd like my monitor arrangement to stay as close to "normal" as possible while streaming to prevent any window shifting. If that can be done, great. If not, I'll settle for the virtual monitor becoming the primary when streaming.

To be clear, I've been aware of this workaround. My chiming into the OP was just to +1 this as a feature request.

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I'd call that a workaround, but not really meeting the feature request. I'd like my monitor arrangement to stay as close to "normal" as possible while streaming to prevent any window shifting. If that can be done, great. If not, I'll settle for the virtual monitor becoming the primary when streaming.

To be clear, I've been aware of this workaround. My chiming into the OP was just to +1 this as a feature request.

Even if we did this feature, you're always going to have window shifting. Window shifting is a side effect of disabling a monitor. It is done intentionally by the OS to prevent users from accidentally leaving Outlook for example on the other monitor and not be able to recover it.

Doing what you want will take more than just shifting the do command before the monitors are captured basically.

from sunshine.

kinchahoy avatar kinchahoy commented on June 15, 2024

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

Sunshine does not currently have any other types of commands that execute before you start a stream entirely. I understand your request, but I just don’t know how it would be valuable.

Simply because there would be many issues with a lot of games if you had two screens active. For example, your mouse would travel to the other screen on accident.

Perhaps, if you can stress the value of this, then we can consider you know, maybe prioritizing it as a feature. however, as a developer myself, I really don’t see my self even coding this out one day because I just don’t really see any value in it.

from sunshine.

kinchahoy avatar kinchahoy commented on June 15, 2024

from sunshine.

Nonary avatar Nonary commented on June 15, 2024

I would say it is doubtful we would change Sunshines command execution for this, but what we could do is make it so that if users have a monitor configured and its not active, it should still execute commands. In other words you'd still be on your own on figuring out how to script it.

from sunshine.

kinchahoy avatar kinchahoy commented on June 15, 2024

from sunshine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.