2022-02-18 20:34:22 +01:00
|
|
|
#!/bin/bash
|
|
|
|
# jgwallpapergenerate - submenu to generate wallpapers
|
|
|
|
#
|
2024-09-16 00:47:14 +02:00
|
|
|
CONFIG_DIR="$HOME/.config/mabox/tools"
|
|
|
|
CONFIG_FILE="$CONFIG_DIR/mb-canvas.cfg"
|
2022-02-20 09:13:12 +01:00
|
|
|
mkdir -p $CONFIG_DIR
|
|
|
|
if [ ! -f $CONFIG_FILE ]; then
|
|
|
|
cat <<EOF > ${CONFIG_FILE}
|
2024-09-16 00:47:14 +02:00
|
|
|
# Imagetype extension avif or png
|
|
|
|
# avif (recommended) faster and much smaller size
|
|
|
|
extension=avif
|
|
|
|
# Show preview window, and then decide to set as wallpaper or not
|
|
|
|
# if no generated wallpaper will be applied immediately
|
|
|
|
# yes (recommended) or no
|
2022-02-20 09:13:12 +01:00
|
|
|
show_preview=yes
|
|
|
|
EOF
|
|
|
|
fi
|
|
|
|
source <(grep = $CONFIG_FILE)
|
|
|
|
|
2022-02-18 20:34:22 +01:00
|
|
|
case $LANG in
|
|
|
|
pl*)
|
2024-09-16 00:47:14 +02:00
|
|
|
_TITLE="<b>Generator</b> tapet <small>(ImageMagick)</small>"
|
|
|
|
_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="Utworzone obrazy"
|
|
|
|
_OPENDIR="Otwórz katalog"
|
|
|
|
_EMPTYDIR="Opróżnij katalog"
|
|
|
|
_SETTINGS="Ustawienia"
|
|
|
|
_PREVIEW="Pokaż podgląd"
|
|
|
|
_IMG_FORMAT="<i>format obrazków</i>"
|
|
|
|
_RECOMMENDED="(małe pliki - zalecany)"
|
2022-02-18 20:34:22 +01:00
|
|
|
;;
|
|
|
|
*)
|
2024-09-16 00:47:14 +02:00
|
|
|
_TITLE="Wallpaper <b>Generator</b> <small>(ImageMagick)</small>"
|
|
|
|
_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"
|
|
|
|
_SETTINGS="Settings"
|
|
|
|
_PREVIEW="Show preview"
|
|
|
|
_IMG_FORMAT="<i>image format</i>"
|
|
|
|
_RECOMMENDED="<i>(small filesize - recommended)</i>"
|
2022-02-18 20:34:22 +01:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
2024-09-16 00:47:14 +02:00
|
|
|
DIR="$(xdg-user-dir PICTURES)/imagick"
|
2022-02-18 20:34:22 +01:00
|
|
|
files="$(ls ${DIR}|wc -l)"
|
|
|
|
du="$(du -sh ${DIR}|awk '{print $1}')"
|
|
|
|
me="jgwallpapergenerate -s"
|
|
|
|
|
2024-09-16 00:47:14 +02:00
|
|
|
[[ "$1" != "-s" ]] && 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")
|
2022-02-20 09:13:12 +01:00
|
|
|
out+=("^sep()")
|
2024-09-16 00:47:14 +02:00
|
|
|
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")
|
2022-02-18 20:34:22 +01:00
|
|
|
if [ "$files" -gt "0" ]; then
|
2024-09-16 00:47:14 +02:00
|
|
|
out+=("\"\"\"^sep($_IMAGES: $files - ${du})\"\"\"")
|
|
|
|
out+=(" $_OPENDIR,xdg-open $DIR")
|
|
|
|
out+=(" $_EMPTYDIR,rm ${DIR}/*.*;$me")
|
2022-02-18 20:34:22 +01:00
|
|
|
fi
|
2024-09-16 00:47:14 +02:00
|
|
|
out+=("^sep($_SETTINGS)")
|
|
|
|
[[ "$show_preview" == "yes" ]] && out+=("<big></big> $_PREVIEW,mb-setvar show_preview=no $CONFIG_FILE;${me}") || out+=("<big></big> $_PREVIEW,mb-setvar show_preview=yes $CONFIG_FILE;${me}")
|
|
|
|
out+=("^sep($_IMG_FORMAT)")
|
|
|
|
[[ "$extension" == "avif" ]] && out+=("<big>綠</big> <b>avif</b> $_RECOMMENDED,mb-setvar extension=png $CONFIG_FILE;${me}") || out+=("<big>祿</big> avif $_RECOMMENDED,mb-setvar extension=avif $CONFIG_FILE;${me}")
|
|
|
|
[[ "$extension" == "png" ]] && out+=("<big>綠</big> <b>png</b>,mb-setvar extension=avif $CONFIG_FILE;${me}") || out+=("<big>祿</big> png,mb-setvar extension=png $CONFIG_FILE;${me}")
|
2022-02-20 09:13:12 +01:00
|
|
|
|
2022-02-18 20:34:22 +01:00
|
|
|
|
|
|
|
|
|
|
|
### RUN
|
|
|
|
if [[ "$1" == "-s" ]]; then
|
|
|
|
. /usr/share/mb-jgtools/pipemenu-standalone.cfg
|
|
|
|
. $HOME/.config/mabox/mabox.conf
|
|
|
|
|
|
|
|
out+=("^sep()")
|
2024-09-16 00:47:14 +02:00
|
|
|
out+=(" ${arrow_string_left} ${arrow_string_left} $_WALLPAPERMENU,jgwallpaperchanger -s")
|
2022-02-18 20:34:22 +01:00
|
|
|
|
|
|
|
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
|
2024-09-16 00:47:14 +02:00
|
|
|
JGWIDTH=$((jgtools_padding + 270 + jgtools_padding))
|
|
|
|
MENU_PADDING_TOP=$((jgtools_padding + 150))
|
2022-02-18 20:34:22 +01:00
|
|
|
|
2024-09-16 00:47:14 +02:00
|
|
|
THUMB=/usr/share/mabox/img/mb-canvas.png
|
2022-02-18 20:34:22 +01:00
|
|
|
mkconfigfile
|
|
|
|
|
|
|
|
cat <<EOF > ${MENU_ITEMS}
|
2024-09-16 00:47:14 +02:00
|
|
|
@icon,,$((jgtools_padding )),$((jgtools_padding)),270,150,4,left,top,,,${THUMB}
|
|
|
|
@rect,,$((jgtools_padding)),$((jgtools_padding + 116)),270,28,0,left,top,#222222 20,#222222 70,
|
|
|
|
@text,,$((jgtools_padding + 201)),$((jgtools_padding + 92)),100,28,0,left,top,#DDDDDD 60,${WINCLR},<span size='41600' font_family='Ubuntu'><big></big></span>
|
|
|
|
@text,,$((jgtools_padding + 4)),$((jgtools_padding + 116)),250,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'>$_TITLE </span>
|
2022-02-18 20:34:22 +01:00
|
|
|
$(printf '%s\n' "${out[@]}")
|
|
|
|
EOF
|
|
|
|
|
|
|
|
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
|
|
|
|
|
|
|
|
exit 0
|
|
|
|
|
|
|
|
fi
|
|
|
|
printf '%s\n' "${out[@]}"
|
2024-09-16 00:47:14 +02:00
|
|
|
|