static bool shootScreen_useScrot; // Use program "scrot" to make screenshots (on Linux) static BufferedImage shootScreen2() { ret shootScreen2(screenRectangle()); } static BufferedImage shootScreen2(Rectangle area) ctex { if (shootScreen_useScrot && !isOnPATH("scrot")) shootScreen2_fallback(); if (shootScreen_useScrot) { File f = prepareProgramFile(randomID(12) + ".png"); try { S cmd = "scrot " + bashQuote(f); S out = backtick(cmd); if (f.exists()) ret loadPNG(f); shootScreen2_fallback(); } catch e { print(e); shootScreen2_fallback(); } finally { f.delete(); } } return new Robot().createScreenCapture(area); } static BufferedImage shootScreen2(Rect area) { ret shootScreen2(area.getRectangle()); } static BufferedImage shootScreen2(int x, int y, int w, int h) { ret shootScreen2(new Rectangle(x, y, w, h)); } // internal static void shootScreen2_fallback() { if (shootScreen_useScrot) { print("Scrot failed. Reverting to internal screenshots."); shootScreen_useScrot = false; } }