dotfiles/.config/hypr/scripts/colorpicker

30 lines
637 B
Plaintext
Raw Permalink Normal View History

2024-07-13 23:12:03 +05:30
#!/bin/bash
TMPPCK=$(hyprpicker -a -n)
TMPPST=$(wl-paste)
CMD=$(echo "$TMPPST")
TMP=/tmp/xcolor_$CMD.png
hyprpick() {
$TMPPCK
}
check_dependencies() {
! command -v hyprpicker &>/dev/null &&
notify-send -u critical -a "Color Picker" xcolor-pick "gpick needs to be installed" && exit 1
! command -v magick &>/dev/null &&
notify-send -u critical -a "Color Picker" xcolor-pick "imagemagick needs to be installed" && exit 1
}
main() {
convert -size 120x120 xc:"$CMD" "$TMP"
printf %s "$CMD" | wl-paste
notify-send -a "Color Picker" -i "$TMP" xcolor-pick "$CMD"
}
check_dependencies
hyprpick
main