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 #!/bin/bash
# jgwallpaperchanger - dynamic menu (or submenu) to configure/set wallpapers # jgwallpaperchanger - dynamic menu (or submenu) to configure/set wallpapers
# #
if [[ $1 == "-r" ]];then if [[ $1 == "-r" || "$1" == "-d" ]];then
me="${0##*/} -s" me="${0##*/} -s"
else else
me="${0##*/} ${1:--s}" me="${0##*/} ${1:--s}"
@ -21,8 +21,6 @@ cat <<EOF > ${CONF_FILE}
wallpaper_dir=/usr/share/backgrounds/ wallpaper_dir=/usr/share/backgrounds/
# Rotate time in seconds # Rotate time in seconds
interval=10 interval=10
# Wallpaper setter program: nitrogen or feh
setter=nitrogen
# Tint2 panel executor button left click action # Tint2 panel executor button left click action
t2_button_lclick_action=choose t2_button_lclick_action=choose
EOF EOF
@ -65,90 +63,96 @@ esac
main(){ main(){
case $LANG in case $LANG in
pl*) pl*)
TITLE="Zmieniacz tapet" _TITLE="Zmieniacz <b>tapet</b>"
NITROGEN="Nitrogen" _WALLPAPERS="Tapety"
WALLPAPERS="Tapety" _RANDWALL="<b>Losowa</b> tapeta"
RANDWALL="Losowa tapeta" _EDIT_WPDIRS="Edytuj katalogi z tapetami"
EDIT_WPDIRS="Edytuj katalogi z tapetami" _GENERATOR="<b>Generuj</b> <small>(ImageMagick)</small>..."
GENERATOR="Generuj (ImageMagick)..." _CHOOSE_WP="<b>Wybierz</b> tapetę..."
CHOOSE_WP="Wybierz tapetę..." _SLIDESHOW_DESC="Pokaz slajdów"
SLIDESHOW_DESC="Pokaz slajdów" _SLIDESHOW="pokaz slajdów"
SLIDESHOW="pokaz slajdów" _ABOUT_SLIDESHOW="O pokazie slajdów"
STARTS="Uruchom Pokaz slajdów <small>(<i>zatrzymany</i>)</small>" _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>" _STOPS="Zatrzymaj Pokaz slajdów <small>(<i>działający - interwał: $interval sek.</i>)</small>"
CONF="Konfiguracja" _INTERVAL="Interwał slajdów"
WALLDIR="Katalog z tapetami" _SEC="sekund"
INTERVAL="Interwał slajdów" _WPDIR="Katalog"
SEC="sekund" _WPDIRS="Katalogi z tapetami"
EDITCONF="Edytuj plik konfiguracyjny" _WPDIRS_DESC="<small><i>dla <b>losowa</b>/<b>podgląd</b>/<b>pokaz slajdów</b></i></small>"
OPENDIR="Otwórz katalog z tapetami" _TOTAL="Razem"
LEFTPANEL="Lewy panel" _WPS="tapety w"
OBTHEME="Motyw Openbox" _DIRS="katalogach"
MENUPANELS="Menu i Panele" _LEFTPANEL="Lewy panel"
COLORIZER_HELP="Okno główne i Pomoc" _OBTHEME="Motyw Openbox"
COLORIZER_ROOT="<b>Colorizer</b> menu główne" _MENUPANELS="Menu i Panele"
COLORIZER_FONTS="Konfiguruj <b>Czcionki</b>" _COLORIZER_HELP="Okno główne i Pomoc"
COLORIZER_OB="Moduł <b>Openbox</b>" _COLORIZER_ROOT="<b>Colorizer</b> menu główne"
COLORIZER_MENU="Moduł <b>Menu</b>" _COLORIZER_FONTS="Konfiguruj <b>Czcionki</b>"
COLORIZER_CONKY="Moduł <b>Conky</b>" _COLORIZER_OB="Moduł <b>Openbox</b>"
COLORIZER_PYRADIO="Moduł <b>PyRadio</b>" _COLORIZER_MENU="Moduł <b>Menu</b>"
COLORIZER_CAVA="Moduł <b>Cava</b>" _COLORIZER_CONKY="Moduł <b>Conky</b>"
B_LC_ACTION="Akcja przycisku (lewy klik)" _COLORIZER_PYRADIO="Moduł <b>PyRadio</b>"
RAND="losuj" _COLORIZER_CAVA="Moduł <b>Cava</b>"
CHOOSE="wybierz" _B_LC_ACTION="Akcja przycisku (lewy klik)"
WALL_MENU="menu tapet" _P_B_LC_ACTION="Po lewym kliku w przycisk na panelu"
WALL_MENU_DESC="Menu Tapet" _RAND="losuj"
PREVIEW="podgląd" _CHOOSE="wybierz"
COL_WINDOW="okno" _WALL_MENU="menu tapet"
COL_MENU="menu" _WALL_MENU_DESC="Menu Tapet"
RANDOM_DESC="Ustaw <b>losową</b> tapetę" _PREVIEW="podgląd"
CHOOSE_DESC="<b>Wybierz</b> tapetę (z menu kontekstowego)" _COL_WINDOW="okno"
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_MENU="menu"
COL_WINDOW_DESC="Colorizer - <b>okno</b>" _RANDOM_DESC="Ustaw <b>losową</b> tapetę"
COL_MENU_DESC="Colorizer - dynamiczne <b>menu</b>" _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" _TITLE="Wallpaper <b>Menu</b>"
NITROGEN="Nitrogen" _WALLPAPERS="Wallpapers"
WALLPAPERS="Wallpapers" _RANDWALL="<b>Random</b> Wallpaper"
RANDWALL="Random Wallpaper" _EDIT_WPDIRS="Edit Wallpaper dirs"
EDIT_WPDIRS="Edit Wallpaper dirs" _GENERATOR="<b>Generate</b> <small>(ImageMagick)</small>..."
GENERATOR="Generate (ImageMagick)..." _CHOOSE_WP="<b>Choose</b> Wallpaper <small>(from context menu)</small>"
CHOOSE_WP="Choose Wallpaper <small>(from context menu)</small>" _SLIDESHOW_DESC="Wallpaper <b>Slideshow</b>"
SLIDESHOW_DESC="Wallpaper Slideshow" _SLIDESHOW="slideshow"
SLIDESHOW="slideshow" _ABOUT_SLIDESHOW="About Slideshow"
STARTS="Start Slideshow <small>(<i>stopped</i>)</small>" _STARTS="Start Slideshow <small>(<i>stopped</i>)</small>"
STOPS="Stop Slideshow <small>(<i>running - interval: $interval sec.</i>)</small>" _STOPS="Stop Slideshow <small>(<i>running - interval: $interval sec.</i>)</small>"
CONF="Configuration" _INTERVAL="Interval"
WALLDIR="Images dir" _SEC="seconds"
INTERVAL="Interval" _WPDIR="Directory"
SEC="seconds" _WPDIRS="Directories with Wallpapers"
EDITCONF="Edit config file" _WPDIRS_DESC="<small><i>for <b>random</b>/<b>preview</b>/<b>slideshow</b> utils</i></small>"
OPENDIR="Open wallpaper directory" _TOTAL="Total"
LEFTPANEL="Left panel" _WPS="wallpapers in"
OBTHEME="Openbox Theme" _DIRS="dirs"
MENUPANELS="Menus/Panels" _LEFTPANEL="Left panel"
COLORIZER_HELP="Main Window and Help" _OBTHEME="Openbox Theme"
COLORIZER_ROOT="<b>Colorizer</b> rootmenu" _MENUPANELS="Menus/Panels"
COLORIZER_FONTS="Configure <b>Fonts</b>" _COLORIZER_HELP="Main Window and Help"
COLORIZER_OB="<b>Openbox</b> module" _COLORIZER_ROOT="<b>Colorizer</b> rootmenu"
COLORIZER_MENU="<b>Menus/SidePanels</b> module" _COLORIZER_FONTS="Configure <b>Fonts</b>"
COLORIZER_CONKY="<b>Conky</b> module" _COLORIZER_OB="<b>Openbox</b> module"
COLORIZER_PYRADIO="<b>PyRadio</b> module" _COLORIZER_MENU="<b>Menus/SidePanels</b> module"
COLORIZER_CAVA="<b>Cava</b> module" _COLORIZER_CONKY="<b>Conky</b> module"
B_LC_ACTION="<i>left-click</i> action" _COLORIZER_PYRADIO="<b>PyRadio</b> module"
RAND="random" _COLORIZER_CAVA="<b>Cava</b> module"
CHOOSE="choose" _B_LC_ACTION="<i>left-click</i> action"
WALL_MENU="wallmenu" _P_B_LC_ACTION="Panel button left-click action"
WALL_MENU_DESC="Wallpaper Menu" _RAND="random"
PREVIEW="preview and set" _CHOOSE="choose"
COL_WINDOW="window" _WALL_MENU="wallmenu"
COL_MENU="menu" _WALL_MENU_DESC="Wallpaper Menu"
RANDOM_DESC="Set <b>random</b> wallpaper" _PREVIEW="preview and set"
CHOOSE_DESC="<b>Choose</b> wallpaper (<i>from context menu</i>)" _COL_WINDOW="window"
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_MENU="menu"
COL_WINDOW_DESC="Colorizer - <b>window</b>" _RANDOM_DESC="Set <b>random</b> wallpaper"
COL_MENU_DESC="Colorizer - dynamic <b>menu</b>" _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 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" 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($TITLE)")
out+=("^sep($WALLPAPERS)") [[ "$1" == "-s" || "$1" == "ipc" ]] && : || out+=("^sep($_WALLPAPERS)")
if ! pgrep -f "mbwallpaper -s" > /dev/null; then if ! pgrep -f "mbwallpaper -s" > /dev/null; then
#out+=("$NITROGEN,nitrogen") #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+=("^sep()")
out+=("<big></big> $RANDWALL,mbwallpaper -o;$me") out+=("<big>易</big> $_PREVIEW_DESC,mbwallpaper -c")
out+=("<big>易</big> $PREVIEW_DESC,mbwallpaper -c") out+=("<big>󰧸</big> $_SLIDESHOW_DESC,^checkout(sshow)")
#out+=("$GENERATOR,^pipe(jgwallpapergenerate)") out+=("<big>󱡄</big> $_GENERATOR,^pipe(jgwallpapergenerate)")
out+=("<big>󰧸</big> $SLIDESHOW_DESC,^checkout(sshow)")
out+=("^sep()") 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+=("^tag(wpdirs)")
out2+=("^sep(Wallpaper dirs)") out2+=("^sep($_WPDIRS)")
out2+=("^sep(<small><i>for <b>random</b>/<b>preview</b>/<b>slideshow</b> utils</i></small>)") out2+=("^sep($_WPDIRS_DESC)")
readarray -t wpdirs < <(grep -v '^\s*$\|^#\|^\s*\#' "$CNF_FILE") 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[@]}") wpdirs=("/usr/share/backgrounds/" "${wpdirs[@]}")
#notify-send.sh "DIRS" "${#wpdirs[@]}" #notify-send.sh "DIRS" "${#wpdirs[@]}"
wpimgs=0
for dir in "${wpdirs[@]}" for dir in "${wpdirs[@]}"
do do
wpdir=${dir/\~/$HOME}
[[ "$wallpaper_dir2" == "${dir}" ]] && out2+=("<big>綠</big> <b>${dir}</b>") || out2+=("<big>祿</big> ${dir},mbwallpaper changedir ${dir};$me") 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 done
out2+=("^sep()") out2+=("^sep($_TOTAL: <b>$wpimgs</b> $_WPS <b>${#wpdirs[@]}</b> $_DIRS)")
out2+=("<big></big> $EDIT_WPDIRS,xdg-open $CNF_FILE") out2+=("<big></big> $_EDIT_WPDIRS,xdg-open $CNF_FILE")
else else
out+=("$STOPS,killall mbwallpaper;pkill -f 'yad --not';$me") out+=("$_STOPS,killall mbwallpaper;pkill -f 'yad --not';$me")
fi fi
out1+=("^tag(sshow)") out1+=("^tag(sshow)")
out1+=("^sep($SLIDESHOW_DESC)") out1+=("^sep($_SLIDESHOW_DESC)")
out1+=("$STARTS,run_wallpaperslideshow") out1+=("$_STARTS,run_wallpaperslideshow")
out1+=("$INTERVAL [ <b>$interval</b> ] <small>($SEC)</small>,^checkout(interval)") out1+=("$_INTERVAL [ <b>$interval</b> ] <small>($_SEC)</small>,^checkout(interval)")
out1+=("^sep()") out1+=("^sep()")
#out1+=("<big></big> $EDITCONF ,xdg-open $CONF_FILE") #out1+=("<big></big> $EDITCONF ,xdg-open $CONF_FILE")
#out1+=("<big></big> $OPENDIR,pcmanfm -n $wallpaper_dir") #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+=("^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 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 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");; -c) out+=(" ${arrow_string_left} Colorizer,colorizer -s");;
-u) out+=(" ${arrow_string_left} Settings menu,mb-jgtools settings");; -u) out+=(" ${arrow_string_left} Settings menu,mb-jgtools settings");;
-d) POSITION_MODE=pointer;; -d) POSITION_MODE=pointer;;
ipc) POSITION_MODE=${1:-fixed} ipc) POSITION_MODE=${1:-fixed}
out+=("^sep(Mabox Colorizer)") out+=("^sep(Mabox Colorizer)")
out+=("$COLORIZER_HELP,ycolorizer") out+=("$_COLORIZER_HELP,ycolorizer")
out+=("$COLORIZER_ROOT,colorizer -s") out+=("$_COLORIZER_ROOT,colorizer -s")
out+=("^sep()") out+=("^sep()")
out+=("$COLORIZER_FONTS,colorizer-fonts -s") out+=("$_COLORIZER_FONTS,colorizer-fonts -s")
out+=("^sep()") out+=("^sep()")
out+=("$COLORIZER_OB,colorizer-ob -s") out+=("$_COLORIZER_OB,colorizer-ob -s")
out+=("$COLORIZER_MENU,colorizer-menus -s") out+=("$_COLORIZER_MENU,colorizer-menus -s")
out+=("$COLORIZER_CONKY,colorizer-conky -s") out+=("$_COLORIZER_CONKY,colorizer-conky -s")
out+=("^sep()") out+=("^sep()")
out+=("$COLORIZER_PYRADIO,colorizer-pyradio -s") out+=("$_COLORIZER_PYRADIO,colorizer-pyradio -s")
out+=("$COLORIZER_CAVA,colorizer-cava -s") out+=("$_COLORIZER_CAVA,colorizer-cava -s")
out+=("^sep()") out+=("^sep()")
case $t2_button_lclick_action in case $t2_button_lclick_action in
random) out+=("$B_LC_ACTION: <b>[ $RAND ]</b>,^checkout(laction)");; random) out+=("󰳽 $_B_LC_ACTION: <b>[ $_RAND ]</b>,^checkout(laction)");;
choose) out+=("$B_LC_ACTION: <b>[ $CHOOSE ]</b>,^checkout(laction)");; choose) out+=("󰳽 $_B_LC_ACTION: <b>[ $_CHOOSE ]</b>,^checkout(laction)");;
preview) out+=("$B_LC_ACTION: <b>[ $PREVIEW ]</b>,^checkout(laction)");; preview) out+=("󰳽 $_B_LC_ACTION: <b>[ $_PREVIEW ]</b>,^checkout(laction)");;
menu) out+=("$B_LC_ACTION: <b>[ $WALL_MENU ]</b>,^checkout(laction)");; menu) out+=("󰳽 $_B_LC_ACTION: <b>[ $_WALL_MENU ]</b>,^checkout(laction)");;
slideshow) out+=("$B_LC_ACTION: <b>[ $SLIDESHOW ]</b>,^checkout(laction)");; slideshow) out+=("󰳽 $_B_LC_ACTION: <b>[ $_SLIDESHOW ]</b>,^checkout(laction)");;
window) out+=("$B_LC_ACTION: <b>[ $COL_WINDOW ]</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)");; colmenu) out+=("󰳽 $_B_LC_ACTION: <b>[ $_COL_MENU ]</b>,^checkout(laction)");;
*) out+=("$B_LC_ACTION: <b>[ $CHOOSE ]</b>,^checkout(laction)");; *) out+=("󰳽 $_B_LC_ACTION: <b>[ $_CHOOSE ]</b>,^checkout(laction)");;
esac esac
out2+=("^tag(laction)") out2+=("^tag(laction)")
out2+=("^sep(Panel button left-click action)") 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" == "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" == "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" == "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" == "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") [[ "$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()") 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" == "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" == "colmenu" ]] && out2+=("<big>綠</big> $_COL_MENU_DESC") || out2+=("<big>祿</big> $_COL_MENU_DESC,mb-setvar t2_button_lclick_action=colmenu $CONF_FILE")
;; ;;
esac esac
. $HOME/.config/mabox/mabox.conf #. $HOME/.config/mabox/mabox.conf
if [[ $panels_heightpos == "top" ]]; then if [[ $panels_heightpos == "top" ]]; then
@ -292,25 +303,27 @@ JGWIDTH=$((jgtools_padding + 270 + jgtools_padding))
THUMB="${THUMBDIR}/${NAME}.png" THUMB="${THUMBDIR}/${NAME}.png"
if [[ ! -f "$THUMB" ]] if [[ ! -f "$THUMB" ]]
then then
convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} magick convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB}
fi fi
#TEMP POSITION: #TEMP POSITION:
MENU_VALIGN="top" MENU_VALIGN="top"
MENU_MARGIN_Y="60" MENU_MARGIN_Y="80"
mkconfigfile mkconfigfile
cat <<EOF > ${MENU_ITEMS} cat <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding )),$((jgtools_padding)),270,150,4,left,top,,,${THUMB} @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' "${out[@]}")
$(printf '%s\n' "${out1[@]}") $(printf '%s\n' "${out1[@]}")
$(printf '%s\n' "${out2[@]}") $(printf '%s\n' "${out2[@]}")
EOF EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
exit 0 exit 0
fi fi
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
@ -321,7 +334,7 @@ case $LANG in
*) REMOVE="Remove this menu from panel";; *) REMOVE="Remove this menu from panel";;
esac esac
printf '%s\n' "^sep()" 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 fi
printf '%s\n' "${out1[@]}" printf '%s\n' "${out1[@]}"
printf '%s\n' "${out2[@]}" printf '%s\n' "${out2[@]}"
@ -330,5 +343,5 @@ printf '%s\n' "${out2[@]}"
case "$1" in case "$1" in
lclick) lclick;; lclick) lclick;;
*) main "$@";; *) time main "$@";;
esac esac

