Initial setup commit
This commit is contained in:
42
hypr/scripts/color-picker.sh
Executable file
42
hypr/scripts/color-picker.sh
Executable file
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Pick the color in HEX
|
||||
HEX="$(hyprpicker --no-fancy --format hex)"
|
||||
|
||||
# User cancelled
|
||||
[[ -z "$HEX" ]] && exit 0
|
||||
|
||||
# Remove leading '#'
|
||||
HEX="${HEX#\#}"
|
||||
|
||||
# Convert HEX -> RGB
|
||||
R=$((16#${HEX:0:2}))
|
||||
G=$((16#${HEX:2:2}))
|
||||
B=$((16#${HEX:4:2}))
|
||||
|
||||
HEX_OUT="#$HEX"
|
||||
RGB_OUT="$R, $G, $B"
|
||||
|
||||
# Copy HEX to clipboard
|
||||
printf "%s" "$HEX_OUT" | wl-copy
|
||||
|
||||
# Notify
|
||||
# notify-send \
|
||||
# --app-name="Hyprpicker" \
|
||||
# --icon="applications-graphics" \
|
||||
# "🎨 Color Picked" \
|
||||
# "HEX: $HEX_OUT\nRGB: $RGB_OUT\n\nHEX copied to clipboard"
|
||||
|
||||
ICON="/tmp/hyprpicker-color.png"
|
||||
|
||||
magick -size 64x64 "xc:$HEX_OUT" "$ICON"
|
||||
|
||||
notify-send \
|
||||
--app-name="Hyprpicker" \
|
||||
--icon="$ICON" \
|
||||
"🎨 Color Picked" \
|
||||
"\nHEX: $HEX_OUT\nRGB: $RGB_OUT\n\nHEX copied to clipboard"
|
||||
|
||||
rm -f "$ICON"
|
||||
Reference in New Issue
Block a user