wallpaper tools review

master
Daniel Napora 2024-09-16 00:47:14 +02:00
parent 24b72a7d45
commit eb8b58be74
2 changed files with 236 additions and 219 deletions

View File

@ -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 <<EOF > ${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 <small>(<i>zatrzymany</i>)</small>"
STOPS="Zatrzymaj Pokaz slajdów <small>(<i>działający - interwał: $interval sek.</i>)</small>"
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="<b>Colorizer</b> menu główne"
COLORIZER_FONTS="Konfiguruj <b>Czcionki</b>"
COLORIZER_OB="Moduł <b>Openbox</b>"
COLORIZER_MENU="Moduł <b>Menu</b>"
COLORIZER_CONKY="Moduł <b>Conky</b>"
COLORIZER_PYRADIO="Moduł <b>PyRadio</b>"
COLORIZER_CAVA="Moduł <b>Cava</b>"
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 <b>losową</b> tapetę"
CHOOSE_DESC="<b>Wybierz</b> tapetę (z menu kontekstowego)"
PREVIEW_DESC="<b>Podgląd</b> <i>use</i> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦱</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦰</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Enter</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Esc</small> </span>"
COL_WINDOW_DESC="Colorizer - <b>okno</b>"
COL_MENU_DESC="Colorizer - dynamiczne <b>menu</b>"
_TITLE="Zmieniacz <b>tapet</b>"
_WALLPAPERS="Tapety"
_RANDWALL="<b>Losowa</b> tapeta"
_EDIT_WPDIRS="Edytuj katalogi z tapetami"
_GENERATOR="<b>Generuj</b> <small>(ImageMagick)</small>..."
_CHOOSE_WP="<b>Wybierz</b> tapetę..."
_SLIDESHOW_DESC="Pokaz slajdów"
_SLIDESHOW="pokaz slajdów"
_ABOUT_SLIDESHOW="O pokazie slajdów"
_STARTS="Uruchom Pokaz slajdów <small>(<i>zatrzymany</i>)</small>"
_STOPS="Zatrzymaj Pokaz slajdów <small>(<i>działający - interwał: $interval sek.</i>)</small>"
_INTERVAL="Interwał slajdów"
_SEC="sekund"
_WPDIR="Katalog"
_WPDIRS="Katalogi z tapetami"
_WPDIRS_DESC="<small><i>dla <b>losowa</b>/<b>podgląd</b>/<b>pokaz slajdów</b></i></small>"
_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="<b>Colorizer</b> menu główne"
_COLORIZER_FONTS="Konfiguruj <b>Czcionki</b>"
_COLORIZER_OB="Moduł <b>Openbox</b>"
_COLORIZER_MENU="Moduł <b>Menu</b>"
_COLORIZER_CONKY="Moduł <b>Conky</b>"
_COLORIZER_PYRADIO="Moduł <b>PyRadio</b>"
_COLORIZER_CAVA="Moduł <b>Cava</b>"
_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 <b>losową</b> tapetę"
_CHOOSE_DESC="<b>Wybierz</b> tapetę (z menu kontekstowego)"
_PREVIEW_DESC="<b>Podgląd</b> <i>użyj</i> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦱</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦰</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Enter</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Esc</small> </span>"
_COL_WINDOW_DESC="Colorizer - <b>okno</b>"
_COL_MENU_DESC="Colorizer - dynamiczne <b>menu</b>"
;;
*)
TITLE="Wallpaper Changer"
NITROGEN="Nitrogen"
WALLPAPERS="Wallpapers"
RANDWALL="Random Wallpaper"
EDIT_WPDIRS="Edit Wallpaper dirs"
GENERATOR="Generate (ImageMagick)..."
CHOOSE_WP="Choose Wallpaper <small>(from context menu)</small>"
SLIDESHOW_DESC="Wallpaper Slideshow"
SLIDESHOW="slideshow"
STARTS="Start Slideshow <small>(<i>stopped</i>)</small>"
STOPS="Stop Slideshow <small>(<i>running - interval: $interval sec.</i>)</small>"
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="<b>Colorizer</b> rootmenu"
COLORIZER_FONTS="Configure <b>Fonts</b>"
COLORIZER_OB="<b>Openbox</b> module"
COLORIZER_MENU="<b>Menus/SidePanels</b> module"
COLORIZER_CONKY="<b>Conky</b> module"
COLORIZER_PYRADIO="<b>PyRadio</b> module"
COLORIZER_CAVA="<b>Cava</b> module"
B_LC_ACTION="<i>left-click</i> 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 <b>random</b> wallpaper"
CHOOSE_DESC="<b>Choose</b> wallpaper (<i>from context menu</i>)"
PREVIEW_DESC="Preview &amp; set <i>use</i> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦱</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦰</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Enter</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Esc</small> </span>"
COL_WINDOW_DESC="Colorizer - <b>window</b>"
COL_MENU_DESC="Colorizer - dynamic <b>menu</b>"
_TITLE="Wallpaper <b>Menu</b>"
_WALLPAPERS="Wallpapers"
_RANDWALL="<b>Random</b> Wallpaper"
_EDIT_WPDIRS="Edit Wallpaper dirs"
_GENERATOR="<b>Generate</b> <small>(ImageMagick)</small>..."
_CHOOSE_WP="<b>Choose</b> Wallpaper <small>(from context menu)</small>"
_SLIDESHOW_DESC="Wallpaper <b>Slideshow</b>"
_SLIDESHOW="slideshow"
_ABOUT_SLIDESHOW="About Slideshow"
_STARTS="Start Slideshow <small>(<i>stopped</i>)</small>"
_STOPS="Stop Slideshow <small>(<i>running - interval: $interval sec.</i>)</small>"
_INTERVAL="Interval"
_SEC="seconds"
_WPDIR="Directory"
_WPDIRS="Directories with Wallpapers"
_WPDIRS_DESC="<small><i>for <b>random</b>/<b>preview</b>/<b>slideshow</b> utils</i></small>"
_TOTAL="Total"
_WPS="wallpapers in"
_DIRS="dirs"
_LEFTPANEL="Left panel"
_OBTHEME="Openbox Theme"
_MENUPANELS="Menus/Panels"
_COLORIZER_HELP="Main Window and Help"
_COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
_COLORIZER_FONTS="Configure <b>Fonts</b>"
_COLORIZER_OB="<b>Openbox</b> module"
_COLORIZER_MENU="<b>Menus/SidePanels</b> module"
_COLORIZER_CONKY="<b>Conky</b> module"
_COLORIZER_PYRADIO="<b>PyRadio</b> module"
_COLORIZER_CAVA="<b>Cava</b> module"
_B_LC_ACTION="<i>left-click</i> 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 <b>random</b> wallpaper"
_CHOOSE_DESC="<b>Choose</b> wallpaper (<i>from context menu</i>)"
_PREVIEW_DESC="<b>Preview</b> &amp; set <i>use</i> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦱</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>󱦰</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Enter</small> </span> <span bgcolor='#333333' color='#d3d3d3'> <small>Esc</small> </span>"
_COL_WINDOW_DESC="Colorizer - <b>window</b>"
_COL_MENU_DESC="Colorizer - dynamic <b>menu</b>"
;;
esac
@ -159,51 +163,58 @@ esac
help="\nBased on <a href='https://forum.maboxlinux.org/t/chwp-desktop-wallpaper-changer/496'>idea</a> 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+=("<big>󰉔</big> $CHOOSE_WP,pcmanwp")
out+=("<big></big> $_RANDWALL,mbwallpaper -o;$me")
out+=("<big>󰉔</big> $_CHOOSE_WP,pcmanwp")
out+=("^sep()")
out+=("<big></big> $RANDWALL,mbwallpaper -o;$me")
out+=("<big>易</big> $PREVIEW_DESC,mbwallpaper -c")
#out+=("$GENERATOR,^pipe(jgwallpapergenerate)")
out+=("<big>󰧸</big> $SLIDESHOW_DESC,^checkout(sshow)")
out+=("<big>易</big> $_PREVIEW_DESC,mbwallpaper -c")
out+=("<big>󰧸</big> $_SLIDESHOW_DESC,^checkout(sshow)")
out+=("<big>󱡄</big> $_GENERATOR,^pipe(jgwallpapergenerate)")
out+=("^sep()")
out+=("<big></big> Wp dir [ <b>${wallpaper_dir2}</b> ],^checkout(wpdirs)")
out+=("<big></big> $_WPDIR [ <b>${wallpaper_dir2}</b> ],^checkout(wpdirs)")
out2+=("^tag(wpdirs)")
out2+=("^sep(Wallpaper dirs)")
out2+=("^sep(<small><i>for <b>random</b>/<b>preview</b>/<b>slideshow</b> utils</i></small>)")
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+=("<big>綠</big> <b>${dir}</b>") || out2+=("<big>祿</big> ${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+=("<big>綠</big> <small>(${wallp})</small> <b>${dir}</b>") || out2+=("<big>祿</big> <small>(${wallp})</small> ${dir},mbwallpaper changedir ${dir};$me")
wpimgs=$((wpimgs+wallp))
done
out2+=("^sep()")
out2+=("<big></big> $EDIT_WPDIRS,xdg-open $CNF_FILE")
out2+=("^sep($_TOTAL: <b>$wpimgs</b> $_WPS <b>${#wpdirs[@]}</b> $_DIRS)")
out2+=("<big></big> $_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 [ <b>$interval</b> ] <small>($SEC)</small>,^checkout(interval)")
out1+=("^sep($_SLIDESHOW_DESC)")
out1+=("$_STARTS,run_wallpaperslideshow")
out1+=("$_INTERVAL [ <b>$interval</b> ] <small>($_SEC)</small>,^checkout(interval)")
out1+=("^sep()")
#out1+=("<big></big> $EDITCONF ,xdg-open $CONF_FILE")
#out1+=("<big></big> $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 "<tt> %4s</tt>,%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: <b>[ $RAND ]</b>,^checkout(laction)");;
choose) out+=("$B_LC_ACTION: <b>[ $CHOOSE ]</b>,^checkout(laction)");;
preview) out+=("$B_LC_ACTION: <b>[ $PREVIEW ]</b>,^checkout(laction)");;
menu) out+=("$B_LC_ACTION: <b>[ $WALL_MENU ]</b>,^checkout(laction)");;
slideshow) out+=("$B_LC_ACTION: <b>[ $SLIDESHOW ]</b>,^checkout(laction)");;
window) out+=("$B_LC_ACTION: <b>[ $COL_WINDOW ]</b>,^checkout(laction)");;
colmenu) out+=("$B_LC_ACTION: <b>[ $COL_MENU ]</b>,^checkout(laction)");;
*) out+=("$B_LC_ACTION: <b>[ $CHOOSE ]</b>,^checkout(laction)");;
random) out+=("󰳽 $_B_LC_ACTION: <b>[ $_RAND ]</b>,^checkout(laction)");;
choose) out+=("󰳽 $_B_LC_ACTION: <b>[ $_CHOOSE ]</b>,^checkout(laction)");;
preview) out+=("󰳽 $_B_LC_ACTION: <b>[ $_PREVIEW ]</b>,^checkout(laction)");;
menu) out+=("󰳽 $_B_LC_ACTION: <b>[ $_WALL_MENU ]</b>,^checkout(laction)");;
slideshow) out+=("󰳽 $_B_LC_ACTION: <b>[ $_SLIDESHOW ]</b>,^checkout(laction)");;
window) out+=("󰳽 $_B_LC_ACTION: <b>[ $_COL_WINDOW ]</b>,^checkout(laction)");;
colmenu) out+=("󰳽 $_B_LC_ACTION: <b>[ $_COL_MENU ]</b>,^checkout(laction)");;
*) out+=("󰳽 $_B_LC_ACTION: <b>[ $_CHOOSE ]</b>,^checkout(laction)");;
esac
out2+=("^tag(laction)")
out2+=("^sep(Panel button left-click action)")
[[ "$t2_button_lclick_action" == "random" ]] && out2+=("<big>綠</big> $RANDOM_DESC") || out2+=("<big>祿</big> $RANDOM_DESC,mb-setvar t2_button_lclick_action=random $CONF_FILE")
[[ "$t2_button_lclick_action" == "choose" ]] && out2+=("<big>綠</big> $CHOOSE_DESC") || out2+=("<big>祿</big> $CHOOSE_DESC,mb-setvar t2_button_lclick_action=choose $CONF_FILE")
[[ "$t2_button_lclick_action" == "preview" ]] && out2+=("<big>綠</big> $PREVIEW_DESC") || out2+=("<big>祿</big> $PREVIEW_DESC,mb-setvar t2_button_lclick_action=preview $CONF_FILE")
[[ "$t2_button_lclick_action" == "menu" ]] && out2+=("<big>綠</big> $WALL_MENU_DESC") || out2+=("<big>祿</big> $WALL_MENU_DESC,mb-setvar t2_button_lclick_action=menu $CONF_FILE")
[[ "$t2_button_lclick_action" == "slideshow" ]] && out2+=("<big>綠</big> $SLIDESHOW_DESC") || out2+=("<big>祿</big> $SLIDESHOW_DESC,mb-setvar t2_button_lclick_action=slideshow $CONF_FILE")
out2+=("^sep($_P_B_LC_ACTION)")
[[ "$t2_button_lclick_action" == "random" ]] && out2+=("<big>綠</big> $_RANDOM_DESC") || out2+=("<big>祿</big> $_RANDOM_DESC,mb-setvar t2_button_lclick_action=random $CONF_FILE")
[[ "$t2_button_lclick_action" == "choose" ]] && out2+=("<big>綠</big> $_CHOOSE_DESC") || out2+=("<big>祿</big> $_CHOOSE_DESC,mb-setvar t2_button_lclick_action=choose $CONF_FILE")
[[ "$t2_button_lclick_action" == "preview" ]] && out2+=("<big>綠</big> $_PREVIEW_DESC") || out2+=("<big>祿</big> $_PREVIEW_DESC,mb-setvar t2_button_lclick_action=preview $CONF_FILE")
[[ "$t2_button_lclick_action" == "menu" ]] && out2+=("<big>綠</big> $_WALL_MENU_DESC") || out2+=("<big>祿</big> $_WALL_MENU_DESC,mb-setvar t2_button_lclick_action=menu $CONF_FILE")
[[ "$t2_button_lclick_action" == "slideshow" ]] && out2+=("<big>綠</big> $_SLIDESHOW_DESC") || out2+=("<big>祿</big> $_SLIDESHOW_DESC,mb-setvar t2_button_lclick_action=slideshow $CONF_FILE")
out2+=("^sep()")
[[ "$t2_button_lclick_action" == "window" ]] && out2+=("<big>綠</big> $COL_WINDOW_DESC") || out2+=("<big>祿</big> $COL_WINDOW_DESC,mb-setvar t2_button_lclick_action=window $CONF_FILE")
[[ "$t2_button_lclick_action" == "colmenu" ]] && out2+=("<big>綠</big> $COL_MENU_DESC") || out2+=("<big>祿</big> $COL_MENU_DESC,mb-setvar t2_button_lclick_action=colmenu $CONF_FILE")
[[ "$t2_button_lclick_action" == "window" ]] && out2+=("<big>綠</big> $_COL_WINDOW_DESC") || out2+=("<big>祿</big> $_COL_WINDOW_DESC,mb-setvar t2_button_lclick_action=window $CONF_FILE")
[[ "$t2_button_lclick_action" == "colmenu" ]] && out2+=("<big>綠</big> $_COL_MENU_DESC") || out2+=("<big>祿</big> $_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 <<EOF > ${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},<span size='41600' font_family='Ubuntu'><big></big></span>
@text,,$((jgtools_padding + 84)),$((jgtools_padding + 119)),150,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'>$_TITLE</span>
$(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' "<i>$REMOVE</i>,mb-setvar places_jgwallpaperchanger=false;mb-jgtools places"
printf '%s\n' "<i>$_REMOVE</i>,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

View File

@ -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 <<EOF > ${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="<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="<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)"
;;
*)
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"
_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>"
;;
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 [ <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")
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}")
@ -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 <<EOF > ${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},<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>
$(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[@]}"