master 0.9.3
Daniel Napora 2022-04-28 14:44:58 +02:00
parent 9894b7c3c7
commit b9ca38e78e
1 changed files with 17 additions and 6 deletions

View File

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