View File

@ -1,109 +1,107 @@
#!/bin/bash #!/bin/bash
# jgwallpapergenerate - submenu to generate wallpapers # jgwallpapergenerate - submenu to generate wallpapers
# #
CONFIG_DIR="$HOME/.config/mbxutils/imgw" CONFIG_DIR="$HOME/.config/mabox/tools"
CONFIG_FILE="$CONFIG_DIR/imgw.cfg" CONFIG_FILE="$CONFIG_DIR/mb-canvas.cfg"
mkdir -p $CONFIG_DIR mkdir -p $CONFIG_DIR
if [ ! -f $CONFIG_FILE ]; then if [ ! -f $CONFIG_FILE ]; then
cat <<EOF > ${CONFIG_FILE} 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 show_preview=yes
EOF EOF
fi fi
source <(grep = $CONFIG_FILE) source <(grep = $CONFIG_FILE)
case $LANG in case $LANG in
pl*) pl*)
TITLE="Generator tapet (ImageMagick)" _TITLE="<b>Generator</b> tapet <small>(ImageMagick)</small>"
RANDCOLORS="Losowe kolory" _RANDCOLORS="Losowe kolory"
PICKCOLORS="Wybór kolorów..." _PICKCOLORS="Wybór kolorów..."
WALLPAPERMENU="Menu Tapety" _WALLPAPERMENU="Menu Tapety"
RANDOMEFFECT="<b>Losowy</b> efekt" _RANDOMEFFECT="<b>Losowy</b> efekt"
SOLID="<b>Jednolity</b> kolor" _SOLID="<b>Jednolity</b> kolor"
BLURRED="<b>Rozmycie</b>" _BLURRED="<b>Rozmycie</b>"
LINEAR="Gradient <b>liniowy</b>" _LINEAR="Gradient <b>liniowy</b>"
RADIAL="Gradient <b>promieniowy</b>" _RADIAL="Gradient <b>promieniowy</b>"
TWISTED="<b>Skręcony</b> gradient " _TWISTED="<b>Skręcony</b> gradient "
BILINEAR="Gradient <b>dwuliniowy</b>" _BILINEAR="Gradient <b>dwuliniowy</b>"
PLASMA="<b>Plazma</b>" _PLASMA="<b>Plazma</b>"
ONECOLOR="(jeden kolor)" _ONECOLOR="(jeden kolor)"
TWOCOLORS="(dwa kolory)" _TWOCOLORS="(dwa kolory)"
FOURCOLORS="(cztery kolory)" _FOURCOLORS="(cztery kolory)"
IMAGES="Wygenerowane obrazy" _IMAGES="Utworzone obrazy"
OPENDIR="Otwórz katalog" _OPENDIR="Otwórz katalog"
EMPTYDIR="Opróżnij katalog" _EMPTYDIR="Opróżnij katalog"
SIZE="rozmiar" _SETTINGS="Ustawienia"
SETTINGS="Ustawienia" _PREVIEW="Pokaż podgląd"
PREVIEW="Pokaż podgląd" _IMG_FORMAT="<i>format obrazków</i>"
YES="tak" _RECOMMENDED="(małe pliki - zalecany)"
NO="nie"
;; ;;
*) *)
TITLE="Wallpaper Generator (ImageMagick)" _TITLE="Wallpaper <b>Generator</b> <small>(ImageMagick)</small>"
RANDCOLORS="Random colors" _RANDCOLORS="Random colors"
PICKCOLORS="Pick colors..." _PICKCOLORS="Pick colors..."
WALLPAPERMENU="Wallpapers Menu" _WALLPAPERMENU="Wallpapers Menu"
RANDOMEFFECT="<b>Random</b> effect" _RANDOMEFFECT="<b>Random</b> effect"
SOLID="<b>Solid</b> color" _SOLID="<b>Solid</b> color"
BLURRED="<b>Blurred</b>" _BLURRED="<b>Blurred</b>"
LINEAR="<b>Linear</b> gradient" _LINEAR="<b>Linear</b> gradient"
RADIAL="<b>Radial</b> gradient" _RADIAL="<b>Radial</b> gradient"
TWISTED="<b>Twisted</b> gradient" _TWISTED="<b>Twisted</b> gradient"
BILINEAR="<b>Bilinear</b> gradient" _BILINEAR="<b>Bilinear</b> gradient"
PLASMA="<b>Plasma</b>" _PLASMA="<b>Plasma</b>"
ONECOLOR="(pick one color)" _ONECOLOR="(pick one color)"
TWOCOLORS="(pick two colors)" _TWOCOLORS="(pick two colors)"
FOURCOLORS="(pick four colors)" _FOURCOLORS="(pick four colors)"
IMAGES="Generated images" _IMAGES="Generated images"
OPENDIR="Open directory" _OPENDIR="Open directory"
EMPTYDIR="Empty directory" _EMPTYDIR="Empty directory"
SIZE="size" _SETTINGS="Settings"
SETTINGS="Settings" _PREVIEW="Show preview"
PREVIEW="Show preview?" _IMG_FORMAT="<i>image format</i>"
YES="yes" _RECOMMENDED="<i>(small filesize - recommended)</i>"
NO="no"
;; ;;
esac esac
. $HOME/.config/mabox/mabox.conf . $HOME/.config/mabox/mabox.conf
DIR="$(xdg-user-dir PICTURES)/mb-canvas" DIR="$(xdg-user-dir PICTURES)/imagick"
files="$(ls ${DIR}|wc -l)" files="$(ls ${DIR}|wc -l)"
du="$(du -sh ${DIR}|awk '{print $1}')" du="$(du -sh ${DIR}|awk '{print $1}')"
me="jgwallpapergenerate -s" me="jgwallpapergenerate -s"
[[ "$show_preview" == "yes" ]] && l_show_preview="${YES}" || l_show_preview="${NO}" [[ "$1" != "-s" ]] && out+=("^sep($_TITLE)")
out+=("^sep($_RANDCOLORS)")
out+=("^sep($TITLE)") out+=("$_SOLID,mb-canvas -Ras;$me")
out+=("^sep($RANDCOLORS)") out+=("$_BLURRED,mb-canvas -RaB;$me")
out+=("$SOLID,mb-canvas -Ras;$me") out+=("$_LINEAR,mb-canvas -Ral;$me")
out+=("$BLURRED,mb-canvas -RaB;$me") out+=("$_RADIAL,mb-canvas -Rar;$me")
out+=("$LINEAR,mb-canvas -Ral;$me") out+=("$_TWISTED,mb-canvas -Rat;$me")
out+=("$RADIAL,mb-canvas -Rar;$me") out+=("$_BILINEAR,mb-canvas -Rab;$me")
out+=("$TWISTED,mb-canvas -Rat;$me") out+=("$_PLASMA,mb-canvas -Rap;$me")
out+=("$BILINEAR,mb-canvas -Rab;$me")
out+=("$PLASMA,mb-canvas -Rap;$me")
out+=("^sep()") out+=("^sep()")
out+=("$RANDOMEFFECT,mb-canvas -Ra;$me") out+=("$_RANDOMEFFECT,mb-canvas -Ra;$me")
out+=("^sep($PICKCOLORS)") out+=("^sep($_PICKCOLORS)")
out+=("$SOLID $ONECOLOR,mb-canvas -as;$me") out+=("$_SOLID $_ONECOLOR,mb-canvas -as;$me")
out+=("$LINEAR $TWOCOLORS,mb-canvas -al;$me") out+=("$_LINEAR $_TWOCOLORS,mb-canvas -al;$me")
out+=("$RADIAL $TWOCOLORS,mb-canvas -ar;$me") out+=("$_RADIAL $_TWOCOLORS,mb-canvas -ar;$me")
out+=("$TWISTED $TWOCOLORS,mb-canvas -at;$me") out+=("$_TWISTED $_TWOCOLORS,mb-canvas -at;$me")
out+=("$BILINEAR $FOURCOLORS,mb-canvas -ab;$me") out+=("$_BILINEAR $_FOURCOLORS,mb-canvas -ab;$me")
out+=("$PLASMA,mb-canvas -ap;$me") out+=("$_PLASMA,mb-canvas -ap;$me")
if [ "$files" -gt "0" ]; then if [ "$files" -gt "0" ]; then
out+=("\"\"\"^sep($IMAGES: $files - $SIZE: ${du})\"\"\"") out+=("\"\"\"^sep($_IMAGES: $files - ${du})\"\"\"")
out+=("$OPENDIR,xdg-open $DIR") out+=("$_OPENDIR,xdg-open $DIR")
out+=("$EMPTYDIR,rm ${DIR}/*.png;$me") out+=(" $_EMPTYDIR,rm ${DIR}/*.*;$me")
fi fi
out+=("^sep($SETTINGS)") out+=("^sep($_SETTINGS)")
out+=("$PREVIEW [ <b>${l_show_preview}</b> ],^checkout(preview)") [[ "$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)")
out2+=("^tag(preview)") [[ "$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}")
out2+=("^sep($PREVIEW)") [[ "$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}")
out2+=("$YES ,mb-setvar show_preview=yes $CONFIG_FILE;$me")
out2+=("$NO,mb-setvar show_preview=no $CONFIG_FILE;$me")
@ -113,7 +111,7 @@ if [[ "$1" == "-s" ]]; then
. $HOME/.config/mabox/mabox.conf . $HOME/.config/mabox/mabox.conf
out+=("^sep()") out+=("^sep()")
out+=(" ⮜ $WALLPAPERMENU,jgwallpaperchanger -s") out+=(" ${arrow_string_left} ${arrow_string_left} $_WALLPAPERMENU,jgwallpaperchanger -s")
if [[ $panels_heightpos == "top" ]]; then if [[ $panels_heightpos == "top" ]]; then
MENU_VALIGN="top" MENU_VALIGN="top"
@ -131,12 +129,18 @@ JGWIDTH=40
menu_margin_x=${submenu_spacing:-0} menu_margin_x=${submenu_spacing:-0}
[ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius [ $(pidof picom) ] && MENU_RADIUS=$jgtools_radius
[ -z $jgmenu_use_borders ] && menu_border=0 [ -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 mkconfigfile
cat <<EOF > ${MENU_ITEMS} 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' "${out[@]}")
$(printf '%s\n' "${out2[@]}")
EOF EOF
jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null
@ -145,4 +149,4 @@ exit 0
fi fi
printf '%s\n' "${out[@]}" printf '%s\n' "${out[@]}"
printf '%s\n' "${out2[@]}"