This commit is contained in:
Daniel Napora 2022-04-28 14:44:58 +02:00
parent 9894b7c3c7
commit b9ca38e78e

View File

@ -3,7 +3,7 @@
# Dependencies: jgmenu, xdotool, xcolor, gcolor3, gpick, pastel, xdg-utils, xclip, notify-send
# TODO export to .gpl (GIMP,Inkscape)
VERSION="0.9.1"
VERSION="0.9.3"
TEMP_DIR=/tmp/colormenu
ME=${0##*/}
@ -200,6 +200,8 @@ fi
case $LANG in
pl*)
COLORMENU="Menu kolorów"
COPY_COLOR_CODE="Kopiuj kod koloru"
COLLECT_COLORS="Dodaj kolory"
PICK_FROM_SCREEN="<b>Pobierz</b> kolor z ekranu..."
ADD_FROM_SELECTOR="<b>Dodaj</b> kolor..."
LASTUSED_PAL="Ostatnio używana paleta"
@ -226,6 +228,8 @@ case $LANG in
;;
*)
COLORMENU="ColorMenu"
COPY_COLOR_CODE="Copy Color Code"
COLLECT_COLORS="Collect Colors"
PICK_FROM_SCREEN="<b>Pick</b> color from screen..."
ADD_FROM_SELECTOR="<b>Add</b> color from selector..."
LASTUSED_PAL="Last used palette"
@ -265,12 +269,17 @@ position
mkconfigfile
trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT
out+=("^sep($COLORMENU <sup><span font_weight='light'> [$action $format]</span></sup>)")
out+=("^sep($COLORMENU)")
out+=("^sep()")
out+=("^sep($COLLECT_COLORS...)")
out+=("$PICK_FROM_SCREEN,$ME pickcolor")
if hash gcolor3 2>/dev/null; then
out+=("^sep()")
out+=("$ADD_FROM_SELECTOR,$ME addcolor")
fi
out+=("^sep($COPY_COLOR_CODE...<sup> [$action $format]</sup>)")
# exposed thing
case "$expose" in
palette)
@ -314,7 +323,6 @@ case "$expose" in
fi
;;
wallpaper)
read WALLPAPER<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2")
WALLPALDIR="$HOME/.config/mbxcolors/palettes/wallp"
mkdir -p "$WALLPALDIR"
read WALLPATH<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg" | cut -d'=' -f2)
@ -323,7 +331,7 @@ case "$expose" in
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$WALLPAPER.clr"
fi
#mapfile -t wallcolors < "$WALLPALDIR/$WALLPAPER.clr"
out+=("^sep($WALLCOLORS)")
out+=("^sep(<i><small>$WALLCOLORS</small></i>)")
while read -r color name;do
out+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
done < "$WALLPALDIR/$WALLPAPER.clr"
@ -339,7 +347,7 @@ case "$expose" in
if [ $palfile ];then
palette=${expose%.*}
pal=${palette//_/ }
out+=("^sep($PALETTE ${pal^})")
out+=("^sep(<i><small>$PALETTE ${pal^}</small></i>)")
while read -r color name;
do
out+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt>,$ME getcolorcode '$color' '$file';$ME setvar expose=palette,,,#${palette}")
@ -350,7 +358,7 @@ case "$expose" in
esac
#if [[ "$CNF_DIR"/palettes/my/*.clr ]]; then
out+=("^sep($COLORPALETTES)")
if [ "$(find "$CNF_DIR"/palettes/my/*.clr -maxdepth 1 -type f -iname \*.clr)" ]; then
if [ "$(find "$CNF_DIR"/palettes/my/*.clr -maxdepth 1 -type f -iname \*.clr 2>/dev/null)" ]; then
out+=("$MYPALETTES,^checkout(mypalettes)")
palettes my
fi
@ -382,6 +390,9 @@ out2+=("$RANDWALL,nitrogen --random ${RANDWALLDIR} --set-scaled --save;$ME")
fi
out1+=("$IMAGICKCOLORS,mbxcolors imagick")
out1+=("^sep($SETTINGS)")
out1+=("$PREFERENCES,^pipe($ME preferences)")
out1+=("^sep()")