From 24b72a7d455d3456e631f39b9a92f1824c0a9fa3 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Tue, 10 Sep 2024 07:02:49 +0200 Subject: [PATCH] wallmenu update --- usr/bin/jgwallpaperchanger | 82 ++++++++++++++++++++++++++++---------- 1 file changed, 61 insertions(+), 21 deletions(-) diff --git a/usr/bin/jgwallpaperchanger b/usr/bin/jgwallpaperchanger index 0993bfe..6cf4667 100755 --- a/usr/bin/jgwallpaperchanger +++ b/usr/bin/jgwallpaperchanger @@ -30,6 +30,9 @@ fi # read config variables from file source <(grep = $CONF_FILE) +wallpaper_dir2=${wallpaper_dir/$HOME/\~} +#notify-send.sh "Wallpaper Dir" "${wallpaper_dir}" + COLORIZER_CONF="$HOME/.config/colorizer/colorizer.conf" source ${COLORIZER_CONF} @@ -50,8 +53,11 @@ lclick(){ case $t2_button_lclick_action in random) mbwallpaper -o;; choose) pcmanwp;; + preview) mbwallpaper -c;; + menu) jgwallpaperchanger ipc;; + slideshow) run_wallpaperslideshow;; window) ycolorizer;; - menu) colorizer -s;; + colmenu) colorizer -s;; esac } @@ -66,7 +72,8 @@ case $LANG in EDIT_WPDIRS="Edytuj katalogi z tapetami" GENERATOR="Generuj (ImageMagick)..." CHOOSE_WP="Wybierz tapetę..." - SLIDESHOW="Pokaz slajdów" + 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" @@ -89,10 +96,14 @@ case $LANG in 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" ;; @@ -104,12 +115,13 @@ case $LANG in EDIT_WPDIRS="Edit Wallpaper dirs" GENERATOR="Generate (ImageMagick)..." CHOOSE_WP="Choose Wallpaper (from context menu)" - SLIDESHOW="Slideshow" + SLIDESHOW_DESC="Wallpaper Slideshow" + SLIDESHOW="slideshow" STARTS="Start Slideshow (stopped)" STOPS="Stop Slideshow (running - interval: $interval sec.)" CONF="Configuration" WALLDIR="Images dir" - INTERVAL="Slideshow Interval" + INTERVAL="Interval" SEC="seconds" EDITCONF="Edit config file" OPENDIR="Open wallpaper directory" @@ -124,13 +136,17 @@ case $LANG in COLORIZER_CONKY="Conky module" COLORIZER_PYRADIO="PyRadio module" COLORIZER_CAVA="Cava module" - B_LC_ACTION="Button left-click action" + 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" ;; @@ -140,18 +156,36 @@ esac -help="\nBased on Mabox forum member Shwaybo idea.\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 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)") -if ! pgrep mbwallpaper > /dev/null; then +if ! pgrep -f "mbwallpaper -s" > /dev/null; then #out+=("$NITROGEN,nitrogen") - out+=(" $RANDWALL,mbwallpaper -o;$me") out+=("󰉔 $CHOOSE_WP,pcmanwp") - #out+=("$GENERATOR,^pipe(jgwallpapergenerate)") - out+=("󰧸 $SLIDESHOW,^checkout(sshow)") out+=("^sep()") - out+=(" $EDIT_WPDIRS,xdg-open $CNF_FILE") + out+=(" $RANDWALL,mbwallpaper -o;$me") + out+=(" $PREVIEW_DESC,mbwallpaper -c") + #out+=("$GENERATOR,^pipe(jgwallpapergenerate)") + out+=("󰧸 $SLIDESHOW_DESC,^checkout(sshow)") + out+=("^sep()") + out+=(" Wp dir [ ${wallpaper_dir2} ],^checkout(wpdirs)") + out2+=("^tag(wpdirs)") + out2+=("^sep(Wallpaper dirs)") + out2+=("^sep(for random/preview/slideshow utils)") + + readarray -t wpdirs < <(grep -v '^\s*$\|^#\|^\s*\#' "$CNF_FILE") + wpdirs=("/usr/share/backgrounds/" "${wpdirs[@]}") + #notify-send.sh "DIRS" "${#wpdirs[@]}" + + + for dir in "${wpdirs[@]}" + do + + [[ "$wallpaper_dir2" == "${dir}" ]] && out2+=(" ${dir}") || out2+=(" ${dir},mbwallpaper changedir ${dir};$me") + done + out2+=("^sep()") + out2+=(" $EDIT_WPDIRS,xdg-open $CNF_FILE") else @@ -160,16 +194,16 @@ fi out1+=("^tag(sshow)") -out1+=("^sep($SLIDESHOW)") -out1+=("$STARTS,run_wallpaperslideshow;$me") -out1+=("\"\"\"$WALLDIR: [ $wallpaper_dir ]\"\"\",xdg-open $CONF_FILE") +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\" -o 'Edit configuration file:geany ~/.config/mbwallpaper/mbwallpaper.conf'\"\"\"") +#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\" \"\"\"") out2+=("^tag(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 @@ -185,7 +219,7 @@ case "$1" in -u) out+=(" ${arrow_string_left} Settings menu,mb-jgtools settings");; -d) POSITION_MODE=pointer;; ipc) POSITION_MODE=${1:-fixed} - out+=("^sep(Colorizer)") + out+=("^sep(Mabox Colorizer)") out+=("$COLORIZER_HELP,ycolorizer") out+=("$COLORIZER_ROOT,colorizer -s") out+=("^sep()") @@ -203,18 +237,24 @@ case "$1" in 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)");; - menu) out+=("$B_LC_ACTION: [ $COL_MENU ],^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" == "choose" ]] && out2+=(" $CHOOSE_DESC") || out2+=(" $CHOOSE_DESC,mb-setvar t2_button_lclick_action=choose $CONF_FILE") [[ "$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" == "menu" ]] && out2+=(" $COL_MENU_DESC") || out2+=(" $COL_MENU_DESC,mb-setvar t2_button_lclick_action=menu $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