scrot icon indicating copy to clipboard operation
scrot copied to clipboard

Various fixes to the --multidisp option

Open daltomi opened this issue 9 months ago • 1 comments

Two things to fix:

  1. The description of the help provided with scrot -h should be corrected:

-m capture all monitors

a more accurate description can be found in the help provided with man scrot:

-m --multidisp For multiple heads, screenshot all of them in order.

  1. The --multidisp option is used to capture a "multi-head server" configuration; see https://wiki.archlinux.org/title/Multihead#Separate_screens

This option iterates through :0.0, :0.1, :0.2, etc., thus capturing all screens.

Currently it doesn't work as the XOpenDisplay function is called iteratively and causes a crash, fixing that with a dirty hack makes it behave as expected: force the XOpenDisplay function to be called only once (of course, if you have a configuration with only one screen :0.0 the -m option will not fail because it iterates only once over XOpenDisplay currently)

Testing: Create a new X server (:1) with 3 screens and run a window manager for each one.

 Xnest -scrns 3 :1 &

 for i in 0 1 2
      jwm -display :1.$i & 
  end

Capture all the screens of this new server.

src/scrot -D :1 -m

Image

daltomi avatar Mar 16 '25 14:03 daltomi

For the usage string, does the following patch seem OK?

diff --git a/src/options.c b/src/options.c
index 24ccf85..f1aac32 100644
--- a/src/options.c
+++ b/src/options.c
@@ -135,7 +135,7 @@ static const struct option_desc {
     /* k */  { "capture overlapped window and join them", "v|h" },
     /* l */  { "specify the style of the selection line", "STYLE" },
     /* M */  { "capture monitor", "NUM" },
-    /* m */  { "capture all monitors", "" },
+    /* m */  { "capture all multi-head screens in order", "" },
     /* n */  { OPT_DEPRECATED, OPT_DEPRECATED },
     /* o */  { "overwrite the output file if needed", "" },
     /* p */  { "capture the mouse pointer as well", "" },

For the other issue, I don't use multi-head setup so can't really do much there.

N-R-K avatar Mar 21 '25 11:03 N-R-K