Added wayland-screenshot.sh
This commit is contained in:
parent
23feddfb60
commit
59dfe1565b
28
wayland-screenshot.sh
Executable file
28
wayland-screenshot.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/usr/bin/zsh
|
||||
|
||||
local resp="$(fuzzel --index -d <<'EOF'
|
||||
Whole screen
|
||||
Current window
|
||||
Selected area
|
||||
EOF
|
||||
)"
|
||||
|
||||
local outfile="$(date +'screenshot-%F--%H-%M-%S.png')"
|
||||
|
||||
case "${resp}" in
|
||||
0)
|
||||
grim "${outfile}"
|
||||
;;
|
||||
1)
|
||||
local active_window="$(hyprctl -j activewindow)"
|
||||
[[ activewindow == '{}' ]] ||
|
||||
jq -r --null-input --argjson 'window' "${active_window}" \
|
||||
'$window | "\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' |
|
||||
grim -g - "${outfile}"
|
||||
;;
|
||||
2)
|
||||
local area="$(slurp 2>&1)"
|
||||
[[ "${area}" == 'selection cancelled' ]] ||
|
||||
grim -g "${area}" "${outfile}"
|
||||
;;
|
||||
esac
|
Loading…
Reference in New Issue
Block a user