screenshot-desktop icon indicating copy to clipboard operation
screenshot-desktop copied to clipboard

Getting Error: No Displays Detected try dropping screen option

Open NirmanSonawane opened this issue 4 years ago • 8 comments

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 Screenshot 2020-08-26 at 12 02 10 PM

Environment (please complete the following information):

  • OS: [Mac]
  • Engine [Electron]
  • Version [10.15.5]

Additional context Add any other context about the problem here.

NirmanSonawane avatar Aug 26 '20 06:08 NirmanSonawane

Hi @NirmanSonawane have you given it the Mac permission https://github.com/bencevans/screenshot-desktop/issues/156#issuecomment-583008800

bencevans avatar Aug 26 '20 07:08 bencevans

Hi @NirmanSonawane have you given it the Mac permission #156 (comment)

yes

NirmanSonawane avatar Aug 26 '20 07:08 NirmanSonawane

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

NirmanSonawane avatar Aug 26 '20 07:08 NirmanSonawane

: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

bencevans avatar Aug 26 '20 08:08 bencevans

@NirmanSonawane did you find anything further?

bencevans avatar Sep 01 '20 18:09 bencevans

@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

NirmanSonawane avatar Sep 02 '20 04:09 NirmanSonawane

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)?

quentinwendegass avatar Feb 18 '21 11:02 quentinwendegass

@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 })
}

ArtemAvramenko avatar Sep 27 '22 16:09 ArtemAvramenko