dotfiles/.local/bin/screenshot-ui

25 lines
489 B
Shell
Executable file

#!/bin/sh
# Open GNOME's screenshot UI
# (i.e., what a simple "Print" does)
#
# The screenshot machinery lives inside `gnome-shell`
# and cannot be called directly because
# its D-Bus methods are restricted to trusted callers
#
# => We synthesize the key press instead, after a short delay
# so that a launcher's keyboard grab (e.g., `rofi`) is released
set -eu
[ "${XDG_SESSION_TYPE:-}" = "x11" ] || {
echo "X11 only (xdotool)" >&2
exit 1
}
sleep 0.2
xdotool key Print