~kris/dots

srice

ref: 512b7381d0155d6247fad64b640b0704496a8035 srice/.config/conky/lean-conky/tools/snapshot.sh -rwxr-xr-x 618 bytes
512b7381 — Kris Yotam mksh: port bashisms to mksh-safe (process subs, DEBUG-trap history hook, direnv, cd- alias) 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/sh
# vim: ft=sh:ts=4:sw=4:et:ai:cin

opt="$1"
window="conky-lcc"
out_file="lcc.$(date +%y%m%d-%H%M%S).png"

snap_lcc() {
    if [ "$opt" = "-c" ]; then
        # conky window only (black background)
        import -window ${window} ${out_file}
    else
        # desktop background blended with conky
        region=$(xwininfo -name "$window" -shape | perl -0pe "s/^.*corners\:\s+([^\s]+).*geometry\s+(\d+x\d+).*$/\2\1/si")
        import -window root -crop ${region} ${out_file}
    fi

}

xdotool search --name ${window} >/dev/null &&
    snap_lcc &&
    echo "snapped to: ${out_file}" &&
    feh ${out_file}