From 14325e1964c5939e5139297ce5897f929dc1e025 Mon Sep 17 00:00:00 2001 From: Anton Bobov Date: Tue, 29 Aug 2023 14:44:07 +0500 Subject: Add scripts --- screenshot-tool | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 screenshot-tool (limited to 'screenshot-tool') diff --git a/screenshot-tool b/screenshot-tool new file mode 100755 index 0000000..30017da --- /dev/null +++ b/screenshot-tool @@ -0,0 +1,23 @@ +#!/bin/bash +# Fix issue: window loose focus after flameshot + +set -euo pipefail + +flameshot_run() { + focused_window=$(xdotool getwindowfocus) + flameshot gui || true + if [ "$focused_window" != "$(xdotool getwindowfocus)" ]; then + xdotool windowactivate "$focused_window" + fi +} + +main() { + if command -v flameshot >/dev/null 2>&1; then + flameshot_run "$@" + else + echo "No flameshot command found" + exit 1 + fi +} + +main "$@" -- cgit v1.2.3