blob: 0c28ac44f0404d741b2347d53b84b01fec38c8cf (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
#!/bin/bash
# Fix issue: window loose focus after flameshot
set -euo pipefail
flameshot_run() {
focused_window=$(xdotool getwindowfocus)
flameshot_args=()
if [ "$1" = "window" ]; then
eval "$(xdotool selectwindow getwindowgeometry --shell)"
flameshot_args+=(--region "${WIDTH}x${HEIGHT}+${X}+${Y}")
xdotool windowactivate "$WINDOW"
elif [ "$1" = "all" ]; then
flameshot_args+=(--region all)
fi
flameshot gui "${flameshot_args[@]}" || 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 "$@"
|