149 lines
3.9 KiB
Bash
Executable File
149 lines
3.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# jgwallpapergenerate - submenu to generate wallpapers
|
|
#
|
|
CONFIG_DIR="$HOME/.config/mbxutils/imgw"
|
|
CONFIG_FILE="$CONFIG_DIR/imgw.cfg"
|
|
mkdir -p $CONFIG_DIR
|
|
if [ ! -f $CONFIG_FILE ]; then
|
|
cat <<EOF > ${CONFIG_FILE}
|
|
show_preview=yes
|
|
EOF
|
|
fi
|
|
source <(grep = $CONFIG_FILE)
|
|
|
|
|
|
case $LANG in
|
|
pl*)
|
|
TITLE="Generator tapet (ImageMagick)"
|
|
RANDCOLORS="Losowe kolory"
|
|
PICKCOLORS="Wybór kolorów..."
|
|
WALLPAPERMENU="Menu Tapety"
|
|
RANDOMEFFECT="<b>Losowy</b> efekt"
|
|
SOLID="<b>Jednolity</b> kolor"
|
|
BLURRED="<b>Rozmycie</b>"
|
|
LINEAR="Gradient <b>liniowy</b>"
|
|
RADIAL="Gradient <b>promieniowy</b>"
|
|
TWISTED="<b>Skręcony</b> gradient "
|
|
BILINEAR="Gradient <b>dwuliniowy</b>"
|
|
PLASMA="<b>Plazma</b>"
|
|
ONECOLOR="(jeden kolor)"
|
|
TWOCOLORS="(dwa kolory)"
|
|
FOURCOLORS="(cztery kolory)"
|
|
IMAGES="Wygenerowane obrazy"
|
|
OPENDIR="Otwórz katalog"
|
|
EMPTYDIR="Opróżnij katalog"
|
|
SIZE="rozmiar"
|
|
SETTINGS="Ustawienia"
|
|
PREVIEW="Pokaż podgląd"
|
|
YES="tak"
|
|
NO="nie"
|
|
;;
|
|
*)
|
|
TITLE="Wallpaper Generator (ImageMagick)"
|
|
RANDCOLORS="Random colors"
|
|
PICKCOLORS="Pick colors..."
|
|
WALLPAPERMENU="Wallpapers Menu"
|
|
RANDOMEFFECT="<b>Random</b> effect"
|
|
SOLID="<b>Solid</b> color"
|
|
BLURRED="<b>Blurred</b>"
|
|
LINEAR="<b>Linear</b> gradient"
|
|
RADIAL="<b>Radial</b> gradient"
|
|
TWISTED="<b>Twisted</b> gradient"
|
|
BILINEAR="<b>Bilinear</b> gradient"
|
|
PLASMA="<b>Plasma</b>"
|
|
ONECOLOR="(pick one color)"
|
|
TWOCOLORS="(pick two colors)"
|
|
FOURCOLORS="(pick four colors)"
|
|
IMAGES="Generated images"
|
|
OPENDIR="Open directory"
|
|
EMPTYDIR="Empty directory"
|
|
SIZE="size"
|
|
SETTINGS="Settings"
|
|
PREVIEW="Show preview?"
|
|
YES="yes"
|
|
NO="no"
|
|
;;
|
|
esac
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
|
DIR="$(xdg-user-dir PICTURES)/mb-canvas"
|
|
files="$(ls ${DIR}|wc -l)"
|
|
du="$(du -sh ${DIR}|awk '{print $1}')"
|
|
me="jgwallpapergenerate -s"
|
|
|
|
[[ "$show_preview" == "yes" ]] && l_show_preview="${YES}" || l_show_preview="${NO}"
|
|
|
|
out+=("^sep($TITLE)")
|
|
out+=("^sep($RANDCOLORS)")
|
|
out+=("$SOLID,mb-canvas -Ras;$me")
|
|
out+=("$BLURRED,mb-canvas -RaB;$me")
|
|
out+=("$LINEAR,mb-canvas -Ral;$me")
|
|
out+=("$RADIAL,mb-canvas -Rar;$me")
|
|
out+=("$TWISTED,mb-canvas -Rat;$me")
|
|
out+=("$BILINEAR,mb-canvas -Rab;$me")
|
|
out+=("$PLASMA,mb-canvas -Rap;$me")
|
|
out+=("^sep()")
|
|
out+=("$RANDOMEFFECT,mb-canvas -Ra;$me")
|
|
out+=("^sep($PICKCOLORS)")
|
|
out+=("$SOLID $ONECOLOR,mb-canvas -as;$me")
|
|
out+=("$LINEAR $TWOCOLORS,mb-canvas -al;$me")
|
|
out+=("$RADIAL $TWOCOLORS,mb-canvas -ar;$me")
|
|
out+=("$TWISTED $TWOCOLORS,mb-canvas -at;$me")
|
|
out+=("$BILINEAR $FOURCOLORS,mb-canvas -ab;$me")
|
|
out+=("$PLASMA,mb-canvas -ap;$me")
|
|
if [ "$files" -gt "0" ]; then
|
|
out+=("\"\"\"^sep($IMAGES: $files - $SIZE: ${du})\"\"\"")
|
|
out+=("$OPENDIR,xdg-open $DIR")
|
|
out+=("$EMPTYDIR,rm ${DIR}/*.png;$me")
|
|
fi
|
|
out+=("^sep($SETTINGS)")
|
|
out+=("$PREVIEW [ <b>${l_show_preview}</b> ],^checkout(preview)")
|
|
|
|
out2+=("^tag(preview)")
|
|
out2+=("^sep($PREVIEW)")
|
|
out2+=("$YES ,mb-setvar show_preview=yes $CONFIG_FILE;$me")
|
|
out2+=("$NO,mb-setvar show_preview=no $CONFIG_FILE;$me")
|
|
|
|
|
|
|
|
|
|
### RUN
|
|
if [[ "$1" == "-s" ]]; then
|
|
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
out+=("^sep()")
|
|
out+=(" ⮜ $WALLPAPERMENU,jgwallpaperchanger -s")
|
|
|
|
if [[ $panels_heightpos == "top" ]]; then
|
|
MENU_VALIGN="top"
|
|
MENU_MARGIN_Y=${panels_topmargin:-0}
|
|
elif [[ $panels_heightpos == "bottom" ]]; then
|
|
MENU_VALIGN="bottom"
|
|
MENU_MARGIN_Y=${panels_topmargin:-0}
|
|
else
|
|
MENU_VALIGN="center"
|
|
fi
|
|
MENU_PADDING_TOP=${jgtools_padding:-0}
|
|
MENU_HALIGN="left"
|
|
jgmenu_icon_size=0
|
|
JGWIDTH=40
|
|
menu_margin_x=${submenu_spacing:-0}
|
|
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
|
|
[ -z $jgmenu_use_borders ] && menu_border=0
|
|
|
|
mkconfigfile
|
|
|
|
cat <<EOF > ${MENU_ITEMS}
|
|
$(printf '%s\n' "${out[@]}")
|
|
$(printf '%s\n' "${out2[@]}")
|
|
EOF
|
|
|
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
|
|
|
exit 0
|
|
|
|
fi
|
|
printf '%s\n' "${out[@]}"
|
|
printf '%s\n' "${out2[@]}"
|