diff --git a/usr/bin/jgpicom-pipe b/usr/bin/jgpicom-pipe index 8dfa220..b00c855 100755 --- a/usr/bin/jgpicom-pipe +++ b/usr/bin/jgpicom-pipe @@ -2,6 +2,8 @@ # jgpicom-pipe - pipemenu to start, stop, restart Picom and manage Picom configs (WIP) # Copyright (C) 2020-2024 napcok +#TODO recognize rule-based configs (since picom v12) and don't show link to picom-conf + . "$HOME/.config/mabox/mabox.conf" backend=${picom_renderer:-glx} @@ -26,6 +28,8 @@ case $LANG in RENDERER="Rendering Backend" GLX="glx (zalecany)" XRENDER="xrender (dla starszego sprzętu)" + _COLORIZER_ROOT="Colorizer - menu główne" + _LEFTSIDEPANEL="Lewy panel boczny" ;; es*) ENABLE="Activar Compositor" @@ -41,6 +45,8 @@ case $LANG in RENDERER="Rendering Backend" GLX="glx (recommended)" XRENDER="xrender (for older hardware)" + _COLORIZER_ROOT="Colorizer rootmenu" + _LEFTSIDEPANEL="Left Sidepanel" ;; *) ENABLE="Start Compositor" @@ -52,38 +58,43 @@ case $LANG in EDIT="Edit Compositor settings file" CONFIG_GUI="Configure with GUI (picom-conf)" INSTALL_GUI="Install picom-conf (GUI)" - OPENDIR="Open ~/.config/picom/configs directory" + OPENDIR="Open ~/.config/picom/configs dir" RENDERER="Rendering Backend" GLX="glx (recommended)" XRENDER="xrender (for older hardware)" + _COLORIZER_ROOT="Colorizer rootmenu" + _LEFTSIDEPANEL="Left Sidepanel" ;; esac -menu() { +me="jgpicom-pipe -s" + out+=("^sep(Picom)") if ! pidof picom > /dev/null; then - out+=("$ENABLE,mabox-compositor --start") + out+=(" $ENABLE,mabox-compositor --start;${me}") else - out+=("$RESTART,mabox-compositor --restart") - out+=("$DISABLE,mabox-compositor --stop") + out+=(" $RESTART,mabox-compositor --restart;${me}") + out+=(" $DISABLE,mabox-compositor --stop;${me}") fi +out+=("^sep($RENDERER)") +[[ "$backend" == "glx" ]] && out+=(" $GLX" " $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart;${me}") || out+=(" $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart;${me}" " $XRENDER") out+=("^sep($CHOOSE)") if [ "$(readlink $CONFFILE)" -ef "/dev/null" ];then - out+=("$DEVNULL") + out+=(" $DEVNULL") else - out+=("$DEVNULL,ln -sf /dev/null $CONFFILE;mabox-compositor --restart") + out+=(" $DEVNULL,ln -sf /dev/null $CONFFILE;mabox-compositor --restart;${me}") fi for item in "$CONFDIR"/*.conf; do if [ -f "$item" ];then if [ "$(readlink $CONFFILE)" -ef "$item" ];then - out+=("${item##*/}") + out+=(" ${item##*/}") else - out+=("${item##*/},ln -sf $item $CONFFILE;mabox-compositor --restart") + out+=(" ${item##*/},ln -sf $item $CONFFILE;mabox-compositor --restart;${me}") fi fi done @@ -91,25 +102,89 @@ done out+=("^sep($EDIT_TITLE)") if [ -f "$CONFFILE" ];then if [ ! "$(readlink $CONFFILE)" -ef "/dev/null" ];then -out+=("$EDIT,xdg-open $CONFFILE") +out+=(" $EDIT,xdg-open $CONFFILE") if hash picom-conf 2>&1 >/dev/null then - out+=("$CONFIG_GUI,picom-conf") + out+=(" $CONFIG_GUI,picom-conf") else - out+=("$INSTALL_GUI,pamac-installer picom-conf-git") + out+=(" $INSTALL_GUI,pamac-installer picom-conf-git") fi fi fi -out+=("$OPENDIR,exo-open --launch FileManager $CONFDIR") +out+=(" $OPENDIR,exo-open --launch FileManager $CONFDIR") + + + + +if [[ "$1" == "-s" ]]; then + . /usr/share/mb-jgtools/pipemenu-standalone.cfg + + + CNF_DIR="$HOME/.config/colorizer" + CNF_FILE="$CNF_DIR/colorizer.conf" + source "$CNF_FILE" + + out+=("^sep()") + out+=(" ${arrow_string_left} $_COLORIZER_ROOT,colorizer -s") + out+=(" ${arrow_string_left} ${arrow_string_left} $_LEFTSIDEPANEL,mb-jgtools places") + + if [[ "$colorizer_size" == "full" ]];then + eval $(xdotool getdisplaygeometry --shell) + MENU_HEIGHT_MIN="$HEIGHT" + MENU_HEIGHT_MAX=$MENU_HEIGHT_MIN + jgtools_radius=0 + menu_margin_x="0" + else + MENU_VALIGN="center" + menu_margin_x=${submenu_spacing:-0} + fi + + + MENU_HALIGN="left" + jgmenu_icon_size=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)) + + #WALLPAPER + read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | tail -1 | cut -d'=' -f2) + THUMBDIR="$HOME/.cache/colorizer/thumbs" + mkdir -p ${THUMBDIR} + NAME=${WALLPATH////_} + if [[ "${NAME}" =~ ^_home_.* ]]; then + n=${#HOME} + ((n++)) + NAME=${NAME:${n}} + fi + THUMB="${THUMBDIR}/${NAME}.png" + if [[ ! -f "$THUMB" ]] + then + convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} + fi + + mkconfigfile + +[[ "$GR" == "1" ]] && clr=${GR_FROM} || clr=${FG} + +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, +@icon,,$((jgtools_padding+4)),$((jgtools_padding+82)),64,64,4,left,top,,,/usr/share/icons/hicolor/scalable/apps/compton.svg +#@text,,$((jgtools_padding + 10)),$((jgtools_padding + 106)),100,28,0,left,top,#FFFFFF ,${WINCLR}, +@text,,$((jgtools_padding + 88)),$((jgtools_padding + 116)),180,28,0,left,top,#FFFFFF ,${WINCLR},Mabox Compositor settings + + +$(printf '%s\n' "${out[@]}") + +EOF + + jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null + exit 0 +fi + -out+=("^sep($RENDERER)") -[[ "$backend" == "glx" ]] && out+=(" $GLX" " $XRENDER,mb-setvar picom_renderer=xrender;mabox-compositor --restart") || out+=(" $GLX,mb-setvar picom_renderer=glx;mabox-compositor --restart" " $XRENDER") printf '%s\n' "${out[@]}" -} - -case "$1" in - start) start;; - menu) menu "$2";; -esac diff --git a/usr/bin/jgwallpaperchanger b/usr/bin/jgwallpaperchanger index 7743309..0e1b504 100755 --- a/usr/bin/jgwallpaperchanger +++ b/usr/bin/jgwallpaperchanger @@ -1,6 +1,9 @@ #!/bin/bash # jgwallpaperchanger - dynamic menu (or submenu) to configure/set wallpapers # +#TODO wallpaper colors on image +#TODO quickly colorize OB,Conky,menus from wp-colors + apply predefined schemes + if [[ $1 == "-r" || "$1" == "-d" ]];then me="${0##*/} -s" else @@ -49,13 +52,13 @@ fi lclick(){ case $t2_button_lclick_action in - random) mbwallpaper -o;; - choose) pcmanwp;; - preview) mbwallpaper -c;; - menu) jgwallpaperchanger ipc;; - slideshow) run_wallpaperslideshow;; - window) ycolorizer;; - colmenu) colorizer -s;; + random) mbwallpaper -o;; + choose) pcmanwp;; + preview) mbwallpaper -c;; + menu) jgwallpaperchanger ipc;; + slideshow) run_wallpaperslideshow;; + window) ycolorizer;; + colmenu) colorizer -s;; esac } @@ -84,10 +87,11 @@ case $LANG in _DIRS="katalogach" _LEFTPANEL="Lewy panel" _OBTHEME="Motyw Openbox" - _MENUPANELS="Menu i Panele" - _COLORIZER_HELP="Okno główne i Pomoc" + _MENUPANELS="Menu i Panele" + _COLORIZER_HELP="Okno główne i Pomoc" _COLORIZER_ROOT="Colorizer menu główne" _COLORIZER_FONTS="Konfiguruj Czcionki" + _COLORIZER_PICOM="Kompozytor Picom" _COLORIZER_OB="Moduł Openbox" _COLORIZER_MENU="Moduł Menu" _COLORIZER_CONKY="Moduł Conky" @@ -104,7 +108,7 @@ case $LANG in _COL_MENU="menu" _RANDOM_DESC="Ustaw losową tapetę" _CHOOSE_DESC="Wybierz tapetę (z menu kontekstowego)" - _PREVIEW_DESC="Podgląd użyj 󱦱 󱦰 Enter Esc " + _PREVIEW_DESC="Podgląd użyj 󱦱 󱦰 Enter Esc " _COL_WINDOW_DESC="Colorizer - okno" _COL_MENU_DESC="Colorizer - dynamiczne menu" ;; @@ -130,10 +134,11 @@ case $LANG in _DIRS="dirs" _LEFTPANEL="Left panel" _OBTHEME="Openbox Theme" - _MENUPANELS="Menus/Panels" - _COLORIZER_HELP="Main Window and Help" + _MENUPANELS="Menus/Panels" + _COLORIZER_HELP="Main Window and Help" _COLORIZER_ROOT="Colorizer rootmenu" _COLORIZER_FONTS="Configure Fonts" + _COLORIZER_PICOM="Compositor settings (Picom)" _COLORIZER_OB="Openbox module" _COLORIZER_MENU="Menus/SidePanels module" _COLORIZER_CONKY="Conky module" @@ -150,7 +155,7 @@ case $LANG in _COL_MENU="menu" _RANDOM_DESC="Set random wallpaper" _CHOOSE_DESC="Choose wallpaper (from context menu)" - _PREVIEW_DESC="Preview & set use 󱦱 󱦰 Enter Esc " + _PREVIEW_DESC="Preview & set use 󱦱 󱦰 Enter Esc " _COL_WINDOW_DESC="Colorizer - window" _COL_MENU_DESC="Colorizer - dynamic menu" ;; @@ -168,41 +173,41 @@ if ! pgrep -f "mbwallpaper -s" > /dev/null; then #out+=("$NITROGEN,nitrogen") out+=(" $_RANDWALL,mbwallpaper -o;$me") out+=("󰉔 $_CHOOSE_WP,pcmanwp") - out+=("^sep()") + out+=("^sep()") out+=(" $_PREVIEW_DESC,mbwallpaper -c") - out+=("󰧸 $_SLIDESHOW_DESC,^checkout(sshow)") + out+=("󰧸 $_SLIDESHOW_DESC,^checkout(sshow)") out+=("󱡄 $_GENERATOR,^pipe(jgwallpapergenerate)") - out+=("^sep()") - out+=(" $_WPDIR [ ${wallpaper_dir2} ],^checkout(wpdirs)") - out2+=("^tag(wpdirs)") - 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 $#) - if [[ "$wallp" -gt "1" ]];then + out+=("^sep()") + out+=(" $_WPDIR [ ${wallpaper_dir2} ],^checkout(wpdirs)") + out2+=("^tag(wpdirs)") + 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 $#) + if [[ "$wallp" -gt "1" ]];then imagickdir="$(xdg-user-dir PICTURES)/imagick" imagickdir=${imagickdir/$HOME/\~} wpdirs=("$imagickdir" "${wpdirs[@]}") - fi + fi - wpdirs=("/usr/share/backgrounds/" "${wpdirs[@]}") - #notify-send.sh "DIRS" "${#wpdirs[@]}" - - - wpimgs=0 - for dir in "${wpdirs[@]}" - do - 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($_TOTAL: $wpimgs $_WPS ${#wpdirs[@]} $_DIRS)") + wpdirs=("/usr/share/backgrounds/" "${wpdirs[@]}") + #notify-send.sh "DIRS" "${#wpdirs[@]}" + + + wpimgs=0 + for dir in "${wpdirs[@]}" + do + 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($_TOTAL: $wpimgs $_WPS ${#wpdirs[@]} $_DIRS)") out2+=(" $_EDIT_WPDIRS,xdg-open $CNF_FILE") - + else out+=("$_STOPS,killall mbwallpaper;pkill -f 'yad --not';$me") fi @@ -240,6 +245,8 @@ case "$1" in out+=("^sep()") out+=("$_COLORIZER_FONTS,colorizer-fonts -s") out+=("^sep()") + out+=("$_COLORIZER_PICOM,jgpicom-pipe -s") + out+=("^sep()") out+=("$_COLORIZER_OB,colorizer-ob -s") out+=("$_COLORIZER_MENU,colorizer-menus -s") out+=("$_COLORIZER_CONKY,colorizer-conky -s") @@ -250,15 +257,15 @@ 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)");; - colmenu) out+=("󰳽 $_B_LC_ACTION: [ $_COL_MENU ],^checkout(laction)");; - *) out+=("󰳽 $_B_LC_ACTION: [ $_CHOOSE ],^checkout(laction)");; - esac + 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($_P_B_LC_ACTION)") @@ -346,6 +353,6 @@ printf '%s\n' "${out2[@]}" case "$1" in - lclick) lclick;; - *) time main "$@";; + lclick) lclick;; + *) time main "$@";; esac