💥 fix(hypr/scripts/color-picker): empty notification when no color is picked

actually fixed it now
This commit is contained in:
retrozinndev
2025-07-30 18:13:37 -03:00
parent 22a17e14db
commit 91d2a0ee1b
+6 -6
View File
@@ -1,18 +1,18 @@
#!/usr/bin/env bash
function send_notification() {
notify-send -u normal -a "Color Picker" "$1" "$2"
notify-send -u normal -a "color-picker" "$1" "$2"
}
# Check if user has hyprpicker installed
if [[ -z $(command -v hyprpicker) ]]; then
# Check if hyprpicker is installed
if ! command -v hyprpicker > /dev/null; then
send_notification "An error occurred" "Looks like you don't have hyprpicker installed! Try installing it before using the Color Picker tool."
exit 1
fi
selected_color=$(hyprpicker | tail -n 1 | xargs | sed -e 's/ //g')
raw_output=`hyprpicker -al 2> /dev/null`
selected_color=`echo $raw_output | xargs | sed -e 's/ //g'`
if [[ ! -z "$selected_color" ]] && [[ ! "$selected_color" == " " ]]; then
wl-copy $selected_color
if ! [[ -z $selected_color ]]; then
send_notification "Selected Color" "The selected color is <span foreground='$selected_color'>$selected_color</span>, it was also copied to your clipboard!"
fi