Gustash / Hyprshot

Hyprshot is an utility to easily take screenshots in Hyprland using your mouse.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Supplied geometry did not intersect with any outputs

Eridith opened this issue · comments

The Problem

When entering any of the following:
hyprshot -m region -o /home/user/Pictures/Screenshots
hyprshot -m window -o /home/user/Pictures/Screenshots
hyprshot -m output -o /home/user/Pictures/Screenshots

The terminal outputs the following message:
supplied geometry did not intersect with any outputs

This only happens when attempting to take a screenshot on the secondary monitor, and not the primary.

Expected output

The screenshot should be taken and saved to the listed location, or the clipboard, if specified.

Attempted fixes

Verifying presence of all dependencies
Reinstalling and cleanbuilding through yay

Try to start with --debug (-d) option

I attempted the same with the suggested debug option. I noticed that the values were negative for the region selected.
I have my primary monitor on the right, defined as position 0x0.
My secondary monitor is on the left, defined as position -2560x0.

I suspected that the negative values were messing with the script, and sure enough, when I changed my configuration to the following:
Right: 2560x0
Left: 0x0
The tool was able to take screenshots on both displays.

Is this intended behavior, or should it be modified to accept negative region values?

I think no one even suspected that monitor position can be negative

So yes, it seems to be intended behavior

And yes, it should (I believe) be modified. I'll try to solve it later

I've known about the negative offset issue. As I've said, I won't personally work on a fix because I think that, while possible, that's just poor configuration.

The left-most monitor should always be at X=0.

But if anyone wants to submit a fix, I'm okay with merging it

I am running trough the same issue, but I think that negative offset can sometimes be the best solution.

In my case, my left screen is usually vertical (but I rotate it sometimes), so the top isn't the same than the other screens.The config would be way more complex if I had to change the y value of the others screens, depending on the orientation of the first. Have my central screen as 0,0 and the rotating one as negative offset is way easier to manage.

@Gustash totally understand your reasoning. However, I just want to advocate for this being added.
From Hyprland's docs:

The [monitor] position may contain negative values

For me personally, I have to use a negative position for my monitor as it is placed physically above my laptop.
If I set the top monitor to be at 0x0, then when I am using my laptop by itself windows spanned via Python, mainly OpenCV and Matplotlib, will go to 0x0 and not be visible on my laptop screen. AFIAK this solution can't be solved via windowrules because the window tittles, initial titles, and classes are all different depending on the program and use case.

Thought I'd at least advocate for a legitimate use case/necessary workaround, hopefully @ProMix0's patch gets merged.

I won't personally work on a fix because I think that, while possible, that's just poor configuration.

To add to this, if a fix isn't going to be written for it, would it make sense to put this information somewhere other than this issue? Considering it's a completely valid config for Hyprland, poor configuration or not, I am sure more people are going to run into this. I think having a notice somewhere or some more helpful error message might be useful.

would it make sense to put this information somewhere other than this issue?

You can create an MR and get stuck forever 😋

would it make sense to put this information somewhere other than this issue?

You can create an MR and get stuck forever 😋

Sorry, I haven't had much time to check PRs lately 😅 I'm aware of them, and I'll try to make some time to test and review them

I am running into the same issue. Presumably caused by negative display/window coordinates.

I've known about the negative offset issue. As I've said, I won't personally work on a fix because I think that, while possible, that's just poor configuration.

👆🏻 I want to challenge that. I don't think it's poor configuration. Here's my setup: I use a Laptop, plus an external monitor. The external screen is standing behind/above the Laptop screen. The external monitor is 'optional' in way, because I don't always use it (i.e. while traveling or working elsewhere). So I do not agree that that monitor should be located at position 0x0. Instead, the Laptop screen should always be at 0x0 with external monitors set up around it, in relation to it.

Below is the debug output of the command:

$ hyprshot -d -m window -o ~/Pictures -f shot.png

