diff options
| author | Anton Bobov <anton@bobov.name> | 2023-08-29 14:44:07 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2023-08-29 14:44:07 +0500 |
| commit | 14325e1964c5939e5139297ce5897f929dc1e025 (patch) | |
| tree | a39db488ee3aef27ca1c07e877fecc302bdf5554 /screenshot-tool | |
| parent | 7fb714fadb768401b251a7584d76f216acf5943a (diff) | |
Add scripts
Diffstat (limited to 'screenshot-tool')
| -rwxr-xr-x | screenshot-tool | 23 |
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 "$@" |
