💥 fix(hypr/scripts/color-picker): sending notification even if no color was selected

plus, better way to check if hyprpicker is installed
This commit is contained in:
retrozinndev
2025-06-15 20:14:00 -03:00
parent 240ba192b6
commit 1e0a158b39
+3 -3
View File
@@ -5,14 +5,14 @@ function send_notification() {
} }
# Check if user has hyprpicker installed # Check if user has hyprpicker installed
if ! [[ -f /bin/hyprpicker ]]; then if [[ -z $(command -v hyprpicker) ]]; then
send_notification "An error occurred" "Looks like you don't have hyprpicker installed! Try installing it before using the Color Picker tool." send_notification "An error occurred" "Looks like you don't have hyprpicker installed! Try installing it before using the Color Picker tool."
exit 1 exit 1
fi fi
selected_color=$(hyprpicker | tail -n 1 | xargs) selected_color=$(hyprpicker | tail -n 1 | xargs | sed -e 's/ //g')
if ! [[ -z $selected_color ]]; then if [[ ! -z "$selected_color" ]] && [[ ! "$selected_color" == " " ]]; then
wl-copy $selected_color wl-copy $selected_color
send_notification "Selected Color" "The selected color is <span foreground='$selected_color'>$selected_color</span>, it was also copied to your clipboard!" send_notification "Selected Color" "The selected color is <span foreground='$selected_color'>$selected_color</span>, it was also copied to your clipboard!"
fi fi