diff --git a/sxot.c b/sxot.c index de87126..712ba66 100644 --- a/sxot.c +++ b/sxot.c @@ -31,6 +31,7 @@ #include #include #include +#include typedef uint8_t u8; typedef uint32_t u32; @@ -207,6 +208,7 @@ main(int argc, char *argv[]) "usage: sxot [options]\n" "Options:\n" " -g, --geom Capture the specified rectangle\n" + " -m, --monitor n Capture the specified monitor\n" " -c, --curosr Capture the cursor also\n" ); Str version = S( @@ -237,6 +239,20 @@ main(int argc, char *argv[]) if (!parse_geom(opt.v, str_from_cstr(argv[++i]))) { fatal(S("invalid geometry\n")); } + + } else if (str_eq(arg, S("--monitor")) || str_eq(arg, S("-m"))) { + int m[1]; + str_to_int(str_from_cstr(argv[++i]), m); + + XRRScreenResources *screen; + screen = XRRGetScreenResources (x11.dpy, DefaultRootWindow(x11.dpy)); + XRRCrtcInfo *crtc_info; + crtc_info = XRRGetCrtcInfo (x11.dpy, screen, screen->crtcs[m[0]]); + + opt.x = crtc_info->x; + opt.y = crtc_info->y; + opt.h = crtc_info->height; + opt.w = crtc_info->width; } else if (str_eq(arg, S("--cursor")) || str_eq(arg, S("-c"))) { opt.capture_cursor = true; } else if (str_eq(arg, S("--help")) || str_eq(arg, S("-h"))) {