#!/bin/bash # jgwallpapergenerate - submenu to generate wallpapers # CONFIG_DIR="$HOME/.config/mabox/tools" CONFIG_FILE="$CONFIG_DIR/mb-canvas.cfg" mkdir -p $CONFIG_DIR if [ ! -f $CONFIG_FILE ]; then cat < ${CONFIG_FILE} # 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 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="Losowy efekt" _SOLID="Jednolity kolor" _BLURRED="Rozmycie" _LINEAR="Gradient liniowy" _RADIAL="Gradient promieniowy" _TWISTED="Skręcony gradient " _BILINEAR="Gradient dwuliniowy" _PLASMA="Plazma" _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="format obrazków" _RECOMMENDED="(małe pliki - zalecany)" ;; *) _TITLE="Wallpaper Generator (ImageMagick)" _RANDCOLORS="Random colors" _PICKCOLORS="Pick colors..." _WALLPAPERMENU="Wallpapers Menu" _RANDOMEFFECT="Random effect" _SOLID="Solid color" _BLURRED="Blurred" _LINEAR="Linear gradient" _RADIAL="Radial gradient" _TWISTED="Twisted gradient" _BILINEAR="Bilinear gradient" _PLASMA="Plasma" _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="image format" _RECOMMENDED="(small filesize - recommended)" ;; esac . $HOME/.config/mabox/mabox.conf DIR="$(xdg-user-dir PICTURES)/imagick" files="$(ls ${DIR}|wc -l)" du="$(du -sh ${DIR}|awk '{print $1}')" me="jgwallpapergenerate -s" [[ "$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") 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 - ${du})\"\"\"") out+=(" $_OPENDIR,xdg-open $DIR") out+=(" $_EMPTYDIR,rm ${DIR}/*.*;$me") fi out+=("^sep($_SETTINGS)") [[ "$show_preview" == "yes" ]] && out+=("󰱒 $_PREVIEW,mb-setvar show_preview=no $CONFIG_FILE;${me}") || out+=("󰄱 $_PREVIEW,mb-setvar show_preview=yes $CONFIG_FILE;${me}") out+=("^sep($_IMG_FORMAT)") [[ "$extension" == "avif" ]] && out+=(" avif $_RECOMMENDED,mb-setvar extension=png $CONFIG_FILE;${me}") || out+=(" avif $_RECOMMENDED,mb-setvar extension=avif $CONFIG_FILE;${me}") [[ "$extension" == "png" ]] && out+=(" png,mb-setvar extension=avif $CONFIG_FILE;${me}") || out+=(" png,mb-setvar extension=png $CONFIG_FILE;${me}") ### RUN if [[ "$1" == "-s" ]]; then . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $HOME/.config/mabox/mabox.conf out+=("^sep()") out+=(" ${arrow_string_left} ${arrow_string_left} $_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 JGWIDTH=$((jgtools_padding + 270 + jgtools_padding)) MENU_PADDING_TOP=$((jgtools_padding + 150)) THUMB=/usr/share/mabox/img/mb-canvas.png mkconfigfile cat < ${MENU_ITEMS} @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},󱡄 @text,,$((jgtools_padding + 4)),$((jgtools_padding + 116)),250,28,0,left,top,#FFFFFF ,${WINCLR},$_TITLE $(printf '%s\n' "${out[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null exit 0 fi printf '%s\n' "${out[@]}"