parent
a0fa13432d
commit
a2b4bc9901
|
@ -1,11 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Copyright (C) Daniel Napora 2021-22 <napcok@gmail.com>
|
# Copyright (C) Daniel Napora 2021-22 <napcok@gmail.com>
|
||||||
# Dependencies: jgmenu, xdotool, xcolor, gcolor3, xdg-utils, xclip, notify-send
|
# Dependencies: jgmenu, xdotool, xcolor, gcolor3, gpick, pastel, xdg-utils, xclip, notify-send
|
||||||
# TODO Imagick colors - separate menu big around 700 named colors
|
|
||||||
# TODO export to .gpl (GIMP,Inkscape)
|
# TODO export to .gpl (GIMP,Inkscape)
|
||||||
# TODO PL translation
|
|
||||||
|
|
||||||
VERSION="0.9.0"
|
VERSION="0.9.1"
|
||||||
TEMP_DIR=/tmp/colormenu
|
TEMP_DIR=/tmp/colormenu
|
||||||
ME=${0##*/}
|
ME=${0##*/}
|
||||||
|
|
||||||
|
@ -30,12 +28,16 @@ htmlcolors=yes
|
||||||
picker=gpick
|
picker=gpick
|
||||||
#Show built in palettes? (slow)
|
#Show built in palettes? (slow)
|
||||||
builtin_palettes=yes
|
builtin_palettes=yes
|
||||||
|
# Random wallpaper dir
|
||||||
|
walldir=/usr/share/backgrounds
|
||||||
#Position on screen: topleft, top, topright, left, center, right, bottomleft, bottom, bottomright
|
#Position on screen: topleft, top, topright, left, center, right, bottomleft, bottom, bottomright
|
||||||
position=left
|
position=left
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
source <(grep = $CNF_FILE)
|
source <(grep = $CNF_FILE)
|
||||||
|
|
||||||
|
RANDWALLDIR=${walldir:-/usr/share/backgrounds}
|
||||||
|
|
||||||
if [ ! -f $RECENT ]; then
|
if [ ! -f $RECENT ]; then
|
||||||
cat <<EOF > ${RECENT}
|
cat <<EOF > ${RECENT}
|
||||||
#FFFFFF White
|
#FFFFFF White
|
||||||
|
@ -210,6 +212,7 @@ case $LANG in
|
||||||
CLEAR_RECPICKED="<b>Usuń</b> ostatnio dodane"
|
CLEAR_RECPICKED="<b>Usuń</b> ostatnio dodane"
|
||||||
REMOVEONE="Usuń tylko jeden kolor..."
|
REMOVEONE="Usuń tylko jeden kolor..."
|
||||||
WALLCOLORS="Kolory z tapety"
|
WALLCOLORS="Kolory z tapety"
|
||||||
|
RANDWALL="Ustaw <b>losową tapetę</b>"
|
||||||
IMAGICKCOLORS="Kolory <b>Image Magick</b>"
|
IMAGICKCOLORS="Kolory <b>Image Magick</b>"
|
||||||
HTMLCOLORS="Kolory <b>HTML</b>"
|
HTMLCOLORS="Kolory <b>HTML</b>"
|
||||||
PALETTE="Paleta:"
|
PALETTE="Paleta:"
|
||||||
|
@ -235,6 +238,7 @@ case $LANG in
|
||||||
CLEAR_RECPICKED="<b>Clear</b> recently picked"
|
CLEAR_RECPICKED="<b>Clear</b> recently picked"
|
||||||
REMOVEONE="Just remove one color..."
|
REMOVEONE="Just remove one color..."
|
||||||
WALLCOLORS="Wallpaper colors"
|
WALLCOLORS="Wallpaper colors"
|
||||||
|
RANDWALL="Set <b>random wallpaper</b>"
|
||||||
IMAGICKCOLORS="<b>Image Magick</b> Colors"
|
IMAGICKCOLORS="<b>Image Magick</b> Colors"
|
||||||
HTMLCOLORS="<b>HTML</b> colors"
|
HTMLCOLORS="<b>HTML</b> colors"
|
||||||
PALETTE="Palette:"
|
PALETTE="Palette:"
|
||||||
|
@ -262,7 +266,6 @@ 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 <sup><span font_weight='light'> [$action $format]</span></sup>)")
|
||||||
#out+=("^sep(<span bgcolor='#800000'> </span><span fgcolor='#800000' bgcolor='#FABD2F'> mbx </span><span fgcolor='#FABD2F' bgcolor='#800000'> colors </span><span bgcolor='#FABD2F'> </span> <sup><span font_weight='light'>[$action $format]</span></sup>)")
|
|
||||||
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()")
|
||||||
|
@ -317,13 +320,15 @@ case "$expose" in
|
||||||
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)
|
||||||
WALLPAPER=${WALLPATH##*/}
|
WALLPAPER=${WALLPATH##*/}
|
||||||
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
||||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' > "$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($WALLCOLORS)")
|
||||||
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"
|
||||||
|
out+=("^sep()")
|
||||||
|
out+=("$RANDWALL,nitrogen --random ${RANDWALLDIR} --set-scaled --save;$ME")
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if [ -f "$DATA_DIR/palettes/$expose" ];then
|
if [ -f "$DATA_DIR/palettes/$expose" ];then
|
||||||
|
@ -354,6 +359,7 @@ out+=("$BUILTIN_PAL,^checkout(builtpalettes)")
|
||||||
palettes
|
palettes
|
||||||
fi
|
fi
|
||||||
# WALLPAPER COLORS
|
# WALLPAPER COLORS
|
||||||
|
if [ "$expose" != "wallpaper" ];then
|
||||||
out+=("$WALLCOLORS,^checkout(wallcolors)")
|
out+=("$WALLCOLORS,^checkout(wallcolors)")
|
||||||
read WALLPAPER<<< $(grep file "$HOME/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2")
|
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"
|
||||||
|
@ -361,7 +367,7 @@ 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)
|
||||||
WALLPAPER=${WALLPATH##*/}
|
WALLPAPER=${WALLPATH##*/}
|
||||||
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
if [ ! -f "$WALLPALDIR/$WALLPAPER.clr" ]; then
|
||||||
convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print $3}' > "$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"
|
||||||
out2+=("^tag(wallcolors)")
|
out2+=("^tag(wallcolors)")
|
||||||
|
@ -371,6 +377,10 @@ out2+=("^sep()")
|
||||||
while read -r color name;do
|
while read -r color name;do
|
||||||
out2+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
|
out2+=("<tt><small>$color</small> <span bgcolor='$color'><sub> </sub> <sup> </sup></span></tt> ,$ME getcolorcode '$color'")
|
||||||
done < "$WALLPALDIR/$WALLPAPER.clr"
|
done < "$WALLPALDIR/$WALLPAPER.clr"
|
||||||
|
out2+=("^sep()")
|
||||||
|
out2+=("$RANDWALL,nitrogen --random ${RANDWALLDIR} --set-scaled --save;$ME")
|
||||||
|
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)")
|
||||||
|
|
Loading…
Reference in New Issue