#!/bin/bash # # colorizer - set of tools for Mabox (auto)theming # Copyright (C) 2022-2023 Daniel Napora # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . MBCOLORSDIR="$HOME"/.themes/MBcolors/openbox-3/ GRADIENT_FILE="$HOME"/.config/colorizer/gradients_all.inc MORE_GRADIENT_FILE="$HOME"/.config/colorizer/gradients_menu.inc if [ ! -f "$GRADIENT_FILE" ]; then cp /usr/share/mabox-colorizer/gradients.inc "$GRADIENT_FILE" fi if [ ! -d "$MBCOLORSDIR" ]; then mkdir -p ${MBCOLORSDIR} rsync -a /usr/share/mabox-colorizer/themes/MBcolors/openbox-3/* ${MBCOLORSDIR}/ fi OBTHEME=$(awk '// {while (getline n) {if (match(n, //)) {l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml") THEMERC="$HOME/.themes/$OBTHEME/openbox-3/themerc" me="colorizer-ob -s" case "$LANG" in pl*) OBTHEME_LBL="Motyw OpenBox" GENERATEFROMWP="Generuj z kolorów tapety..." LIGHTBG="Jasne" DARKBG="Ciemne" TITLEBAR="Pasek tytułowy" TITLEBAR_FONT="Czcionka" ACTIVE_BG="Tło aktywnego okna" INACTIVE_BG="Tło nieaktywnego okna" TITLEBAR_TEXT="Tekst paska tytułowego" FONT="Czcionka" FONTSIZE="Rozmiar czcionki" _INCREASE="Powiększ do" _DECREASE="Pomniejsz do" FONTFAMILY="Czcionka (rodzina)" BOLD="Pogrubienie" ITALIC="Kursywa" TEXTALIGN="Wyrównanie tytułu" LEFT="do lewej" CENTER="po środku" RIGHT="do prawej" SHADOW="Cień" NOSHADOW="bez cienia" DARK="Ciemny" LIGHT="Jasny" TEXT="Tekst" ACTIVE_FG="w aktywnym oknie" INACTIVE_FG="w nieaktywnym oknie" PADDING="Odstęp" VERTICAL="W pionie" HORIZONTAL="W poziomie" RAISED_OR_FLAT="Płaski, Uniesiony, Wklęsły" FLAT="płaski - flat" RAISED="uniesiony - raised" SUNKEN="wklęsły - sunken" BUTTONS="Przyciski" BUTTONS_LAYOUT="Układ przycisków" LEGEND="Legenda" GRADIENT_TYPE="Typ Gradientu" SOLID_COLOR="Jednolity kolor (brak gradientu)" PRE_GRADIENTS="Gotowe gradienty" GRADIENT_REVERSE="Odwróć kolory Gradientu" SPLITVERTICAL="Podział w pionie" MIRRORHORIZONTAL="LustroPoziome" DIAGONAL="Przekątna" CROSSDIAGONAL="Przekątna krzyżowa" PYRAMID="Piramida" ACTIVE_BG_TO="Tło aktywnego okna 2" INACTIVE_BG_TO="Tło nieaktywnego okna 2" BORDER="Obramowanie okna" BORDER_PX="Obramowanie (px)" ACTIVE_BORDER="Obramowanie akt. okna" INACTIVE_BORDER="Obramowanie nieakt. okna" HANDLEWIDTH="Uchwyt - rozmiar" ACTIVEHANDLE="Aktywny Uchwyt" YES="Tak" NO="Nie" GRIPONLY="Tylko chwyt (po bokach)" RESET="Resetuj" RESET_THEME="Resetuj motyw" AREYOUSURE="Czy aby na pewno?" NOT_SUPORTED_OBTHEME="Nie wspierany motyw" UNLOCK="odblokuj swoją kreatywność..." SWITCH_TO_MBCOLORS="Przełącz na MBColors" _COLORIZER_ROOT="Colorizer - menu główne" ;; *) OBTHEME_LBL="OpenBox theme" GENERATEFROMWP="Generate from wallpaper colors..." LIGHTBG="Light" DARKBG="Dark" TITLEBAR="Title Bar" ACTIVE_BG="Active Background" INACTIVE_BG="Inactive Background" TITLEBAR_TEXT="Title Bar Text" TITLEBAR_FONT="Title Bar Font" FONT="Font" FONTSIZE="font size" _INCREASE="Increase to" _DECREASE="Decrease to" FONTFAMILY="font family" BOLD="Bold" ITALIC="Italic" TEXTALIGN="Title align" LEFT="left" CENTER="center" RIGHT="right" SHADOW="Shadow" NOSHADOW="no shadow" DARK="Dark" LIGHT="Light" TEXT="Text" ACTIVE_FG="in active window" INACTIVE_FG="in inactive window" PADDING="Padding" VERTICAL="Vertical" HORIZONTAL="Horizontal" RAISED_OR_FLAT="Flat, Raised or Sunken" FLAT="flat" RAISED="raised" SUNKEN="sunken" BUTTONS="Buttons" BUTTONS_LAYOUT="Buttons Layout" LEGEND="Legend" GRADIENT_TYPE="Gradient type" SPLITVERTICAL="SplitVertical" MIRRORHORIZONTAL="MirrorHorizontal" DIAGONAL="Diagonal" CROSSDIAGONAL="CrossDiagonal" PYRAMID="Pyramid" SOLID_COLOR="Solid color (no gradient)" PRE_GRADIENTS="Predefined gradients" GRADIENT_REVERSE="Reverse Gradient" ACTIVE_BG_TO="Active Background to" INACTIVE_BG_TO="Inactive Background to" BORDER="Window Border" BORDER_PX="Border (px)" ACTIVE_BORDER="Active Border" INACTIVE_BORDER="Inactiva Border" HANDLEWIDTH="Handle Width" ACTIVEHANDLE="Active Handle" YES="Yes" NO="No" GRIPONLY="Grip only" RESET="Reset" RESET_THEME="Reset theme to default" AREYOUSURE="Are you sure?" NOT_SUPORTED_OBTHEME="Theme not supported" UNLOCK="Unlock your creativity..." SWITCH_TO_MBCOLORS="Switch to MBColors" _COLORIZER_ROOT="Colorizer rootmenu" ;; esac getvalues () { read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)" read ABGTO <<< "$(grep .active.title.bg.colorTo ${THEMERC} | cut -d':' -f2)" read NBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)" read NBGTO <<< "$(grep .inactive.title.bg.colorTo ${THEMERC} | cut -d':' -f2)" read AFG <<< "$(grep .active.label.text.color ${THEMERC} | cut -d':' -f2)" read NFG <<< "$(grep .inactive.label.text.color ${THEMERC} | cut -d':' -f2)" read ALINE <<< "$(grep .active.border.color ${THEMERC} | cut -d':' -f2)" read NLINE <<< "$(grep inactive.border.color ${THEMERC} | cut -d':' -f2)" read PHEIGHT <<< "$(grep ^padding.height: ${THEMERC} | cut -d':' -f2)" read PWIDTH <<< "$(grep ^padding.width: ${THEMERC} | cut -d':' -f2)" read TXTJUST <<< "$(grep text.justify ${THEMERC} | cut -d':' -f2)" read HANDLE <<< "$(grep handle.width ${THEMERC} | cut -d':' -f2)" read BORD <<< "$(grep border.width ${THEMERC} | cut -d':' -f2)" read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)" read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)" if [ "$ABG" == "$AHBG" ];then AHANDLE="yes" else AHANDLE="no" fi } getvaluesrc() { #from RC.xml nspace="http://openbox.org/3.4/rc" cfg="$HOME/.config/openbox/rc.xml" FSIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg") FNAME=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name' "$cfg") NDSLIMC=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:titleLayout' "$cfg") WEIGHT=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:weight' "$cfg") SLANT=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:slant' "$cfg") } if [[ -f "$THEMERC" ]] && [[ "$OBTHEME" = "MBcolor"* ]]; then if [ ! -f "${THEMERC}.bak" ]; then cp ${THEMERC} ${THEMERC}.bak #check if lines, and add missing # colorTo # handle # grip # text.justify # window.active.label.text.font:shadow=n:shadowtint=70:shadowoffset=1 #grep -qF -- "$LINE" "$FILE" || echo "$LINE" >> "$FILE" grep ^[^#] "$THEMERC" | grep -qiF -- .active.title.bg.colorTo || echo "window.active.title.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.title.bg.colorTo || echo "window.inactive.title.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- handle.width: || echo "window.handle.width: 0" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .handle.bg: || echo "window.*.handle.bg: parentrelative" >> "$THEMERC" ################################################################################################################################## Kolory poniżej obliczyć grep ^[^#] "$THEMERC" | grep -qiF -- .active.handle.bg.color: || echo "window.active.handle.bg.color: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .active.handle.bg.colorTo: || echo "window.active.handle.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.handle.bg.color: || echo "window.inactive.handle.bg.color: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.handle.bg.colorTo: || echo "window.inactive.handle.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .grip.bg: || echo "window.*.grip.bg: parentrelative" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .active.grip.bg.color: || echo "window.active.grip.bg.color: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .active.grip.bg.colorTo: || echo "window.active.grip.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.grip.bg.color: || echo "window.inactive.grip.bg.color: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .inactive.grip.bg.colorTo: || echo "window.inactive.grip.bg.colorTo: #222222" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .text.justify: || echo "window.*.text.justify: center" >> "$THEMERC" grep ^[^#] "$THEMERC" | grep -qiF -- .text.font: || echo "window.*.text.font: shadow=n:shadowtint=70:shadowoffset=1" >> "$THEMERC" fi getvalues getvaluesrc #out+=("^sep($OBTHEME_LBL: $OBTHEME)") out+=("^sep($TITLEBAR)") out+=(" AbCd $TITLEBAR_TEXT,^checkout(titletext)") out+=("    $BUTTONS,^checkout(tbuttons)") out+=("^sep()") out+=(" $ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg_only '${ACTIVE_BG}' '$me')") [[ ! -z "$ABGTO" ]] && out+=(" $ACTIVE_BG_TO,^pipe(mbclr '$ABGTO' obtctl clractivebgto '${ACTIVE_BG_TO}' '$me')") out+=("^sep()") out+=(" $INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg_only '${INACTIVE_BG}' '$me')") [[ ! -z "$ABGTO" ]] && out+=(" $INACTIVE_BG_TO,^pipe(mbclr '$NBGTO' obtctl clrnormalbgto '${INACTIVE_BG_TO}' '$me')") out+=("^sep()") out+=("$PADDING [ $PHEIGHT $PWIDTH ],^checkout(padding)") out+=("\"\"\"$RAISED_OR_FLAT? [ $WINRAISED ]\"\"\",^checkout(raised)") out+=("^sep(Gradient)") out+=("$GRADIENT_TYPE [ ${REST##* } ],^checkout(gradient)") out+=(" $PRE_GRADIENTS,^pipe(mbgrad ob)") out+=("凌 $GRADIENT_REVERSE,obtctl activegradient '${ABGTO}' '${ABG}';$me") out+=("^sep($BORDER)") out+=(" $ACTIVE_BORDER,^pipe(mbclr '$ALINE' obtctl activeborderColor '${ACTIVE_BORDER_COLOR}' '$me')") out+=(" $INACTIVE_BORDER,^pipe(mbclr '$NLINE' obtctl inactiveborderColor '${INACTIVE_BORDER_COLOR}' '$me')") out+=("$BORDER [ $BORD ],^checkout(border)") out+=("$HANDLEWIDTH [ $HANDLE ],^checkout(handlewidth)") out+=("$ACTIVEHANDLE? [ $AHANDLE ],^checkout(handle)") out+=("^sep($GENERATEFROMWP)") out+=("$LIGHTBG,w2theme ob light;$me") out+=("$DARKBG,w2theme ob dark;$me") if [ -f "${THEMERC}.bak" ]; then out+=("^sep($RESET)") out+=("󰁯 $RESET_THEME,^checkout(resettheme)") out2+=("^tag(resettheme)") out2+=("^sep($AREYOUSURE)") out2+=("$YES,obtctl reset;$me") fi #out+=("Edit...,xdg-open ${THEMERC}") #out2+=("^tag(themes)") #out2+=("^sep(themes)") #for i in $(ls $HOME/.themes);do # if [ -f "$HOME/.themes/${i}/openbox-3/themerc" ]; then # out2+=("$i,obtctl theme $i;$me") # fi #done #TBUTTONS out2+=("^tag(tbuttons)") out2+=("^sep($BUTTONS)") out2+=("Tiny,obtctl buttons tiny;$me") out2+=("Normal,obtctl buttons normal;$me") out2+=("Bold,obtctl buttons bold;$me") out2+=("Dots,obtctl buttons dots;$me") out2+=("^sep()") out2+=("Big 12px,obtctl buttons big-12;$me") out2+=("Big 14px,obtctl buttons big-14;$me") out2+=("^sep($BUTTONS_LAYOUT)") [[ "$NDSLIMC" == NDSLIMC ]] && out2+=(" full NDSLIMC (default),obtctl ndslimc NDSLIMC;$me") || out2+=(" full NDSLIMC (default),obtctl ndslimc NDSLIMC;$me") [[ "$NDSLIMC" == NLIMC ]] && out2+=(" mini NLIMC,obtctl ndslimc NLIMC;$me") || out2+=(" mini NLIMC,obtctl ndslimc NLIMC;$me") [[ "$NDSLIMC" == LIMC ]] && out2+=(" mini (no icon) LIMC,obtctl ndslimc LIMC;$me") || out2+=(" mini (no icon) LIMC,obtctl ndslimc LIMC;$me") [[ "$NDSLIMC" == CMIL ]] && out2+=(" crazy CMIL,obtctl ndslimc CMIL;$me") || out2+=(" crazy CMIL,obtctl ndslimc CMIL;$me") out2+=("^sep($LEGEND)") out2+=("^sep(N: Window icon)") out2+=("^sep(L: Window label (Title))") out2+=("^sep(I: Iconify (Minimize))") out2+=("^sep(M: Maximize)") out2+=("^sep(C: Close)") out2+=("^sep(S: Shade (Roll up))") out2+=("^sep(D: Omnipresent (On all desktops))") out2+=("^sep($TEXTALIGN)") [[ "$TXTJUST" = left ]] && out2+=("綠  $LEFT,obtctl textjustify left;$me")||out2+=("祿  $LEFT,obtctl textjustify left;$me") [[ "$TXTJUST" = center ]] && out2+=("綠  $CENTER,obtctl textjustify center;$me")||out2+=("祿  $CENTER,obtctl textjustify center;$me") [[ "$TXTJUST" = right ]] && out2+=("綠  $RIGHT,obtctl textjustify right;$me")||out2+=("祿  $RIGHT,obtctl textjustify right;$me") #TEXT out2+=("^tag(titletext)") out2+=("^sep(TEXT_COLOR)") out2+=(" active title $ACTIVE_FG,^pipe(mbclr '$AFG' obtctl activetextcolor '${TEXT} ${ACTIVE_FG}' '$me')") out2+=(" inactive title $INACTIVE_FG,^pipe(mbclr '$NFG' obtctl inactivetextcolor '${TEXT} ${INACTIVE_FG}' '$me')") out2+=("^sep($TITLEBAR_FONT)") out2+=("$FONT... [ ${FNAME} ${FSIZE} ],mb-setfont obtitle;$me") out2+=("^sep($FONTSIZE)") out2+=("󰧴 $_INCREASE $((FSIZE+1)) px,fontctl ob_fontsize inc;$me") out2+=("󰧳 $_DECREASE $((FSIZE-1)) px,fontctl ob_fontsize dec;$me") out2+=("^sep()") sizes=(16 15 14 13 12 11 10 9 8) for i in "${sizes[@]}" do [[ "$FSIZE" == "$i" ]] && out2+=(" $i px,obtctl fontsize $i;$me") || out2+=(" $i px,obtctl fontsize $i;$me") done out2+=("^sep($FONTFAMILY)") if [ -f "$HOME/.config/mabox/fonts.list" ];then mapfile -t favfonts < <( grep -vE "^($|#)" ~/.config/mabox/fonts.list) else mapfile -t favfonts < <( grep -vE "^($|#)" /usr/share/mabox-colorizer/fonts.list) cp /usr/share/mabox-colorizer/fonts.list ~/.config/mabox/ fi if [ "${#favfonts[@]}" -gt 0 ];then for fon in "${favfonts[@]}";do [[ "${FNAME}" == "$fon" ]] && out2+=(" ${fon},$me") || out2+=(" ${fon},obtctl fontfamily \"${fon}\";$me") done fi out2+=("^sep()") [[ "$WEIGHT" =~ .*"old" ]] && out2+=(" $BOLD,obtctl fontweight Normal;$me") || out2+=(" $BOLD,obtctl fontweight Bold;$me") [[ "$SLANT" =~ .*"talic" ]] && out2+=(" $ITALIC,obtctl fontslant Normal;$me") || out2+=(" $ITALIC,obtctl fontslant Italic;$me") #SHADOW out2+=("^sep($TEXTALIGN)") [[ "$TXTJUST" = left ]] && out2+=("綠  $LEFT,obtctl textjustify left;$me")||out2+=("祿  $LEFT,obtctl textjustify left;$me") [[ "$TXTJUST" = center ]] && out2+=("綠  $CENTER,obtctl textjustify center;$me")||out2+=("祿  $CENTER,obtctl textjustify center;$me") [[ "$TXTJUST" = right ]] && out2+=("綠  $RIGHT,obtctl textjustify right;$me")||out2+=("祿  $RIGHT,obtctl textjustify right;$me") out2+=("^sep()") out2+=("$SHADOW,^checkout(shadow)") out2+=("^tag(shadow)") out2+=("^sep($SHADOW)") out2+=("$NOSHADOW,obtctl shadow 0;$me") out2+=("^sep()") out2+=("$DARK,obtctl shadow 1;$me") out2+=("$LIGHT,obtctl shadow 2;$me") #PADDING out2+=("^tag(padding)") out2+=("^sep($VERTICAL)") out2+=("0,obtctl paddingHeight 0;$me") out2+=("^sep()") out2+=("1,obtctl paddingHeight 1;$me") out2+=("2,obtctl paddingHeight 2;$me") out2+=("3,obtctl paddingHeight 3;$me") out2+=("4,obtctl paddingHeight 4;$me") out2+=("5,obtctl paddingHeight 5;$me") out2+=("6,obtctl paddingHeight 6;$me") out2+=("8,obtctl paddingHeight 8;$me") out2+=("10,obtctl paddingHeight 10;$me") out2+=("12,obtctl paddingHeight 12;$me") out2+=("16,obtctl paddingHeight 16;$me") out2+=("20,obtctl paddingHeight 20;$me") out2+=("^sep($HORIZONTAL)") out2+=("0,obtctl paddingWidth 0;$me") out2+=("^sep()") out2+=("1,obtctl paddingWidth 1;$me") out2+=("2,obtctl paddingWidth 2;$me") out2+=("3,obtctl paddingWidth 3;$me") out2+=("4,obtctl paddingWidth 4;$me") out2+=("5,obtctl paddingWidth 5;$me") out2+=("6,obtctl paddingWidth 6;$me") out2+=("8,obtctl paddingWidth 8;$me") out2+=("10,obtctl paddingWidth 10;$me") out2+=("12,obtctl paddingWidth 12;$me") out2+=("16,obtctl paddingWidth 16;$me") out2+=("20,obtctl paddingWidth 20;$me") #BORDER out2+=("^tag(border)") out2+=("^sep($BORDER)") out2+=("0,obtctl borderWidth 0;$me") out2+=("^sep()") out2+=("1,obtctl borderWidth 1;$me") out2+=("2,obtctl borderWidth 2;$me") out2+=("3,obtctl borderWidth 3;$me") out2+=("4,obtctl borderWidth 4;$me") out2+=("5,obtctl borderWidth 5;$me") out2+=("6,obtctl borderWidth 6;$me") out2+=("8,obtctl borderWidth 8;$me") out2+=("10,obtctl borderWidth 10;$me") out2+=("12,obtctl borderWidth 12;$me") out2+=("16,obtctl borderWidth 16;$me") out2+=("20,obtctl borderWidth 20;$me") #RAISED out2+=("^tag(raised)") out2+=("\"\"\"^sep($RAISED_OR_FLAT?)\"\"\"") out2+=("$FLAT,obtctl raised 0;$me") out2+=("$RAISED,obtctl raised 1;$me") out2+=("$SUNKEN,obtctl raised 2;$me") #GRADIENT out2+=("^tag(gradient)") out2+=("^sep($GRADIENT_TYPE)") out2+=("$SOLID_COLOR,obtctl gradient_type solid;$me") out2+=("^sep()") out2+=("$VERTICAL,obtctl gradient_type vertical;$me") out2+=("$HORIZONTAL,obtctl gradient_type horizontal;$me") out2+=("$MIRRORHORIZONTAL,obtctl gradient_type mirrorhorizontal;$me") out2+=("$SPLITVERTICAL,obtctl gradient_type splitvertical;$me") out2+=("$DIAGONAL,obtctl gradient_type diagonal;$me") out2+=("$CROSSDIAGONAL,obtctl gradient_type crossdiagonal;$me") out2+=("$PYRAMID,obtctl gradient_type pyramid;$me") #HANDLE out2+=("^tag(handle)") out2+=("^sep($ACTIVEHANDLE)") out2+=("$NO,obtctl activehandle no;$me") out2+=("$YES,obtctl activehandle yes;$me") out2+=("$GRIPONLY,obtctl activehandle grip;$me") #HANDLE out2+=("^tag(handlewidth)") out2+=("^sep($HANDLEWIDTH)") out2+=("0,obtctl handlewidth 0;$me") out2+=("^sep()") out2+=("2,obtctl handlewidth 2;$me") out2+=("3,obtctl handlewidth 3;$me") out2+=("4,obtctl handlewidth 4;$me") out2+=("6,obtctl handlewidth 6;$me") out2+=("8,obtctl handlewidth 8;$me") out2+=("10,obtctl handlewidth 10;$me") else # Theme other than MBColors, we can only edit rc.xml getvaluesrc out+=("^sep($NOT_SUPORTED_OBTHEME)") out+=("^sep($UNLOCK)") out+=("$SWITCH_TO_MBCOLORS,obtctl theme MBcolors;$me") out+=("^sep($TITLEBAR_FONT)") out+=("$FONT... [ ${FNAME} ${FSIZE} ],mb-setfont obtitle;$me") out+=("^sep(font family)") if [ -f "$HOME/.config/mabox/fonts.list" ];then mapfile -t favfonts < <( grep -vE "^($|#)" ~/.config/mabox/fonts.list) else mapfile -t favfonts < <( grep -vE "^($|#)" /usr/share/mabox-colorizer/fonts.list) cp /usr/share/mabox-colorizer/fonts.list ~/.config/mabox/ fi if [ "${#favfonts[@]}" -gt 0 ];then for fon in "${favfonts[@]}";do [[ "${FNAME}" == "$fon" ]] && out+=(" ${fon},$me") || out+=(" ${fon},obtctl fontfamily \"${fon}\";$me") done fi out+=("^sep()") [[ "$WEIGHT" =~ .*"old" ]] && out+=(" $BOLD,obtctl fontweight Normal;$me") || out+=(" $BOLD,obtctl fontweight Bold;$me") [[ "$SLANT" =~ .*"talic" ]] && out+=(" $ITALIC,obtctl fontslant Normal;$me") || out+=(" $ITALIC,obtctl fontslant Italic;$me") out+=("^sep()") out+=("$FONTSIZE [ $FSIZE px ],^checkout(obfsize)") out2+=("^tag(obfsize)") out2+=("^sep($FONTSIZE)") sizes=(16 15 14 13 12 11 10 9 8) for i in "${sizes[@]}" do [[ "$FSIZE" == "$i" ]] && out2+=(" $i px,obtctl fontsize $i;$me") || out2+=(" $i px,obtctl fontsize $i;$me") done out+=("^sep($BUTTONS_LAYOUT)") [[ "$NDSLIMC" == NDSLIMC ]] && out+=(" full NDSLIMC (default),obtctl ndslimc NDSLIMC;$me") || out+=(" full NDSLIMC (default),obtctl ndslimc NDSLIMC;$me") [[ "$NDSLIMC" == NLIMC ]] && out+=(" mini NLIMC,obtctl ndslimc NLIMC;$me") || out+=(" mini NLIMC,obtctl ndslimc NLIMC;$me") [[ "$NDSLIMC" == LIMC ]] && out+=(" mini (no icon) LIMC,obtctl ndslimc LIMC;$me") || out+=(" mini (no icon) LIMC,obtctl ndslimc LIMC;$me") [[ "$NDSLIMC" == CMIL ]] && out+=(" crazy CMIL,obtctl ndslimc CMIL;$me") || out+=(" crazy CMIL,obtctl ndslimc CMIL;$me") out+=("^sep($LEGEND)") out+=("^sep(N: Window icon)") out+=("^sep(L: Window label (Title))") out+=("^sep(I: Iconify (Minimize))") out+=("^sep(M: Maximize)") out+=("^sep(C: Close)") out+=("^sep(S: Shade (Roll up))") out+=("^sep(D: Omnipresent (On all desktops))") 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+=(" ${arrow_string_left} $_COLORIZER_ROOT,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_PADDING_TOP=${jgtools_padding:-0} MENU_HALIGN="left" jgmenu_icon_size=0 JGWIDTH=40 [ $(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 IMAGE read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | 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 cat < ${MENU_ITEMS} @icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB} @icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,/usr/share/mabox-colorizer/img/colorizer-ob.png @rect,,$((jgtools_padding)),$((jgtools_padding + 124)),270,22,0,left,top,#222222 20,#222222 70, @text,,$((jgtools_padding + 138)),$((jgtools_padding + 120)),130,30,0,left,top,#FFFFFF ,${WINCLR},Colorizer Openbox $(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[@]}"