Saving in: /home/paul/Pictures/shot.png
Monitors: [{
    "id": 0,
    "name": "eDP-1",
    "description": "California Institute of Technology 0x140C",
    "make": "California Institute of Technology",
    "model": "0x140C",
    "serial": "",
    "width": 2880,
    "height": 1800,
    "refreshRate": 90.00000,
    "x": 0,
    "y": 0,
    "activeWorkspace": {
        "id": 1,
        "name": "1"
    },
    "specialWorkspace": {
        "id": 0,
        "name": ""
    },
    "reserved": [0, 31, 0, 0],
    "scale": 1.50,
    "transform": 0,
    "focused": false,
    "dpmsStatus": true,
    "vrr": false,
    "activelyTearing": false,
    "disabled": false,
    "currentFormat": "XRGB8888",
    "availableModes": ["2880x1800@90.00Hz"]
},{
    "id": 1,
    "name": "DP-1",
    "description": "Samsung Electric Company LS49A950U HNTW500018",
    "make": "Samsung Electric Company",
    "model": "LS49A950U",
    "serial": "HNTW500018",
    "width": 5120,
    "height": 1440,
    "refreshRate": 59.97700,
    "x": -1600,
    "y": -1440,
    "activeWorkspace": {
        "id": 2,
        "name": "2"
    },
    "specialWorkspace": {
        "id": 0,
        "name": ""
    },
    "reserved": [0, 31, 0, 0],
    "scale": 1.00,
    "transform": 0,
    "focused": true,
    "dpmsStatus": true,
    "vrr": false,
    "activelyTearing": false,
    "disabled": false,
    "currentFormat": "XRGB8888",
    "availableModes": ["5120x1440@59.98Hz","3840x1080@59.97Hz","3840x2160@60.00Hz","3840x2160@59.94Hz","3440x1440@59.97Hz","2560x1440@59.95Hz","1920x1080@60.00Hz","1920x1080@60.00Hz","1920x1080@59.94Hz","1920x1080@50.00Hz","1680x1050@59.95Hz","1600x900@60.00Hz","1280x1024@75.03Hz","1280x1024@60.02Hz","1440x900@59.89Hz","1280x800@59.81Hz","1152x864@75.00Hz","1280x720@60.00Hz","1280x720@60.00Hz","1280x720@59.94Hz","1280x720@50.00Hz","1024x768@75.03Hz","1024x768@70.07Hz","1024x768@60.00Hz","832x624@74.55Hz","800x600@75.00Hz","800x600@72.19Hz","800x600@60.32Hz","800x600@56.25Hz","720x576@50.00Hz","720x480@60.00Hz","720x480@59.94Hz","640x480@75.00Hz","640x480@72.81Hz","640x480@66.67Hz","640x480@60.00Hz","640x480@59.94Hz","720x400@70.08Hz"]
}]
Clients: [
  {
    "address": "0x55a1e8413980",
    "mapped": true,
    "hidden": false,
    "at": [
      8,
      39
    ],
    "size": [
      1904,
      1153
    ],
    "workspace": {
      "id": 1,
      "name": "1"
    },
    "floating": false,
    "monitor": 0,
    "class": "Slack",
    "title": "Slack",
    "initialClass": "Slack",
    "initialTitle": "Slack",
    "pid": 67543,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0",
    "focusHistoryID": 4
  },
  {
    "address": "0x55a1e809b980",
    "mapped": true,
    "hidden": false,
    "at": [
      1549,
      -1401
    ],
    "size": [
      1963,
      1393
    ],
    "workspace": {
      "id": 2,
      "name": "2"
    },
    "floating": false,
    "monitor": 1,
    "class": "code-url-handler",
    "title": "Visual Studio Code",
    "initialClass": "code-url-handler",
    "initialTitle": "Visual Studio Code",
    "pid": 108833,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0",
    "focusHistoryID": 2
  },
  {
    "address": "0x55a1e9069030",
    "mapped": true,
    "hidden": false,
    "at": [
      -1592,
      -1401
    ],
    "size": [
      1147,
      1393
    ],
    "workspace": {
      "id": 2,
      "name": "2"
    },
    "floating": false,
    "monitor": 1,
    "class": "org.mozilla.firefox",
    "title": "Mozilla Firefox",
    "initialClass": "org.mozilla.firefox",
    "initialTitle": "Mozilla Firefox",
    "pid": 67763,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0",
    "focusHistoryID": 3
  },
  {
    "address": "0x55a1e95d9d70",
    "mapped": true,
    "hidden": false,
    "at": [
      560,
      -1401
    ],
    "size": [
      973,
      1393
    ],
    "workspace": {
      "id": 2,
      "name": "2"
    },
    "floating": false,
    "monitor": 1,
    "class": "org.gnome.Nautilus",
    "title": "Screenshots",
    "initialClass": "org.gnome.Nautilus",
    "initialTitle": "Loading…",
    "pid": 128145,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0",
    "focusHistoryID": 1
  },
  {
    "address": "0x55a1e96777b0",
    "mapped": true,
    "hidden": false,
    "at": [
      -429,
      -1401
    ],
    "size": [
      973,
      1393
    ],
    "workspace": {
      "id": 2,
      "name": "2"
    },
    "floating": false,
    "monitor": 1,
    "class": "kitty",
    "title": "hyprshot -d -m window -o ~/Pictures -f shot.png",
    "initialClass": "kitty",
    "initialTitle": "kitty",
    "pid": 127623,
    "xwayland": false,
    "pinned": false,
    "fullscreen": false,
    "fullscreenMode": 0,
    "fakeFullscreen": false,
    "grouped": [],
    "swallowing": "0x0",
    "focusHistoryID": 0
  }
]
Boxes:
8,39 1904x1153 Slack
1549,-1401 1963x1393 Visual Studio Code
-1592,-1401 1147x1393 Mozilla Firefox
560,-1401 973x1393 Screenshots
-429,-1401 973x1393 hyprshot -d -m window -o ~/Pictures -f shot.png
Geometry: 560,-1401 973x1393
Crop: 560,0 973x-8
supplied geometry did not intersect with any outputs

Fixed in #39