26 lines
832 B
Bash
Executable File
26 lines
832 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# This script allows the user to make a screenshot (through slurp)
|
|
# and will then open said screenshot from the clipboard into feh
|
|
# it will also make the feh window floating, and move it to the original position of the selection
|
|
|
|
|
|
slop=$(slurp -f "%x,%y %wx%h" || exit 1)
|
|
# If the capture was cancelled, out will be empty
|
|
if [[ -n "$slop" ]]; then
|
|
# get x,y of selection
|
|
coords=$(echo "$slop" | awk -F' ' '{print $1}')
|
|
x=$(echo "$coords" | awk -F',' '{print $1}')
|
|
y=$(echo "$coords" | awk -F',' '{print $2}')
|
|
|
|
grim -g "$slop" - | wl-copy
|
|
grim -g "$slop" - | feh - -T notitle --class 'floatme' &
|
|
pid="$!"
|
|
|
|
while [[ -z $(wmctrl -lp | awk -vpid=$pid '$3==pid {print $1; exit}') ]]; do
|
|
sleep 0.05
|
|
done
|
|
hyprctl dispatch "hl.dsp.window.move({ x = \"$x\", y = \"$y\", relative = false})"
|
|
fi
|
|
|