From daf85fb07bcbdd529790bf4d95370f6d32a5ab54 Mon Sep 17 00:00:00 2001 From: cheb <33794419+chebureki@users.noreply.github.com> Date: Sat, 27 Mar 2021 10:58:47 +0100 Subject: [PATCH] Utilities: Add a delay option to the "shot" utility This option allows for the user to set a delay before a screenshot taken. The user could minimize the window, for example. --- Userland/Utilities/shot.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Userland/Utilities/shot.cpp b/Userland/Utilities/shot.cpp index 865d030a55..347362fc08 100644 --- a/Userland/Utilities/shot.cpp +++ b/Userland/Utilities/shot.cpp @@ -32,6 +32,7 @@ #include #include #include +#include int main(int argc, char** argv) { @@ -39,9 +40,11 @@ int main(int argc, char** argv) String output_path; bool output_to_clipboard = false; + int delay = 0; args_parser.add_positional_argument(output_path, "Output filename", "output", Core::ArgsParser::Required::No); args_parser.add_option(output_to_clipboard, "Output to clipboard", "clipboard", 'c'); + args_parser.add_option(delay, "Seconds to wait before taking a screenshot", "delay", 'd', "seconds"); args_parser.parse(argc, argv); @@ -50,6 +53,7 @@ int main(int argc, char** argv) } auto app = GUI::Application::construct(argc, argv); + sleep(delay); auto response = GUI::WindowServerConnection::the().send_sync(); auto* bitmap = response->bitmap().bitmap();