separete self made palettes

master
Daniel Napora 2021-10-27 17:38:03 +02:00
parent c332f0f21e
commit 45b5e89c74
1 changed files with 16 additions and 8 deletions

View File

@ -2,7 +2,7 @@
# Copyright (C) Daniel Napora 2021 <napcok@gmail.com>
# 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
# DONE self made palettes in ~/.../palettes
# 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 export to .gpl (GIMP,Inkscape)
@ -96,20 +96,22 @@ getcolorcode() {
}
recent2palette () {
DATE=$(date +"%Y%m%d-%H%M%S")
grep ^# $RECENT |tac > "$CNF_DIR/palettes/New_$DATE.clr"
mkdir -p "$CNF_DIR/palettes/my"
grep ^# $RECENT |tac > "$CNF_DIR/palettes/my/My_palette_$DATE.clr"
}
newpalette() {
DATE=$(date +"%Y%m%d-%H%M%S")
touch "$CNF_DIR/palettes/New_$DATE.clr"
mkdir -p "$CNF_DIR/palettes/my"
touch "$CNF_DIR/palettes/my/My_palette_$DATE.clr"
}
palettes() {
out1+=("^sep(Color palettes)")
for file in "$CNF_DIR"/palettes/*.clr;do
[ -n "$1" ] && pdir="$CNF_DIR/palettes/my/" || pdir="$CNF_DIR/palettes/"
for file in "$pdir"*.clr;do
filename=${file##*/}
palette=${filename%.*}
pal=${palette//_/ }
tagname=${palette// /_}
out1+=("${pal^},^checkout($tagname)")
out+=("${pal^},^checkout($tagname)")
out2+=("^tag($tagname)")
out2+=("^sep(${pal^})")
while read -r color name;
@ -128,10 +130,11 @@ palettes() {
out3+=("^sep(Are you sure?)")
out3+=("Yes,rm '$file';$ME")
done
if [[ $# = 0 ]] ; then
out1+=("^sep()")
out1+=("<b>Add new</b> palette...,$ME newpalette;$ME")
out1+=("Open palette directory,xdg-open $CNF_DIR/palettes/")
fi
}
htmlcolors() {
@ -326,8 +329,13 @@ case "$expose" in
;;
esac
#if [[ "$CNF_DIR"/palettes/my/*.clr ]]; then
if [ "$(find "$CNF_DIR"/palettes/my/*.clr -maxdepth 1 -type f -iname \*.clr)" ]; then
out+=("^sep(My palletes)")
palettes my
fi
if [[ $builtin_palettes == "yes" ]];then
out+=("^sep(Built-in palettes)")
palettes
fi