screenshot-desktop
screenshot-desktop copied to clipboard
Getting Error: No Displays Detected try dropping screen option
Describe the bug In Mac os 10.15.5, when i call screenshot({ format: 'png', filename: path.join('check.png') }) I am getting Error: No Displays Detected try dropping screen option
Expected behavior The screenshot should get captured
Screenshots
system_profiler SPDisplaysDataType; output
Environment (please complete the following information):
- OS: [Mac]
- Engine [Electron]
- Version [10.15.5]
Additional context Add any other context about the problem here.
Hi @NirmanSonawane have you given it the Mac permission https://github.com/bencevans/screenshot-desktop/issues/156#issuecomment-583008800
In my other machine, it is getting captured,
the only difference is that in the machine in which it is not working
the system_profiler SPDisplaysDataType
output
has no display params
and the one in which it is working has display info
I am not able to figure out why
:thinking: Hmmm, I'm really not sure. From a quick browse I can only find this StackExchange question that has some familiarity to this issue and a suggestion that the graphics card needs to be replaced and 'Apple increased the warranty on the graphics card because of a too high number of failures on the specific card' - https://apple.stackexchange.com/questions/12366/graphic-cards-issue
@NirmanSonawane did you find anything further?
@NirmanSonawane did you find anything further?
Nope, I had to remove the main display detection code and directly execute the screencapture process For now, it works for me, will have to check with multiple displays attached though
Hey, I'm running into the same issue where no physical screen is connected to our Mac mini. We use a HDMI dummy plug to simulate a connected display so the GPU isn't throttled, but system_profiler SPDisplaysDataType
doesn't return any displays unfortunately with this plug. When I use the screencapture
tool directly I can take a screenshot without problems.
Maybe an option could be added to ignore how many screens are available and just try to execute the screencapture
command? Or maybe this could be the default behavior when no screens are available (not sure which implications that would have)?
@bencevans I have tested all possible scenarios with and without physical displays enabled, with one and two monitors, via VNC, and via Chrome Remote Desktop. When a monitor is connected, gpu.Displays
returns it in the list.
With remote access and physical monitors unplugged, this method returns nothing. This problem became especially critical after office workers switched to remote work.
Nevertheless, capturescreenshot
works if you specify a single file name. So it will be enough just to add a fallback:
if (displayinfos.length === 0) {
displayinfos.push({ name: 'Remote', primary: true })
}