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

Issue when trying to take a screenshot (same issue in KDE and i3) #206

Open
sniff122 opened this issue Dec 29, 2019 · 11 comments
Open

Issue when trying to take a screenshot (same issue in KDE and i3) #206

sniff122 opened this issue Dec 29, 2019 · 11 comments

Comments

@sniff122
Copy link

Information

MagicCap Version: 2.1.2
System OS: Linux 5.0.0-29-generic / Platform: linux
Installation ID: f5fb6431-a2ff-4e69-9c25-9c5fe250bad5
Config: {"clipboard_action":2,"elixire_token":"TOKEN REDACTED","hotkey":null,"install_id":"f5fb6431-a2ff-4e69-9c25-9c5fe250bad5","light_theme":false,"save_capture":true,"save_path":"/home/lewis/Pictures/MagicCap/","upload_capture":true,"uploader_type":"elixire"}

Details

Description

When trying to take a screen capture or a GIF capture, you receive a "TypeError: Cannot read property 'crop' of undefined" error in the terminal. I have the same issue in KDE and i3 and I have the same issue with previous versions of MagicCap. No screenshot is taken.

Steps to reproduce

Attempt to take a screenshot or GIF capture when running MagicCap in the terminal if no screen capture is being taken. Not sure on the precise cause

Expected behaviour

MagicCap takes the screen capture or GIF capture without any errors being logged in the terminal and a screenshot/GIF is taken.

Screenshots

When clicking the "Screen Capture" button:
image
When clicking the "GIF Capture" button:
image

@azagaya
Copy link

azagaya commented Feb 20, 2020

Im experiencing the same issue

@kikones34
Copy link

This happened to me too. The issue is that it is not being able to detect any display. In my case, I had no display set as primary, which is what the code looks for when you have no display manually configured:

const screen = screens.find(options.screen ? screen => screen.id === options.screen : screen => screen.primary)

I'm not sure how or if it is possible to set the "screen" option from the application, I haven't found a way.

To fix it, I just set my main display as primary using xrandr.
First, execute the command without arguments to see a list of displays. Once you know the ID of your display, execute the following command to set it as primary: xrandr --output <ID> --primary.

After doing that, the issue was solved.

Maybe a check could be added that shows an error when no display is detected, or fallback to selecting the first display in the list if none is set to primary.

@Deelight-fr
Copy link

Deelight-fr commented Jun 25, 2020

In my case :

screens = [ { width: 1920,
    height: 1080,
    name: 'DVI-I-0',
    id: 'DVI-I-0',
    offsetX: 0,
    offsetY: 0,
    primary: true,
    crop: '1920x1080+0+0' },
  { width: 1920,
    height: 1080,
    name: 'DP-1.1',
    id: 'DP-1.1',
    offsetX: 1920,
    offsetY: 0,
    primary: false,
    crop: '1920x1080+1920+0' },
  { width: 1920,
    height: 1080,
    name: 'DP-1.2',
    id: 'DP-1.2',
    offsetX: 3840,
    offsetY: 0,
    primary: false,
    crop: '1920x1080+3840+0' } ]

So if I have :

options = { format: 'png', screen: 0 }

and :

screen = { width: 1920,                                                      
  height: 1080,                                                     
  name: 'DVI-I-0',                                                  
  id: 'DVI-I-0',                                                    
  offsetX: 0,                                                       
  offsetY: 0,                                                       
  primary: true,                                                    
  crop: '1920x1080+0+0' }

screen.id === options.screen will never be true.

@sniff122
Copy link
Author

sniff122 commented Jul 2, 2020

On my laptop, the internal display's id is eDP and the HDMI output is HDMI-A-0 i have a feeling that this is causing the issue.

@sniff122
Copy link
Author

sniff122 commented Jul 5, 2020

Just tested in a debian 10 VM and everything worked just fine. I tried in an ubuntu VM but i just got a message about an import command not being found and i cant figure out for the life of me what it needs. Since making this issue i have reinstalled and i do still have this issue on ubuntu 20.04 with i3wm.

@sniff122
Copy link
Author

sniff122 commented Jul 5, 2020

Every time i have tested magiccap and got this error, i have been using 2 displays. Just tried it with just my laptop display and it worked just fine without any issues. I know for a fact that i have a display set as primary (i tried both internal and external display as primary with the same effect of the Cannot read property 'crop' of undefined error in the console.

@sniff122
Copy link
Author

sniff122 commented Jul 5, 2020

Yeah just had a look at the screenshot-desktop linux index.js and added some console logs to see what is going on and my suspicions were correct about the display IDs, it gets the primary display just fine but the secondary display just returns an undefined from const screen = screens.find(options.screen ? screen => screen.id === options.screen : screen => screen.primary) as the display ID isnt matching or whatever. I will do more testing, ill try again in a VM but with 2 displays instead of a single one to see if this issue is still there.

@sniff122
Copy link
Author

sniff122 commented Jul 5, 2020

Just tested in the debian 10 VM in vmware with 2 displays and had the exact same error i am getting on my host. It is most likely something to do with the display IDs being something like eDP or HDMI-A-0

@sniff122
Copy link
Author

sniff122 commented Jul 5, 2020

Just had a friend test with multiple displays and the issue was non-existent with their laptop display and then the same issue with an external display connected.

@Crinisus
Copy link

Crinisus commented Jul 5, 2020

I am having the same issue on i3. I will test with a single monitor later on today. Just as a side note I am running Debian 11/bullseye
MagicCap Version: 2.1.2
System OS: Linux 5.7.7 / Platform: linux
Installation ID: c91a5022-bbbb-4fac-983f-5aa748e0d3da
Config: {"clipboard_action":2,"hotkey":null,"install_id":"c91a5022-bbbb-4fac-983f-5aa748e0d3da","light_theme":false,"save_capture":true,"save_path":"/home/smallenginemechanic/Pictures/MagicCap/","upload_capture":false,"uploader_type":"magiccap"}

@LunarN0v4
Copy link

this is still happening, they haven't done anything to even try and fix this
EndeavourOS running KDE Plasma

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

6 participants