Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error and unhandled exception when trying to switch displays using --detach-other-monitors #6

Open
janlothar opened this issue Oct 4, 2023 · 0 comments

Comments

@janlothar
Copy link

Trying to switch to a display that is disabled results in throwing a unhandled exception. Here I try to switch to DISPLAY2

PS C:\Program Files\sunshine_utils> .\resolution_change.exe -d \\.\DISPLAY2 --width 3840 --height 2160 --refreshrate 120 --detach-other-monitors
Traceback (most recent call last):
  File "resolution_change.py", line 196, in <module>
  File "resolution_change.py", line 95, in change_display
KeyError: '\\\\.\\DISPLAY2'
[11188] Failed to execute script 'resolution_change' due to unhandled exception!

after enabling the monitor through display settings and running the the same command, it works:

PS C:\Program Files\sunshine_utils> .\resolution_change.exe -d \\.\DISPLAY2 --width 3840 --height 2160 --refreshrate 120 --detach-other-monitors
Switching resolution to 3840x2160 at 120Hz

and using -r afterwards also works fine

PS C:\Program Files\sunshine_utils> .\resolution_change.exe -r
Resetting resolution
Reset to:
Display name: \\.\DISPLAY1 -  Enabled: True, Primary: True - 3440x1440
Display name: \\.\DISPLAY2 -  Enabled: True, Primary: False - 3840x2160

Were I to switch to DISPLAY2 using --detach-other-monitors and then try to switch back to DISPLAY1 then I would get the same error:

PS C:\Program Files\sunshine_utils> .\resolution_change.exe -d \\.\DISPLAY2 --width 3840 --height 2160 --refreshrate 120 --detach-other-monitors
Switching resolution to 3840x2160 at 120Hz
PS C:\Program Files\sunshine_utils> .\resolution_change.exe -d \\.\DISPLAY1 --width 3440 --height 1440 --refreshrate 144 --detach-other-monitors
Traceback (most recent call last):
  File "resolution_change.py", line 196, in <module>
  File "resolution_change.py", line 95, in change_display
KeyError: '\\\\.\\DISPLAY1'
[8572] Failed to execute script 'resolution_change' due to unhandled exception!
PS C:\Program Files\sunshine_utils> .\resolution_change.exe -r
Resetting resolution
Reset to:
Display name: \\.\DISPLAY1 -  Enabled: True, Primary: True - 3440x1440
Display name: \\.\DISPLAY2 -  Enabled: True, Primary: False - 3840x2160
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant