22 lines
811 B
Bash
Executable File
22 lines
811 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ "$*" = "screenshot output" ]; then
|
|
mon="$(swaymsg -t get_outputs | jq -r '. | map(select(.focused == true)) | .[0].name')"
|
|
outfile="screenshot-$(date +%s).png"
|
|
grim -o "$mon" - | tee ~/tmp/"$outfile" | wl-copy -t image/png
|
|
notify-send Done -a screenshot "Saved to tmp/$outfile\nCopied to clipboard"
|
|
elif [ "$*" = "screenshot selection" ]; then
|
|
outfile="screenshot-$(date +%s).png"
|
|
grim -g "$(slurp)" - | tee ~/tmp/"$outfile" | wl-copy -t image/png
|
|
notify-send Done -a screenshot "Saved to tmp/$outfile\nCopied to clipboard"
|
|
elif [ "$*" = "pick-color" ]; then
|
|
hex="$(
|
|
grim -g "$(slurp -p)" -t ppm - | \
|
|
magick - -format '%[pixel:p{0,0}]' txt:- | \
|
|
tail -n 1 | \
|
|
cut -d ' ' -f 4
|
|
)"
|
|
echo -n "$hex" | wl-copy
|
|
notify-send "$hex" -a screenshot "Color code copied to clipboard"
|
|
fi
|