#!/bin/bash me="colorizer-menus -s" . $HOME/.config/mabox/mabox.conf case "$jgmenu_theme" in obtheme) OBTHEME=$(awk '// {while (getline n) {if (match(n, //)) {l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml"); #echo "$OBTHEME" THEMERC="$HOME/.config/mabox/jgobthemes/${OBTHEME}.colorrc" jgmenu_theme="$OBTHEME";; #only to show real theme name in menu *) THEMERC="$HOME/.config/mabox/jgobthemes/${jgmenu_theme}.colorrc";; esac # Backup original theme file if [ ! -f "${THEMERC}.bak" ]; then cp ${THEMERC} ${THEMERC}.bak fi getvalues () { read MBG MBGA<<< "$(grep 'color_menu_bg ' ${THEMERC} | cut -d'=' -f2)" read MBGT MBGTA<<< "$(grep 'color_menu_bg_to' ${THEMERC} | cut -d'=' -f2)" read MBORDER MBORDERA<<< "$(grep 'color_menu_border' ${THEMERC} | cut -d'=' -f2)" read GRADIENT<<< "$(grep 'menu_gradient_pos' ${THEMERC} | cut -d'=' -f2)" if [ "$GRADIENT" == "" ]; then mb-setvar menu_gradient_pos=none ${THEMERC} read GRADIENT<<< "$(grep 'menu_gradient_pos' ${THEMERC} | cut -d'=' -f2)" fi read SEPHALIGN<<< "$(grep 'sep_halign' ${THEMERC} | cut -d'=' -f2)" read SEPFG SEPFGA<<< "$(grep 'color_sep_fg' ${THEMERC} | cut -d'=' -f2)" read TBG TBGA<<< "$(grep 'color_title_bg' ${THEMERC} | cut -d'=' -f2)" read TFG TFGA<<< "$(grep 'color_title_fg' ${THEMERC} | cut -d'=' -f2)" read TBORDER TBORDERA<<< "$(grep 'color_title_border' ${THEMERC} | cut -d'=' -f2)" read NORMBG NORMBGA<<< "$(grep color_norm_bg ${THEMERC} | cut -d'=' -f2)" read NFG NFGA<<< "$(grep color_norm_fg ${THEMERC} | cut -d'=' -f2)" read SBG SBGA<<< "$(grep 'color_sel_bg' ${THEMERC} | cut -d'=' -f2)" read SFG SFGA<<< "$(grep 'color_sel_fg' ${THEMERC} | cut -d'=' -f2)" read SBORDER SBORDERA<<< "$(grep 'color_sel_border' ${THEMERC} | cut -d'=' -f2)" read IBORDER<<< "$(grep 'item_border' ${THEMERC} | cut -d'=' -f2)" read IRADIUS<<< "$(grep 'item_radius' ${THEMERC} | cut -d'=' -f2)" } getvalues out+=("^sep(Menu theme: ${jgmenu_theme})") out+=("$(printf '%3s' "$MBGA") COLOR_MENU_BG,^pipe(mbclr '$MBG' jgctl color_menu_bg COLOR_MENU_BG '$me')") out+=("$(printf '%3s' "$MBGTA") COLOR_MENU_BG_TO,^pipe(mbclr '$MBGT' jgctl color_menu_bg_to COLOR_MENU_BG_TO '$me')") out+=("$(printf '%3s' "$MBORDERA") COLOR_MENU_BORDER,^pipe(mbclr '$MBORDER' jgctl color_menu_border COLOR_MENU_BORDER '$me')") out+=("^sep()") out+=("GRADIENT_POS [ $GRADIENT ],^checkout(gradientpos)") out+=("^sep(item)") out+=("$(printf '%3s' "$NFGA") AbCd COLOR_NORM_FG,^pipe(mbclr '$NFG' jgctl color_norm_fg COLOR_NORM_FG '$me')") out+=("$(printf '%3s' "$SBGA") COLOR_SEL_BG,^pipe(mbclr '$SBG' jgctl color_sel_bg COLOR_SEL_BG '$me')") out+=("$(printf '%3s' "$SFGA") AbCd COLOR_SEL_FG,^pipe(mbclr '$SFG' jgctl color_sel_fg COLOR_SEL_FG '$me')") out+=("$(printf '%3s' "$SBORDERA") COLOR_SEL_BORDER,^pipe(mbclr '$SBORDER' jgctl color_sel_border COLOR_SEL_BORDER '$me')") out+=("ITEM_BORDER [ $IBORDER ],^checkout(itemborder)") out+=("ITEM_RADIUS [ $IRADIUS ],^checkout(itemradius)") out+=("^sep()") [[ ! -z "$NORMBG" ]] && out+=("$(printf '%3s' "$NORMBGA") COLOR_NORM_BG,^pipe(mbclr '$NORMBG' jgctl color_norm_bg COLOR_NORM_BG '$me')") out+=("^sep(separator/title)") out+=("$(printf '%3s' "$TBGA") COLOR_TITLE_BG,^pipe(mbclr '$TBG' jgctl color_title_bg COLOR_TITLE_BG '$me')") out+=("$(printf '%3s' "$TFGA") AbCd COLOR_TITLE_FG,^pipe(mbclr '$TFG' jgctl color_title_fg COLOR_TITLE_FG '$me')") out+=("$(printf '%3s' "$TBORDERA") COLOR_TITLE_BORDER,^pipe(mbclr '$TBORDER' jgctl color_title_border COLOR_TITLE_BORDER '$me')") out+=("^sep()") out+=("SEP_HALIGN [ $SEPHALIGN ],^checkout(sephalign)") out+=("^sep()") out+=("$(printf '%3s' "$SEPFGA") ------ COLOR_SEP_FG,^pipe(mbclr '$SEPFG' jgctl color_sep_fg COLOR_SEP_FG '$me')") out2+=("^tag(gradientpos)") out2+=("^sep(GRADIENT_POS $GRADIENT)") out2+=("none,jgctl menu_gradient_pos none;$me") out2+=("^sep()") out2+=("top,jgctl menu_gradient_pos top;$me") out2+=("right,jgctl menu_gradient_pos right;$me") out2+=("bottom,jgctl menu_gradient_pos bottom;$me") out2+=("left,jgctl menu_gradient_pos left;$me") out2+=("top_left,jgctl menu_gradient_pos top_left;$me") out2+=("top_right,jgctl menu_gradient_pos top_right;$me") out2+=("bottom_left,jgctl menu_gradient_pos bottom_left;$me") out2+=("bottom_right,jgctl menu_gradient_pos bottom_right;$me") out2+=("^tag(sephalign)") out2+=("^sep(SEP_HALIGN)") out2+=("left,jgctl sep_halign left;$me") out2+=("center,jgctl sep_halign center;$me") out2+=("right,jgctl sep_halign right;$me") out2+=("^tag(itemborder)") out2+=("^sep(ITEM_BORDER)") out2+=("0,jgctl item_border 0;$me") out2+=("^sep()") out2+=("1,jgctl item_border 1;$me") out2+=("2,jgctl item_border 2;$me") out2+=("^tag(itemradius)") out2+=("^sep(ITEM_RADIUS)") out2+=("0,jgctl item_radius 0;$me") out2+=("^sep()") out2+=("1,jgctl item_radius 1;$me") out2+=("2,jgctl item_radius 2;$me") out2+=("3,jgctl item_radius 3;$me") out2+=("4,jgctl item_radius 4;$me") out2+=("5,jgctl item_radius 5;$me") out2+=("6,jgctl item_radius 6;$me") out+=("^sep(MORE MENU SETTINGS)") out+=("Global Menu Settings,jgmenusettings-pipe -s") ### COPIED FROM jgmenusettings-pipe for now #out+=("FONT_ITEM [ ${menu_font_family:-0} ${menu_font_size:-0} ],mb-setfont menu_item;$me") #out+=("FONT_TITLE [ ${menu_sep_font_family:-0} ${menu_sep_font_size:-0} ],mb-setfont menu_sep;$me") #out+=("BORDER [ ${jgtools_border:-0} ],^checkout(mborder)") #out+=("PADDING [ ${jgtools_padding:-0} ],^checkout(mpadding)") #out+=("RADIUS [ ${jgtools_radius:-0} ],^checkout(mradius)") #out+=("SUBSPACING [ ${submenu_spacing:-0} ],^checkout(subspacing)") out2+=("^tag(mborder)") for i in 0 1 2 3 4 5 6 8 10 12; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_border=${i};$me")");done out2+=("^tag(mpadding)") for i in 0 2 4 6 8 10 12 14 16 18 20 22 24 28 32 40; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_padding=${i};$me")");done out2+=("^tag(mradius)") for i in 0 1 2 3 4 6 8 12 14 16 18 20 40; do out2+=("$(printf "%3s,%s" "$i" "mb-setvar jgtools_radius=${i};$me")");done out2+=("^tag(subspacing)") for i in -20 -8 -6 -4 -2 0 1 2 4 6 8 10 12 14 16 18 20; do out2+=("$(printf "%4s,%s" "$i" "mb-setvar submenu_spacing=${i};$me")");done out+=("^sep()") if [ -f "${THEMERC}.bak" ]; then out+=("Reset ${jgmenu_theme} to default,jgctl reset;$me") fi out+=("Edit ${jgmenu_theme} file,xdg-open $THEMERC") out+=("Set random menu theme,mb-setvar jgmenu_theme=$(basename -s .colorrc $(ls ~/.config/mabox/jgobthemes/*.colorrc | shuf -n 1));$me") ### RUN if [[ "$1" == "-s" ]]; then . /usr/share/mb-jgtools/pipemenu-standalone.cfg . $HOME/.config/mabox/mabox.conf out+=("^sep()") out+=(" ⮜ Back to Colorizer,colorizer -s") if [[ $panels_heightpos == "top" ]]; then MENU_VALIGN="top" MENU_MARGIN_Y=${panels_topmargin:-0} elif [[ $panels_heightpos == "bottom" ]]; then MENU_VALIGN="bottom" MENU_MARGIN_Y=${panels_topmargin:-0} else MENU_VALIGN="center" fi MENU_PADDING_TOP=${jgtools_padding:-0} MENU_HALIGN="left" jgmenu_icon_size=0 JGWIDTH=40 menu_margin_x=${submenu_spacing:-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 #TEMP POSITION: MENU_VALIGN="top" MENU_MARGIN_Y="60" mkconfigfile cat < ${MENU_ITEMS} @icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,${THUMB} $(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[@]}"