diff options
| author | Anton Bobov <anton@bobov.name> | 2025-02-07 00:19:58 +0500 |
|---|---|---|
| committer | Anton Bobov <anton@bobov.name> | 2025-02-07 00:20:11 +0500 |
| commit | e6382996871a55530693fb41ce7b29cd20121213 (patch) | |
| tree | e7bb633c7e63158c2008c834440c44f176f54fc6 | |
| parent | bdfa3ff4399d2fbf30fd9fae59d48f397474ab1e (diff) | |
Add flameshot wrapper script
| -rwxr-xr-x | screenshot-tool | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/screenshot-tool b/screenshot-tool index 30017da..0c28ac4 100755 --- a/screenshot-tool +++ b/screenshot-tool @@ -5,7 +5,17 @@ set -euo pipefail flameshot_run() { focused_window=$(xdotool getwindowfocus) - flameshot gui || true + + 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 @@ -13,7 +23,7 @@ flameshot_run() { main() { if command -v flameshot >/dev/null 2>&1; then - flameshot_run "$@" + flameshot_run "${@:-}" else echo "No flameshot command found" exit 1 |
