diff options
Diffstat (limited to 'X11/openbox/scripts')
| -rwxr-xr-x | X11/openbox/scripts/ob-colorpicker | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/X11/openbox/scripts/ob-colorpicker b/X11/openbox/scripts/ob-colorpicker new file mode 100755 index 0000000..3a92c95 --- /dev/null +++ b/X11/openbox/scripts/ob-colorpicker | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | #!/usr/bin/env bash | ||
| 2 | |||
| 3 | ## Copyright (C) 2020-2024 Aditya Shakya <adi1090x@gmail.com> | ||
| 4 | ## | ||
| 5 | ## Simple script to pick color quickly. | ||
| 6 | |||
| 7 | color=$(xcolor --format hex --preview-size 255 --scale 10) | ||
| 8 | image=/tmp/${color}.png | ||
| 9 | |||
| 10 | main() { | ||
| 11 | if [[ "$color" ]]; then | ||
| 12 | # copy color code to clipboard | ||
| 13 | echo $color | tr -d "\n" | xclip -selection clipboard | ||
| 14 | # generate preview | ||
| 15 | convert -size 48x48 xc:"$color" ${image} | ||
| 16 | # notify about it | ||
| 17 | dunstify -u low -h string:x-dunst-stack-tag:obcolorpicker -i ${image} "$color, copied to clipboard." | ||
| 18 | fi | ||
| 19 | } | ||
| 20 | |||
| 21 | # run the script | ||
| 22 | main | ||