summaryrefslogtreecommitdiff
path: root/screenshot-tool
diff options
context:
space:
mode:
authorAnton Bobov <anton@bobov.name>2023-08-29 14:44:07 +0500
committerAnton Bobov <anton@bobov.name>2023-08-29 14:44:07 +0500
commit14325e1964c5939e5139297ce5897f929dc1e025 (patch)
treea39db488ee3aef27ca1c07e877fecc302bdf5554 /screenshot-tool
parent7fb714fadb768401b251a7584d76f216acf5943a (diff)
Add scripts
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 "$@"