blob: 0d02b9c48d1c4413441aea4e37a0cf843adeb0a5 (
plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/bin/sh
declare -a cmd
usage() {
echo -e "-m | monitor\n-s | slurp\n-w | active window\n-c | add copy"
}
monitor() {
cmd=("grim -o \"\$(hyprctl -j monitors | jq -r '.[] | select(.focused) | .name')\"")
}
slurp() {
cmd=("grim -g \"\$(slurp)\"")
}
window() {
cmd=("grim -g \"\$(hyprctl activewindow -j | jq -j '\"\(.at | .[0]),\(.at | .[1]) \(.size | .[0])x\(.size | .[1])\"')\"")
}
copy() {
if [[ -n ${cmd[0]} ]]; then
cmd+=("- | wl-copy")
else
usage
fi
}
while getopts ":mswc" opt; do
case ${opt} in
m) monitor;;
s) slurp;;
w) window;;
c) copy;;
*) usage
exit 1;;
esac
done
if [[ -z $1 ]]; then
usage
exit 1
fi
bash -c "${cmd[*]}"
|