blob: 18f7b214810dd72025948f0fce7ccd11c4774353 (
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
|
#!/usr/bin/env bash
out_dir="${GRIM_DEFAULT_DIR:-${XDG_PICTURES_DIR:-.}}"
info() {
notify-send " freezhot" "$1"
printf "\033[32;1m%b\033[0m\n" "$1"
}
focused_clinet_name() {
name="$(swaymsg -t get_tree | jq -r '.. | select(.focused? == true) | .name')"
if [ -z "$name" ]; then
echo "screenshot"
else
echo "$name"
fi
}
########
# MAIN #
########
if [ ! -d "$out_dir" ]; then
mkdir -p "$out_dir"
fi
out="$out_dir/$(date +'%Y%m%d-%Hh%Mm%Ss')-$(focused_clinet_name).png"
grim "$out" && info "Screenshot saved to $out"
|