#!/bin/bash me="colorizer-conky -s" CONKYDIR="$HOME/.config/conky" BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc" COLORIZERDIR="$HOME/.config/colorizer" CONKYTHEMEDIR="$COLORIZERDIR/conky/themes" if [ ! -d "$CONKYTHEMEDIR" ];then mkdir -p "$CONKYTHEMEDIR" rsync -a /usr/share/mabox-colorizer/themes/conky/* ${CONKYTHEMEDIR}/ fi LNG=${LANG:0:2} if [ ! -f "${BASECONKY}" ]; then if [ -d "/usr/share/mabox/lang/$LNG/.config/conky" ]; then rsync -a /usr/share/mabox/lang/$LNG/.config/conky/* ${CONKYDIR}/ else rsync -a /usr/share/mabox/lang/en/.config/conky/* ${CONKYDIR}/ fi fi CNF_DIR="$HOME/.config/colorizer/conky" CNF_FILE="$CNF_DIR/conky.cfg" [ ! -d "$CNF_DIR" ] && mkdir -p "$CNF_DIR" if [ ! -f $CNF_FILE ]; then cat < ${CNF_FILE} update_notifications=true EOF fi case "$LANG" in pl*) COLORIZECONKY="Conky Manager" NO_CONKY_RUNNING="Brak uruchomionych Conky" RUN_CONKY_SESSION="Uruchom zapisaną sesję" MOVEABLEALL="Ustaw wszystkie (przeciągaj)..." GENERATEFROMWP="Generuj z kolorów tapety" LIGHTBG="Jasne tło" DARKBG="Ciemne tło" GLOBALSETTINGS="Ustawienia globalne (dla wszystkich)" REGENERATE="Motywy kolorów" OPENTHEMEDIR="Otwórz katalog motywów" APPLY_THEME="Zastosuj motyw" DEFCOLOR="Domyślny kolor (tekst i ramka)" COLOR_0="Kolor 0 (tekst2)" COLOR_1="Kolor 1 (większy tekst)" COLOR_2="Kolor 2 (pasek/graf)" BACKGROUND="Kolor tła" TRANSPARENT="Przezroczyste?" YES="Tak" NO="Nie" FONTS="Czcionka" SELECTFONT="Wybierz czcionkę..." INCREASE="Powiększ" DECREASE="Pomniejsz" OLINE="Obrys" SHADOW="Cień" DRAW="Rysuj" BORDERS="Obramowanie" STIPPLED_BORDERS="Nakrapiane" SOLID_LINE="linia ciągła" RUNNING_CONKIES="Uruchomione Conky" STOP_ALL="Zatrzymaj wszystkie" MORECONKIES="Więcej Conky..." CLICKTOSTART="Kliknij aby uruchomić" STARTALL="Uruchom wszystkie" RESET="Resetuj" RESETALL="Resetuj wszystkie" RESETCOLORS="Przywróć domyślne kolory" AREYOUSURE="Czy aby napewno?" ;; *) COLORIZECONKY="Conky Manager" NO_CONKY_RUNNING="No Conky running" RUN_CONKY_SESSION="Run Conky session" MOVEABLEALL="Make moveable all..." GENERATEFROMWP="Generate from wallpaper colors" LIGHTBG="Light Background" DARKBG="Dark Background" GLOBALSETTINGS="Global settings (apply to all)" REGENERATE="Color schemes" OPENTHEMEDIR="Open schemes dir" APPLY_THEME="Apply colorscheme" DEFCOLOR="Default color (text and border)" COLOR_0="Color 0 (text2)" COLOR_1="Color 1 (bigger text)" COLOR_2="Color 2 (bars/graphs)" BACKGROUND="Background color" TRANSPARENT="Transparent?" YES="Yes" NO="No" FONTS="Font" SELECTFONT="Select Font..." INCREASE="Increase" DECREASE="Decrease" OLINE="Outline" SHADOW="Shadow" DRAW="Draw" BORDERS="Borders" STIPPLED_BORDERS="Stippled borders" SOLID_LINE="solid line" RUNNING_CONKIES="Running Conkys" STOP_ALL="Stop All" MORECONKIES="More Conkies Available" CLICKTOSTART="click to start" STARTALL="Start all" RESET="Reset" RESETALL="Reset all to defaults" RESETCOLORS="Restore default colors" AREYOUSURE="Are you sure?" ;; esac getvalues () { read WINTRANS <<< "$(grep own_window_transparent ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)" FONT=${FONTDEF%:*} FONTSIZE=${FONTDEF#*=} read WINCLR <<< "$(grep own_window_colour ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $WINCLR =~ ^#.* ]] && : || WINCLR="#${WINCLR}" read CLR <<< "$(grep default_color ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR =~ ^#.* ]] && : || CLR="#${CLR}" read CLR0 <<< "$(grep color0 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR0 =~ ^#.* ]] && : || CLR0="#${CLR0}" read CLR1 <<< "$(grep color1 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR1 =~ ^#.* ]] && : || CLR1="#${CLR1}" read CLR2 <<< "$(grep color2 ${BASECONKY} | cut -d'=' -f2 | cut -d"'" -f2)" [[ $CLR2 =~ ^#.* ]] && : || CLR2="#${CLR2}" read OUTLINE <<< "$(grep draw_outline ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read SHADES <<< "$(grep draw_shades ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" SHADOWS="no" [[ "$OUTLINE" == "true" ]] && SHADOWS="outline" [[ "$SHADES" == "true" ]] && SHADOWS="shadow" read BORD <<< "$(grep draw_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" read STIP <<< "$(grep stippled_borders ${BASECONKY} | cut -d'=' -f2 | cut -d"," -f1)" } if pgrep -af "conky.*mbcolor" >/dev/null; then getvalues [[ "$WINTRANS" == false ]] && BG="bgcolor='$WINCLR'" || BG="" out+=("^sep($COLORIZECONKY)") out+=(" $MOVEABLEALL,conkyctl makemoveableall") #while read -r pid b c confpath #do # filename=${confpath##*/} # name=${filename%%_mb*} # out+=("${name^},^pipe(conkyctl single ${confpath})") #done < <(pgrep -af "conky.*mbcolor") # array with running conkies - only filenames with full path readarray -t running < <(pgrep -af "conky -c " | cut -d' ' -f4) #array with all supported conkies for i in "$CONKYDIR"/*.con* "$CONKYDIR"/**/*.con*; do if [[ "$i" == *mbcolor* ]];then supported+=("$i") else if [[ "$i" != *"/*"* ]];then unsupported+=("$i") fi fi done #array with not started conkies notstarted=($(echo ${running[@]} ${supported[@]} ${unsupported[@]} ${unsupported[@]}| tr ' ' '\n' | sort | uniq -u)) notstarted_unsupported=($(echo ${running[@]} ${supported[@]} ${supported[@]} ${unsupported[@]} | tr ' ' '\n' | sort | uniq -u)) if [[ ${#running[@]} > 0 ]];then out+=("^sep($RUNNING_CONKIES)") for c in ${running[@]};do filename=${c##*/} name=${filename%%_mb*} title=${name//_/ } out+=("${title^},^pipe(conkyctl single ${c})") done out+=("^sep()") out+=("$STOP_ALL (${#running[@]}),conky_toggle;sleep .5;$me") fi if [[ ${#notstarted[@]} > 0 ]];then out+=("^sep($MORECONKIES)") out+=("^sep($CLICKTOSTART)") for c in ${notstarted[@]};do filename=${c##*/} name=${filename%%_mb*} title=${name//_/ } out+=("${title^},conkyctl startone ${c};$me") done if [[ ${#notstarted[@]} > 1 ]];then out+=("^sep()") out+=("$STARTALL (${#notstarted[@]}),conkyctl startall;$me") fi fi if [[ ${#notstarted_unsupported[@]} > 0 ]];then out+=("^sep()") out+=("UNSUPPORTED,^checkout(unsup)") out2+=("^tag(unsup)") out2+=("^sep(UNSUPPORTED)") for c in ${notstarted_unsupported[@]};do filename=${c##*/} name=${filename%%_mb*} title=${name//_/ } out2+=("${title^},conkyctl startone ${c};$me") done fi #GLOBAL START out+=("^sep($GLOBALSETTINGS)") out+=(" $REGENERATE,^checkout(regenconky)") out2+=("^tag(regenconky)") out2+=("^sep($REGENERATE)") out2+=("^sep($GENERATEFROMWP)") out2+=("$LIGHTBG,w2theme conky light;$me") out2+=("$DARKBG,w2theme conky dark;$me") out2+=("^sep($APPLY_THEME)") for i in "${COLORIZERDIR}"/conky/themes/*.colors do source "${i}" themefilename=${i##*/} themename=${themefilename%%.col*} out2+=(" $themename,conkyctl settheme_all $themefilename;$me") done out2+=("^sep()") out2+=(" $OPENTHEMEDIR,xdg-open ${COLORIZERDIR}/conky/themes/") out+=("^sep()") if [ "$WINTRANS" == false ];then out+=(" AbCd $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')") else out+=(" transparent $BACKGROUND,^pipe(mbclr '$WINCLR' conkyctl win_bgcolor_all '${BACKGROUND}' '$me')") fi out+=("$TRANSPARENT [ $WINTRANS ],^checkout(trans)") out+=("^sep()") out+=(" AbCd $DEFCOLOR,^pipe(mbclr '$CLR' conkyctl default_color_all '${DEFCOLOR}' '$me')") out+=(" AbCd $COLOR_0,^pipe(mbclr '$CLR0' conkyctl color0_all '${COLOR_0}' '$me')") out+=(" AbCd $COLOR_1,^pipe(mbclr '$CLR1' conkyctl color1_all '${COLOR_1}' '$me')") out+=(" AbCd $COLOR_2,^pipe(mbclr '$CLR2' conkyctl color2_all '${COLOR_2}' '$me')") #out+=("^sep()") out2+=("^tag(trans)") out2+=("^sep($TRANSPARENT)") out2+=("$YES,conkyctl transparent_all true;$me") out2+=("$NO,conkyctl transparent_all false;$me") out+=("^sep()") out+=("$FONTS [ $FONT $FONTSIZE ],^checkout(font)") out2+=("^tag(font)") out2+=("^sep($FONTS)") out2+=("$SELECTFONT,mb-setfont conky_all;$me") out2+=("^sep()") out2+=("++ $INCREASE,conkyctl basefont_inc_all;$me") out2+=("-- $DECREASE,conkyctl basefont_dec_all;$me") out+=("$OLINE/$SHADOW [ $SHADOWS ],^checkout(outline)") out2+=("^tag(outline)") out2+=("^sep($DRAW $OLINE/$SHADOW?)") out2+=("$NO,conkyctl shades_all no;$me") out2+=("^sep()") out2+=("$DRAW $SHADOW,conkyctl shades_all shadow;$me") out2+=("$DRAW $OLINE,conkyctl shades_all outline;$me") out+=("^sep()") out+=("$BORDERS [ $BORD $STIP ],^checkout(border)") out2+=("^tag(border)") out2+=("^sep($DRAW $BORDERS?)") out2+=("$YES,conkyctl draw_borders_all true;$me") out2+=("$NO,conkyctl draw_borders_all false;$me") out2+=("^sep($STIPPLED_BORDERS?)") out2+=("0 ($SOLID_LINE),conkyctl stippled_borders_all 0;$me") out2+=("^sep()") out2+=("1,conkyctl stippled_borders_all 1;$me") out2+=("2,conkyctl stippled_borders_all 2;$me") out2+=("3,conkyctl stippled_borders_all 3;$me") out2+=("4,conkyctl stippled_borders_all 4;$me") out+=("^sep($RESET)") out+=(" $RESETCOLORS,^checkout(resetcolors)") out2+=("^tag(resetcolors)") out2+=("^sep($AREYOUSURE)") out2+=("$YES,conkyctl resetcolorsall;$me") #out+=(" $RESETALL,^checkout(resetall)") NOT SAFE!!! #out2+=("^tag(resetall)") #out2+=("^sep($AREYOUSURE)") #out2+=("$YES,rm $BASECONKY;$me") else out+=("^sep($NO_CONKY_RUNNING)") SESSIONFILE=$HOME/.config/conky/conky-sessionfile if [ -f "$SESSIONFILE" ];then read N REST <<< $(wc -l "${SESSIONFILE}") if [[ "$N" -gt "0" ]];then out+=("$RUN_CONKY_SESSION ($N Conky),conky_toggle;$me") fi fi out+=("^sep($CLICKTOSTART)") for confpath in "$CONKYDIR"/*_mb*; do filename=${confpath##*/} name=${filename%%_mb*} title=${name//_/ } out+=("${title^},conkyctl startone ${confpath};$me") done out+=("^sep()") out+=("$STARTALL,conkyctl startall;$me") fi ### RUN if [[ "$1" == "-s" ]]; then . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $HOME/.config/mabox/mabox.conf source $HOME/.config/colorizer/colorizer.conf out+=("^sep()") out+=(" ⮜⮜⮜ Colorizer,colorizer -s") 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 + 278 + jgtools_padding)) MENU_PADDING_TOP=$((jgtools_padding + 158)) #WALLPAPER read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) WALLPAPER=${WALLPATH##*/} THUMBDIR="$HOME/.config/mabox/wallthumbs" mkdir -p ${THUMBDIR} THUMB="${THUMBDIR}/${WALLPAPER}.png" if [[ ! -f "$THUMB" ]] then convert ${WALLPATH} -resize 270x150^ -gravity center -extent 270x150 ${THUMB} fi mkconfigfile cat < ${MENU_ITEMS} @icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB} @rect,,$((jgtools_padding + 4)),$((jgtools_padding + 120)),270,34,0,left,top,#222222 20,#222222 70, #@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,/usr/share/mabox-colorizer/img/colorizer-conky.png @text,,$((jgtools_padding + 158)),$((jgtools_padding + 124)),120,30,0,left,top,#FFFFFF ,${WINCLR},Colorizer Conky @rect,,$((jgtools_padding + 244)),$((jgtools_padding + 6)),29,60,0,left,top,#FFFFFF 30,${WINCLR} 60, @rect,,$((jgtools_padding + 5)),$((jgtools_padding + 92)),29,60,0,left,top,#FFFFFF 30,${WINCLR} 60, @rect,,$((jgtools_padding + 36)),$((jgtools_padding + 112)),29,40,0,left,top,#FFFFFF 30,${WINCLR} 60, $(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out2[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null exit 0 fi printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}"