From eb8b58be741ab4a1951163d8d2b4690f3e0203ad Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Mon, 16 Sep 2024 00:47:14 +0200 Subject: [PATCH] wallpaper tools review --- usr/bin/jgwallpaperchanger | 285 +++++++++++++++++++----------------- usr/bin/jgwallpapergenerate | 170 ++++++++++----------- 2 files changed, 236 insertions(+), 219 deletions(-) diff --git a/usr/bin/jgwallpaperchanger b/usr/bin/jgwallpaperchanger index 6cf4667..6c098c1 100755 --- a/usr/bin/jgwallpaperchanger +++ b/usr/bin/jgwallpaperchanger @@ -1,7 +1,7 @@ #!/bin/bash # jgwallpaperchanger - dynamic menu (or submenu) to configure/set wallpapers # -if [[ $1 == "-r" ]];then +if [[ $1 == "-r" || "$1" == "-d" ]];then me="${0##*/} -s" else me="${0##*/} ${1:--s}" @@ -21,8 +21,6 @@ cat < ${CONF_FILE} wallpaper_dir=/usr/share/backgrounds/ # Rotate time in seconds interval=10 -# Wallpaper setter program: nitrogen or feh -setter=nitrogen # Tint2 panel executor button left click action t2_button_lclick_action=choose EOF @@ -65,90 +63,96 @@ esac main(){ case $LANG in pl*) - TITLE="Zmieniacz tapet" - NITROGEN="Nitrogen" - WALLPAPERS="Tapety" - RANDWALL="Losowa tapeta" - EDIT_WPDIRS="Edytuj katalogi z tapetami" - GENERATOR="Generuj (ImageMagick)..." - CHOOSE_WP="Wybierz tapetę..." - SLIDESHOW_DESC="Pokaz slajdów" - SLIDESHOW="pokaz slajdów" - STARTS="Uruchom Pokaz slajdów (zatrzymany)" - STOPS="Zatrzymaj Pokaz slajdów (działający - interwał: $interval sek.)" - CONF="Konfiguracja" - WALLDIR="Katalog z tapetami" - INTERVAL="Interwał slajdów" - SEC="sekund" - EDITCONF="Edytuj plik konfiguracyjny" - OPENDIR="Otwórz katalog z tapetami" - LEFTPANEL="Lewy panel" - OBTHEME="Motyw Openbox" - MENUPANELS="Menu i Panele" - COLORIZER_HELP="Okno główne i Pomoc" - COLORIZER_ROOT="Colorizer menu główne" - COLORIZER_FONTS="Konfiguruj Czcionki" - COLORIZER_OB="Moduł Openbox" - COLORIZER_MENU="Moduł Menu" - COLORIZER_CONKY="Moduł Conky" - COLORIZER_PYRADIO="Moduł PyRadio" - COLORIZER_CAVA="Moduł Cava" - B_LC_ACTION="Akcja przycisku (lewy klik)" - RAND="losuj" - CHOOSE="wybierz" - WALL_MENU="menu tapet" - WALL_MENU_DESC="Menu Tapet" - PREVIEW="podgląd" - COL_WINDOW="okno" - COL_MENU="menu" - RANDOM_DESC="Ustaw losową tapetę" - CHOOSE_DESC="Wybierz tapetę (z menu kontekstowego)" - PREVIEW_DESC="Podgląd use 󱦱 󱦰 Enter Esc " - COL_WINDOW_DESC="Colorizer - okno" - COL_MENU_DESC="Colorizer - dynamiczne menu" + _TITLE="Zmieniacz tapet" + _WALLPAPERS="Tapety" + _RANDWALL="Losowa tapeta" + _EDIT_WPDIRS="Edytuj katalogi z tapetami" + _GENERATOR="Generuj (ImageMagick)..." + _CHOOSE_WP="Wybierz tapetę..." + _SLIDESHOW_DESC="Pokaz slajdów" + _SLIDESHOW="pokaz slajdów" + _ABOUT_SLIDESHOW="O pokazie slajdów" + _STARTS="Uruchom Pokaz slajdów (zatrzymany)" + _STOPS="Zatrzymaj Pokaz slajdów (działający - interwał: $interval sek.)" + _INTERVAL="Interwał slajdów" + _SEC="sekund" + _WPDIR="Katalog" + _WPDIRS="Katalogi z tapetami" + _WPDIRS_DESC="dla losowa/podgląd/pokaz slajdów" + _TOTAL="Razem" + _WPS="tapety w" + _DIRS="katalogach" + _LEFTPANEL="Lewy panel" + _OBTHEME="Motyw Openbox" + _MENUPANELS="Menu i Panele" + _COLORIZER_HELP="Okno główne i Pomoc" + _COLORIZER_ROOT="Colorizer menu główne" + _COLORIZER_FONTS="Konfiguruj Czcionki" + _COLORIZER_OB="Moduł Openbox" + _COLORIZER_MENU="Moduł Menu" + _COLORIZER_CONKY="Moduł Conky" + _COLORIZER_PYRADIO="Moduł PyRadio" + _COLORIZER_CAVA="Moduł Cava" + _B_LC_ACTION="Akcja przycisku (lewy klik)" + _P_B_LC_ACTION="Po lewym kliku w przycisk na panelu" + _RAND="losuj" + _CHOOSE="wybierz" + _WALL_MENU="menu tapet" + _WALL_MENU_DESC="Menu Tapet" + _PREVIEW="podgląd" + _COL_WINDOW="okno" + _COL_MENU="menu" + _RANDOM_DESC="Ustaw losową tapetę" + _CHOOSE_DESC="Wybierz tapetę (z menu kontekstowego)" + _PREVIEW_DESC="Podgląd użyj 󱦱 󱦰 Enter Esc " + _COL_WINDOW_DESC="Colorizer - okno" + _COL_MENU_DESC="Colorizer - dynamiczne menu" ;; *) - TITLE="Wallpaper Changer" - NITROGEN="Nitrogen" - WALLPAPERS="Wallpapers" - RANDWALL="Random Wallpaper" - EDIT_WPDIRS="Edit Wallpaper dirs" - GENERATOR="Generate (ImageMagick)..." - CHOOSE_WP="Choose Wallpaper (from context menu)" - SLIDESHOW_DESC="Wallpaper Slideshow" - SLIDESHOW="slideshow" - STARTS="Start Slideshow (stopped)" - STOPS="Stop Slideshow (running - interval: $interval sec.)" - CONF="Configuration" - WALLDIR="Images dir" - INTERVAL="Interval" - SEC="seconds" - EDITCONF="Edit config file" - OPENDIR="Open wallpaper directory" - LEFTPANEL="Left panel" - OBTHEME="Openbox Theme" - MENUPANELS="Menus/Panels" - COLORIZER_HELP="Main Window and Help" - COLORIZER_ROOT="Colorizer rootmenu" - COLORIZER_FONTS="Configure Fonts" - COLORIZER_OB="Openbox module" - COLORIZER_MENU="Menus/SidePanels module" - COLORIZER_CONKY="Conky module" - COLORIZER_PYRADIO="PyRadio module" - COLORIZER_CAVA="Cava module" - B_LC_ACTION="left-click action" - RAND="random" - CHOOSE="choose" - WALL_MENU="wallmenu" - WALL_MENU_DESC="Wallpaper Menu" - PREVIEW="preview and set" - COL_WINDOW="window" - COL_MENU="menu" - RANDOM_DESC="Set random wallpaper" - CHOOSE_DESC="Choose wallpaper (from context menu)" - PREVIEW_DESC="Preview & set use 󱦱 󱦰 Enter Esc " - COL_WINDOW_DESC="Colorizer - window" - COL_MENU_DESC="Colorizer - dynamic menu" + _TITLE="Wallpaper Menu" + _WALLPAPERS="Wallpapers" + _RANDWALL="Random Wallpaper" + _EDIT_WPDIRS="Edit Wallpaper dirs" + _GENERATOR="Generate (ImageMagick)..." + _CHOOSE_WP="Choose Wallpaper (from context menu)" + _SLIDESHOW_DESC="Wallpaper Slideshow" + _SLIDESHOW="slideshow" + _ABOUT_SLIDESHOW="About Slideshow" + _STARTS="Start Slideshow (stopped)" + _STOPS="Stop Slideshow (running - interval: $interval sec.)" + _INTERVAL="Interval" + _SEC="seconds" + _WPDIR="Directory" + _WPDIRS="Directories with Wallpapers" + _WPDIRS_DESC="for random/preview/slideshow utils" + _TOTAL="Total" + _WPS="wallpapers in" + _DIRS="dirs" + _LEFTPANEL="Left panel" + _OBTHEME="Openbox Theme" + _MENUPANELS="Menus/Panels" + _COLORIZER_HELP="Main Window and Help" + _COLORIZER_ROOT="Colorizer rootmenu" + _COLORIZER_FONTS="Configure Fonts" + _COLORIZER_OB="Openbox module" + _COLORIZER_MENU="Menus/SidePanels module" + _COLORIZER_CONKY="Conky module" + _COLORIZER_PYRADIO="PyRadio module" + _COLORIZER_CAVA="Cava module" + _B_LC_ACTION="left-click action" + _P_B_LC_ACTION="Panel button left-click action" + _RAND="random" + _CHOOSE="choose" + _WALL_MENU="wallmenu" + _WALL_MENU_DESC="Wallpaper Menu" + _PREVIEW="preview and set" + _COL_WINDOW="window" + _COL_MENU="menu" + _RANDOM_DESC="Set random wallpaper" + _CHOOSE_DESC="Choose wallpaper (from context menu)" + _PREVIEW_DESC="Preview & set use 󱦱 󱦰 Enter Esc " + _COL_WINDOW_DESC="Colorizer - window" + _COL_MENU_DESC="Colorizer - dynamic menu" ;; esac @@ -159,51 +163,58 @@ esac help="\nBased on idea of Mabox forum member Shwaybo.\n\nchange wallpapers from a directory, never using the same picture twice until all the pictures have been shown, and rotating x number of seconds (configurable) before the next wallpaper change.\n" #out+=("^sep($TITLE)") -out+=("^sep($WALLPAPERS)") +[[ "$1" == "-s" || "$1" == "ipc" ]] && : || out+=("^sep($_WALLPAPERS)") if ! pgrep -f "mbwallpaper -s" > /dev/null; then #out+=("$NITROGEN,nitrogen") - out+=("󰉔 $CHOOSE_WP,pcmanwp") + out+=(" $_RANDWALL,mbwallpaper -o;$me") + out+=("󰉔 $_CHOOSE_WP,pcmanwp") out+=("^sep()") - out+=(" $RANDWALL,mbwallpaper -o;$me") - out+=(" $PREVIEW_DESC,mbwallpaper -c") - #out+=("$GENERATOR,^pipe(jgwallpapergenerate)") - out+=("󰧸 $SLIDESHOW_DESC,^checkout(sshow)") + out+=(" $_PREVIEW_DESC,mbwallpaper -c") + out+=("󰧸 $_SLIDESHOW_DESC,^checkout(sshow)") + out+=("󱡄 $_GENERATOR,^pipe(jgwallpapergenerate)") out+=("^sep()") - out+=(" Wp dir [ ${wallpaper_dir2} ],^checkout(wpdirs)") + out+=(" $_WPDIR [ ${wallpaper_dir2} ],^checkout(wpdirs)") out2+=("^tag(wpdirs)") - out2+=("^sep(Wallpaper dirs)") - out2+=("^sep(for random/preview/slideshow utils)") + out2+=("^sep($_WPDIRS)") + out2+=("^sep($_WPDIRS_DESC)") readarray -t wpdirs < <(grep -v '^\s*$\|^#\|^\s*\#' "$CNF_FILE") + + [[ -d "$(xdg-user-dir PICTURES)/imagick" ]] && wallp=$(shopt -s nullglob ; set -- $(xdg-user-dir PICTURES)/imagick/*.{jpg,JPG,jpeg,JPEG,png,PNG,avif} ; echo $#) + [[ "$wallp" -gt "1" ]] && wpdirs=("$(xdg-user-dir PICTURES)/imagick" "${wpdirs[@]}") + wpdirs=("/usr/share/backgrounds/" "${wpdirs[@]}") #notify-send.sh "DIRS" "${#wpdirs[@]}" + wpimgs=0 for dir in "${wpdirs[@]}" do - - [[ "$wallpaper_dir2" == "${dir}" ]] && out2+=(" ${dir}") || out2+=(" ${dir},mbwallpaper changedir ${dir};$me") + wpdir=${dir/\~/$HOME} + wallp=$(shopt -s nullglob ; set -- $wpdir/*.{jpg,JPG,jpeg,JPEG,png,PNG,avif} ; echo $#) + [[ "$wallpaper_dir2" == "${dir}" ]] && out2+=(" (${wallp}) ${dir}") || out2+=(" (${wallp}) ${dir},mbwallpaper changedir ${dir};$me") + wpimgs=$((wpimgs+wallp)) done - out2+=("^sep()") - out2+=(" $EDIT_WPDIRS,xdg-open $CNF_FILE") + out2+=("^sep($_TOTAL: $wpimgs $_WPS ${#wpdirs[@]} $_DIRS)") + out2+=(" $_EDIT_WPDIRS,xdg-open $CNF_FILE") else - out+=("$STOPS,killall mbwallpaper;pkill -f 'yad --not';$me") + out+=("$_STOPS,killall mbwallpaper;pkill -f 'yad --not';$me") fi out1+=("^tag(sshow)") -out1+=("^sep($SLIDESHOW_DESC)") -out1+=("$STARTS,run_wallpaperslideshow") -out1+=("$INTERVAL [ $interval ] ($SEC),^checkout(interval)") +out1+=("^sep($_SLIDESHOW_DESC)") +out1+=("$_STARTS,run_wallpaperslideshow") +out1+=("$_INTERVAL [ $interval ] ($_SEC),^checkout(interval)") out1+=("^sep()") #out1+=(" $EDITCONF ,xdg-open $CONF_FILE") #out1+=(" $OPENDIR,pcmanfm -n $wallpaper_dir") -out1+=("About Slideshow,\"\"\"notify-send.sh -u critical -i mbcc 'Wallpaper Changer - rotate desktop wallpaper every n-seconds' \"$help\" \"\"\"") +out1+=("$_ABOUT_SLIDESHOW,\"\"\"notify-send.sh -u critical -i mbcc 'Wallpaper Changer - rotate desktop wallpaper every n-seconds' \"$help\" \"\"\"") out2+=("^tag(interval)") -out2+=("^sep(interval)") +out2+=("^sep($_INTERVAL)") for i in 3 5 10 30 60 120 300 600 1800 3600; do out2+=("$(printf " %4s,%s" "$i" "mb-setvar interval=${i} $CONF_FILE;$me")");done @@ -214,51 +225,51 @@ if [[ $1 == "-s" || $1 == "-c" || $1 == "-u" || $1 == "ipc" || $1 == "-d" ]]; th case "$1" in - -s) out+=(" ${arrow_string_left} $LEFTPANEL,mb-jgtools places");; + -s) out+=(" ${arrow_string_left} $_LEFTPANEL,mb-jgtools places");; -c) out+=(" ${arrow_string_left} Colorizer,colorizer -s");; -u) out+=(" ${arrow_string_left} Settings menu,mb-jgtools settings");; -d) POSITION_MODE=pointer;; ipc) POSITION_MODE=${1:-fixed} out+=("^sep(Mabox Colorizer)") - out+=("$COLORIZER_HELP,ycolorizer") - out+=("$COLORIZER_ROOT,colorizer -s") + out+=("$_COLORIZER_HELP,ycolorizer") + out+=("$_COLORIZER_ROOT,colorizer -s") out+=("^sep()") - out+=("$COLORIZER_FONTS,colorizer-fonts -s") + out+=("$_COLORIZER_FONTS,colorizer-fonts -s") out+=("^sep()") - out+=("$COLORIZER_OB,colorizer-ob -s") - out+=("$COLORIZER_MENU,colorizer-menus -s") - out+=("$COLORIZER_CONKY,colorizer-conky -s") + out+=("$_COLORIZER_OB,colorizer-ob -s") + out+=("$_COLORIZER_MENU,colorizer-menus -s") + out+=("$_COLORIZER_CONKY,colorizer-conky -s") out+=("^sep()") - out+=("$COLORIZER_PYRADIO,colorizer-pyradio -s") - out+=("$COLORIZER_CAVA,colorizer-cava -s") + out+=("$_COLORIZER_PYRADIO,colorizer-pyradio -s") + out+=("$_COLORIZER_CAVA,colorizer-cava -s") out+=("^sep()") case $t2_button_lclick_action in - random) out+=("$B_LC_ACTION: [ $RAND ],^checkout(laction)");; - choose) out+=("$B_LC_ACTION: [ $CHOOSE ],^checkout(laction)");; - preview) out+=("$B_LC_ACTION: [ $PREVIEW ],^checkout(laction)");; - menu) out+=("$B_LC_ACTION: [ $WALL_MENU ],^checkout(laction)");; - slideshow) out+=("$B_LC_ACTION: [ $SLIDESHOW ],^checkout(laction)");; - window) out+=("$B_LC_ACTION: [ $COL_WINDOW ],^checkout(laction)");; - colmenu) out+=("$B_LC_ACTION: [ $COL_MENU ],^checkout(laction)");; - *) out+=("$B_LC_ACTION: [ $CHOOSE ],^checkout(laction)");; + random) out+=("󰳽 $_B_LC_ACTION: [ $_RAND ],^checkout(laction)");; + choose) out+=("󰳽 $_B_LC_ACTION: [ $_CHOOSE ],^checkout(laction)");; + preview) out+=("󰳽 $_B_LC_ACTION: [ $_PREVIEW ],^checkout(laction)");; + menu) out+=("󰳽 $_B_LC_ACTION: [ $_WALL_MENU ],^checkout(laction)");; + slideshow) out+=("󰳽 $_B_LC_ACTION: [ $_SLIDESHOW ],^checkout(laction)");; + window) out+=("󰳽 $_B_LC_ACTION: [ $_COL_WINDOW ],^checkout(laction)");; + colmenu) out+=("󰳽 $_B_LC_ACTION: [ $_COL_MENU ],^checkout(laction)");; + *) out+=("󰳽 $_B_LC_ACTION: [ $_CHOOSE ],^checkout(laction)");; esac out2+=("^tag(laction)") - out2+=("^sep(Panel button left-click action)") - [[ "$t2_button_lclick_action" == "random" ]] && out2+=(" $RANDOM_DESC") || out2+=(" $RANDOM_DESC,mb-setvar t2_button_lclick_action=random $CONF_FILE") - [[ "$t2_button_lclick_action" == "choose" ]] && out2+=(" $CHOOSE_DESC") || out2+=(" $CHOOSE_DESC,mb-setvar t2_button_lclick_action=choose $CONF_FILE") - [[ "$t2_button_lclick_action" == "preview" ]] && out2+=(" $PREVIEW_DESC") || out2+=(" $PREVIEW_DESC,mb-setvar t2_button_lclick_action=preview $CONF_FILE") - [[ "$t2_button_lclick_action" == "menu" ]] && out2+=(" $WALL_MENU_DESC") || out2+=(" $WALL_MENU_DESC,mb-setvar t2_button_lclick_action=menu $CONF_FILE") - [[ "$t2_button_lclick_action" == "slideshow" ]] && out2+=(" $SLIDESHOW_DESC") || out2+=(" $SLIDESHOW_DESC,mb-setvar t2_button_lclick_action=slideshow $CONF_FILE") + out2+=("^sep($_P_B_LC_ACTION)") + [[ "$t2_button_lclick_action" == "random" ]] && out2+=(" $_RANDOM_DESC") || out2+=(" $_RANDOM_DESC,mb-setvar t2_button_lclick_action=random $CONF_FILE") + [[ "$t2_button_lclick_action" == "choose" ]] && out2+=(" $_CHOOSE_DESC") || out2+=(" $_CHOOSE_DESC,mb-setvar t2_button_lclick_action=choose $CONF_FILE") + [[ "$t2_button_lclick_action" == "preview" ]] && out2+=(" $_PREVIEW_DESC") || out2+=(" $_PREVIEW_DESC,mb-setvar t2_button_lclick_action=preview $CONF_FILE") + [[ "$t2_button_lclick_action" == "menu" ]] && out2+=(" $_WALL_MENU_DESC") || out2+=(" $_WALL_MENU_DESC,mb-setvar t2_button_lclick_action=menu $CONF_FILE") + [[ "$t2_button_lclick_action" == "slideshow" ]] && out2+=(" $_SLIDESHOW_DESC") || out2+=(" $_SLIDESHOW_DESC,mb-setvar t2_button_lclick_action=slideshow $CONF_FILE") out2+=("^sep()") - [[ "$t2_button_lclick_action" == "window" ]] && out2+=(" $COL_WINDOW_DESC") || out2+=(" $COL_WINDOW_DESC,mb-setvar t2_button_lclick_action=window $CONF_FILE") - [[ "$t2_button_lclick_action" == "colmenu" ]] && out2+=(" $COL_MENU_DESC") || out2+=(" $COL_MENU_DESC,mb-setvar t2_button_lclick_action=colmenu $CONF_FILE") + [[ "$t2_button_lclick_action" == "window" ]] && out2+=(" $_COL_WINDOW_DESC") || out2+=(" $_COL_WINDOW_DESC,mb-setvar t2_button_lclick_action=window $CONF_FILE") + [[ "$t2_button_lclick_action" == "colmenu" ]] && out2+=(" $_COL_MENU_DESC") || out2+=(" $_COL_MENU_DESC,mb-setvar t2_button_lclick_action=colmenu $CONF_FILE") ;; esac -. $HOME/.config/mabox/mabox.conf +#. $HOME/.config/mabox/mabox.conf if [[ $panels_heightpos == "top" ]]; then @@ -292,25 +303,27 @@ JGWIDTH=$((jgtools_padding + 270 + jgtools_padding)) THUMB="${THUMBDIR}/${NAME}.png" if [[ ! -f "$THUMB" ]] then - convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} + magick convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} fi #TEMP POSITION: MENU_VALIGN="top" - MENU_MARGIN_Y="60" + MENU_MARGIN_Y="80" mkconfigfile cat < ${MENU_ITEMS} @icon,,$((jgtools_padding )),$((jgtools_padding)),270,150,4,left,top,,,${THUMB} +@rect,,$((jgtools_padding)),$((jgtools_padding + 119)),270,28,0,left,top,#222222 20,#222222 70, +@text,,$((jgtools_padding + 6)),$((jgtools_padding + 100)),100,28,0,left,top,#DDDDDD 60,${WINCLR}, +@text,,$((jgtools_padding + 84)),$((jgtools_padding + 119)),150,28,0,left,top,#FFFFFF ,${WINCLR},$_TITLE + $(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out1[@]}") $(printf '%s\n' "${out2[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null - exit 0 - fi printf '%s\n' "${out[@]}" @@ -321,7 +334,7 @@ case $LANG in *) REMOVE="Remove this menu from panel";; esac printf '%s\n' "^sep()" -printf '%s\n' "$REMOVE,mb-setvar places_jgwallpaperchanger=false;mb-jgtools places" +printf '%s\n' "$_REMOVE,mb-setvar places_jgwallpaperchanger=false;mb-jgtools places" fi printf '%s\n' "${out1[@]}" printf '%s\n' "${out2[@]}" @@ -330,5 +343,5 @@ printf '%s\n' "${out2[@]}" case "$1" in lclick) lclick;; - *) main "$@";; + *) time main "$@";; esac diff --git a/usr/bin/jgwallpapergenerate b/usr/bin/jgwallpapergenerate index fc9915f..9bc5179 100755 --- a/usr/bin/jgwallpapergenerate +++ b/usr/bin/jgwallpapergenerate @@ -1,109 +1,107 @@ #!/bin/bash # jgwallpapergenerate - submenu to generate wallpapers # -CONFIG_DIR="$HOME/.config/mbxutils/imgw" -CONFIG_FILE="$CONFIG_DIR/imgw.cfg" +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="Wygenerowane obrazy" - OPENDIR="Otwórz katalog" - EMPTYDIR="Opróżnij katalog" - SIZE="rozmiar" - SETTINGS="Ustawienia" - PREVIEW="Pokaż podgląd" - YES="tak" - NO="nie" + _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" - SIZE="size" - SETTINGS="Settings" - PREVIEW="Show preview?" - YES="yes" - NO="no" + _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)/mb-canvas" +DIR="$(xdg-user-dir PICTURES)/imagick" 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") +[[ "$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") +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") +out+=("\"\"\"^sep($_IMAGES: $files - ${du})\"\"\"") +out+=(" $_OPENDIR,xdg-open $DIR") +out+=(" $_EMPTYDIR,rm ${DIR}/*.*;$me") fi -out+=("^sep($SETTINGS)") -out+=("$PREVIEW [ ${l_show_preview} ],^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") - +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}") @@ -113,7 +111,7 @@ if [[ "$1" == "-s" ]]; then . $HOME/.config/mabox/mabox.conf out+=("^sep()") -out+=(" ⮜ $WALLPAPERMENU,jgwallpaperchanger -s") +out+=(" ${arrow_string_left} ${arrow_string_left} $_WALLPAPERMENU,jgwallpaperchanger -s") if [[ $panels_heightpos == "top" ]]; then MENU_VALIGN="top" @@ -131,12 +129,18 @@ 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[@]}") -$(printf '%s\n' "${out2[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null @@ -145,4 +149,4 @@ exit 0 fi printf '%s\n' "${out[@]}" -printf '%s\n' "${out2[@]}" +