speed improvements

master
Daniel Napora 2021-10-27 02:39:14 +02:00
parent 69535079c6
commit b7f55fd725
1 changed files with 21 additions and 9 deletions

View File

@ -1,8 +1,13 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Copyright (C) Daniel Napora 2021 <napcok@gmail.com> # Copyright (C) Daniel Napora 2021 <napcok@gmail.com>
# Dependencies: jgmenu, xdotool, colorpicker, xdg-utils, xclip # Dependencies: jgmenu, xdotool, colorpicker, xdg-utils, xclip
# TODO Built-in palettes read-only pre-generated like HTML colors amd not copied to ~/.../palettes
# TODO self made palettes in ~/.../palettes
# TODO notifications when copying to clipboard (imagick needed to create icon) # TODO notifications when copying to clipboard (imagick needed to create icon)
# TODO check for other color-tools like gpick,gcolor2 and add launchers to menu # TODO check for other color-tools like gpick,gcolor2 and add launchers to menu
# TODO export to .gpl (GIMP,Inkscape)
# TODO use xcolor as picker
# TODO quicly remove colors from picked (with sed)
ME=${0##*/} ME=${0##*/}
@ -105,9 +110,10 @@ palettes() {
out2+=("^sep(${pal^})") out2+=("^sep(${pal^})")
while read -r color name; while read -r color name;
do do
name=$(printf "%22s %s\n" "$name") #name=$(printf "%22s %s\n" "$name")
fg=$(fgcolor $color) #fg=$(fgcolor $color)
out2+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name </sup></span></tt>,$ME getcolorcode '$color' '$file',,,#${palette}") #out2+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name </sup></span></tt>,$ME getcolorcode '$color' '$file',,,#${palette}")
out2+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt>,$ME getcolorcode '$color' '$file',,,#${palette}")
done < "$file" done < "$file"
out2+=("^sep()") out2+=("^sep()")
out2+=("<b>Add color...</b> (colorpicker),$ME pickcolor '$file'") out2+=("<b>Add color...</b> (colorpicker),$ME pickcolor '$file'")
@ -284,18 +290,24 @@ case "$expose" in
palette=${filename%.*} palette=${filename%.*}
out+=("^sep(<i><span font_weight='light'>Last used palette</span> ${palette^}</i>)") out+=("^sep(<i><span font_weight='light'>Last used palette</span> ${palette^}</i>)")
while read -r color name;do while read -r color name;do
name=$(printf "%22s %s\n" "$name") #name=$(printf "%22s %s\n" "$name")
fg=$(fgcolor $color) #fg=$(fgcolor $color)
out+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name</sup></span></tt>,$ME getcolorcode '$color'") #out+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name</sup></span></tt>,$ME getcolorcode '$color'")
out+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
done < "${pal}" done < "${pal}"
;; ;;
picked|*) picked|*)
out+=("^sep(<i><small>Recently picked colors:</small></i>)") out+=("^sep(<i><small>Recently picked colors:</small></i>)")
while read -r color name;do while read -r color name;do
name=$(printf "%22s %s\n" "$name") # name=$(printf "%22s %s\n" "$name")
fg=$(fgcolor $color) # fg=$(fgcolor $color)
out+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name</sup></span></tt>,$ME getcolorcode '$color'") # out+=("<tt><span bgcolor='$color' fgcolor='$fg'><sub> </sub>$color<sup>$name</sup></span></tt>,$ME getcolorcode '$color'")
out+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
done < <(grep ^# $RECENT) done < <(grep ^# $RECENT)
out+=("^sep()") out+=("^sep()")
out+=("<b>New palette</b> from recently picked,$ME recent2palette;$ME") out+=("<b>New palette</b> from recently picked,$ME recent2palette;$ME")