summaryrefslogtreecommitdiff
path: root/screenshot-tool
diff options
context:
space:
mode:
Diffstat (limited to 'screenshot-tool')
-rwxr-xr-xscreenshot-tool23
1 files changed, 23 insertions, 0 deletions
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 "$@"