Created
June 18, 2020 21:29
-
-
Save nikitabugrovsky/029432d38926a9403cfc003a1eb16573 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# dependencies: | |
# - imagemagick | |
# - xdotool | |
function screenshot() { | |
local timestamp=$(date "+%Y-%m-%d_%H-%M-%S") | |
local path="$HOME/Pictures/screenshot_${timestamp}.png" | |
for i in $(seq 5); do echo "$(printf '%0.s·' $(seq $i))" && sleep 1; done && | |
import -window "$(xdotool getwindowfocus -f)" "${path}" | |
echo "Screenshot path: ${path}" | |
} | |
# output | |
# · | |
# ·· | |
# ··· | |
# ···· | |
# ····· | |
# Screenshot path: <$HOME>/Pictures/screenshot_<$timestamp>.png | |
# NB you can get focused on any window while program runs to make screenshot | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment