This commit is contained in:
Yuri Zamyatin 2025-01-12 00:16:55 +00:00
parent 89fad4e748
commit 30641c67f9

View File

@ -27,6 +27,7 @@ LIST+=(
# native
"screen_pick" "screenshot output"
"screen_pick" "screenshot selection"
"screen_pick" "color-picker"
"todo" "pass"
"calc" "calc"
"todo" "translate ru-en"
@ -95,14 +96,22 @@ exec_man() {
[ -n "$page" ] && exec footclient "$SHELL" -c "man '$page' || read -n1"
}
exec_screen_pick() {
shift
if [ "$1" = "output" ]; then
if [ "$*" = "screenshot output" ]; then
mon="$(swaymsg -t get_outputs | jq -r '. | map(select(.focused == true)) | .[0].name')"
grim -o "$mon" - | wl-copy -t image/png
elif [ "$1" = "selection" ]; then
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
elif [ "$*" = "screenshot selection" ]; then
grim -g "$(slurp)" - | wl-copy -t image/png
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
elif [ "$*" = "color-picker" ]; then
hex="$(
grim -g "$(slurp -p)" -t ppm - | \
magick - -format '%[pixel:p{0,0}]' txt:- | \
tail -n 1 | \
cut -d ' ' -f 4
)"
notify-send "$hex" -a screenshot "stnrit" -t 3000
fi
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
}
exec_pass() {
echo 1