From 05a80516b6a9cbc0522279acb9283c255311a9e4 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sat, 23 Sep 2023 13:57:32 +0200 Subject: [PATCH] Openbox save/restore theme/colorscheme --- bin/colorizer | 12 +- bin/colorizer-conky | 2 +- bin/colorizer-menus | 4 +- bin/colorizer-ob | 239 +++++++++++++++++----- bin/obtctl | 229 ++++++++++++++++++--- bin/w2theme | 1 + share/mabox-colorizer/colorschemes/ob.csv | 7 + 7 files changed, 411 insertions(+), 83 deletions(-) create mode 100644 share/mabox-colorizer/colorschemes/ob.csv diff --git a/bin/colorizer b/bin/colorizer index 526dff9..c2f5435 100755 --- a/bin/colorizer +++ b/bin/colorizer @@ -63,8 +63,9 @@ case "$LANG" in CURRENTCONF="Obecna konfiguracja" MODULES="Moduły" FONTS="Konfiguruj Czcionki" - OBTHEME="Motyw Openbox" - MENUPANELS="Menu i Panele" + OBTHEME="Motyw Openbox" + MENUPANELS="Menu i Panele boczne" + COLORIZER_CONKY="Conky Manager i Colorizer" CAVA="Cava - wizualizacja dźwięku" TERMINALTHEME="Motyw terminala" WALLCOLORS="Kolory z tapety" @@ -160,8 +161,9 @@ case "$LANG" in CURRENTCONF="Current configuration" MODULES="Modules" FONTS="Configure Fonts" - OBTHEME="Openbox Theme" - MENUPANELS="Menus/Panels" + OBTHEME="Openbox Theme" + MENUPANELS="Menus/SidePanels" + COLORIZER_CONKY="Conky Manager & Colorizer" CAVA="Cava - Audio Visualizer" TERMINALTHEME="Terminal color scheme" WALLCOLORS="Wallpaper Colors" @@ -307,7 +309,7 @@ out+=("$OBTHEME,colorizer-ob -s") #out+=("TINT2,^pipe(colorizer-tint2)") out+=("$MENUPANELS,colorizer-menus -s") -out+=("Conky Manager,colorizer-conky -s") +out+=("$COLORIZER_CONKY,colorizer-conky -s") out+=("^sep()") #out+=("Systray HW monitor,^pipe(colorizer-phwmon)") diff --git a/bin/colorizer-conky b/bin/colorizer-conky index f66a6fe..86f8dba 100755 --- a/bin/colorizer-conky +++ b/bin/colorizer-conky @@ -506,7 +506,7 @@ if [[ "$1" == "-s" ]]; then cat < ${MENU_ITEMS} @icon,,$((jgtools_padding)),$((jgtools_padding)),270,150,4,left,top,,,${THUMB} -@rect,,$((jgtools_padding)),$((jgtools_padding + 112)),270,34,0,left,top,#222222 20,#222222 70, +@rect,,$((jgtools_padding)),$((jgtools_padding + 116)),270,28,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 + 80)),$((jgtools_padding + 116)),190,30,0,left,top,#FFFFFF ,${WINCLR},Conky Manager & Colorizer @rect,,$((jgtools_padding + 239)),$((jgtools_padding + 2)),29,60,0,left,top,#FFFFFF 30,${WINCLR} 60, diff --git a/bin/colorizer-menus b/bin/colorizer-menus index f333907..b5d8d9f 100755 --- a/bin/colorizer-menus +++ b/bin/colorizer-menus @@ -263,7 +263,7 @@ if [ ! -f "$USERSCHEMES" ]; then fi out+=("^sep($MENU_THEME: ${jgmenu_theme})") -out+=("$QUICK_TWEAKS,^checkout(tweaks)") +out+=(" $QUICK_TWEAKS,^checkout(tweaks)") out2+=("^tag(tweaks)") out2+=("^sep($OVERALL_STYLE)") @@ -462,7 +462,7 @@ case "$GRADIENT" in esac out+=("$icon $GRADIENT_POS [ $GRADIENT ],^checkout(gradientpos)") -out+=(" $GRADIENT_REVERSE,jgctl gradient '${MBGT}' '${MBG}';$me") +out+=(" $GRADIENT_REVERSE,jgctl gradient '${MBGT}' '${MBG}';$me") out+=(" $PRE_GRADIENTS,^pipe(mbgrad menu)") ### TITLE/SEPARATOR diff --git a/bin/colorizer-ob b/bin/colorizer-ob index a7c636d..3fda9f2 100755 --- a/bin/colorizer-ob +++ b/bin/colorizer-ob @@ -20,6 +20,26 @@ MBCOLORSDIR="$HOME"/.themes/MBcolors/openbox-3/ GRADIENT_FILE="$HOME"/.config/colorizer/gradients_all.inc MORE_GRADIENT_FILE="$HOME"/.config/colorizer/gradients_menu.inc +SYSTHEMES="/usr/share/mabox-colorizer/colorschemes/ob.csv" +USERTHEMES="$HOME/.config/colorizer/openbox/userthemes.csv" + +### Wallpaper colors +WALLPALDIR="$HOME/.cache/colorizer/palettes" +mkdir -p "$WALLPALDIR" +read WALLPATH<<< $(grep file "$HOME"/.config/nitrogen/bg-saved.cfg | cut -d'=' -f2) +NAME=${WALLPATH////_} +if [[ "${NAME}" =~ ^_home_.* ]]; then +n=${#HOME} +((n++)) +NAME=${NAME:${n}} +fi + +if [ ! -f "$WALLPALDIR/$NAME.clr" ]; then +convert ${WALLPATH} -resize 25% -colors 16 -unique-colors txt:- |grep -v '^#'| awk '{print substr($3,1,7)}' |pastel sort-by brightness |pastel format hex > "$WALLPALDIR/$NAME.clr" +fi +mapfile -t w < "$WALLPALDIR/$NAME.clr" + + if [ ! -f "$GRADIENT_FILE" ]; then cp /usr/share/mabox-colorizer/gradients.inc "$GRADIENT_FILE" fi @@ -37,14 +57,30 @@ me="colorizer-ob -s" case "$LANG" in pl*) + QUICK_TWEAKS="Ustawienia główne" + OVERALL_STYLE="Ogólny styl" + THEMES="Motywy" + SYSTEM_THEMES="Systemowe" + YOUR_THEMES="Moje motywy" + SAVE_CURRTHEME="Zapisz aktualną kobfigurację jako..." + OPEN_THEMEFILE="Odwórz plik z motywami w edytorze" + THEME="Motyw" + APPLY="Zastosuj" + APPLY_THEME="Pełny motyw (kolory, czcionki i rozmiar)" + APPLY_SCHEME="Tylko kolory" + DELETE="Usuń" + DELETE_THEME="Usuń motyw" OBTHEME_LBL="Motyw OpenBox" GENERATEFROMWP="Generuj z kolorów tapety..." - LIGHTBG="Jasne" - DARKBG="Ciemne" + LIGHTBG=" Jasne tło" + DARKBG="Ciemne tło" TITLEBAR="Pasek tytułowy" + ACTIVE_WINDOW="Aktywne okno" + INACTIVE_WINDOW="Nieaktywne okno" TITLEBAR_FONT="Czcionka" ACTIVE_BG="Tło aktywnego okna" INACTIVE_BG="Tło nieaktywnego okna" + TEXT_COLOR="Kolor tekstu" TITLEBAR_TEXT="Tekst paska tytułowego" FONT="Czcionka" FONTSIZE="Rozmiar czcionki" @@ -71,7 +107,7 @@ case "$LANG" in FLAT="płaski - flat" RAISED="uniesiony - raised" SUNKEN="wklęsły - sunken" - BUTTONS="Przyciski" + BUTTONS_LBL="Przyciski" BUTTONS_LAYOUT="Układ przycisków" LEGEND="Legenda" GRADIENT_TYPE="Typ Gradientu" @@ -103,13 +139,29 @@ case "$LANG" in _COLORIZER_ROOT="Colorizer - menu główne" ;; *) + QUICK_TWEAKS="Global Settings/Quick Tweaks" + OVERALL_STYLE="Overall style" + THEMES="Themes" + SYSTEM_THEMES="System themes" + YOUR_THEMES="My Themes" + SAVE_CURRTHEME="Save current setup as..." + OPEN_THEMEFILE="Open themes file in editor" + THEME="Theme" + APPLY="Apply" + APPLY_THEME="Full theme (colors,fonts and sizing)" + APPLY_SCHEME="Colors only" + DELETE="Delete" + DELETE_THEME="Delete theme" OBTHEME_LBL="OpenBox theme" GENERATEFROMWP="Generate from wallpaper colors..." - LIGHTBG="Light" - DARKBG="Dark" + LIGHTBG="Light Background" + DARKBG="Dark Background" TITLEBAR="Title Bar" + ACTIVE_WINDOW="Active Window" + INACTIVE_WINDOW="Inactive Window" ACTIVE_BG="Active Background" INACTIVE_BG="Inactive Background" + TEXT_COLOR="Text color" TITLEBAR_TEXT="Title Bar Text" TITLEBAR_FONT="Title Bar Font" FONT="Font" @@ -137,7 +189,7 @@ case "$LANG" in FLAT="flat" RAISED="raised" SUNKEN="sunken" - BUTTONS="Buttons" + BUTTONS_LBL="Buttons" BUTTONS_LAYOUT="Buttons Layout" LEGEND="Legend" GRADIENT_TYPE="Gradient type" @@ -148,7 +200,7 @@ case "$LANG" in PYRAMID="Pyramid" SOLID_COLOR="Solid color (no gradient)" PRE_GRADIENTS="Predefined gradients" - GRADIENT_REVERSE="Reverse Gradient" + GRADIENT_REVERSE="Reverse Gradient Colors" ACTIVE_BG_TO="Active Background to" INACTIVE_BG_TO="Inactive Background to" BORDER="Window Border" @@ -184,7 +236,27 @@ getvalues () { 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 BEVEL REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)" + read TITLEBG <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)" + case "${TITLEBG,,}" in + *flat*) BEVEL="flat";; + *raised*) BEVEL="raised";; + *sunken*) BEVEL="sunken";; + esac + case "${TITLEBG,,}" in + *solid*) GRAD=Solid;; + *splitvertical*) GRAD=SplitVertical;; + *vertical*) GRAD=Vertical;; + *mirrorhorizontal*) GRAD=MirrorHorizontal;; + *horizontal*) GRAD=Horizontal;; + *crossdiagonal*) GRAD=CrossDiagonal;; + *diagonal*) GRAD=Diagonal;; + *pyramid*) GRAD=Pyramid;; + + esac + but=$(<"$MBCOLORSDIR/.buttons") + BUTTONS=${but:-tiny} + #notify-send.sh "Buttons" "$BUTTONS" read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)" if [ "$ABG" == "$AHBG" ];then AHANDLE="yes" @@ -241,39 +313,109 @@ if [[ -f "$THEMERC" ]] && [[ "$OBTHEME" = "MBcolor"* ]]; then getvalues getvaluesrc +currvalues=("${ABG}|${ABGTO}|${AFG}|${ALINE}|${NBG}|${NBGTO}|${NFG}|${NLINE}|${GRAD,,}|${TXTJUST}|${PHEIGHT}|${PWIDTH}|${HANDLE}|${BORD}|${BEVEL}|${BUTTONS}|${FSIZE}|${FNAME}|${NDSLIMC}|${WEIGHT}|${SLANT}|") + +#notify-send.sh "$BEVEL" "${currvalues}" + +if [ ! -f "$USERTHEMES" ]; then + mkdir -p "$HOME/.config/colorizer/openbox/" + echo " ABG | ABGTO | AFG | ALINE | NBG | NBGTO | NFG | NLINE | GRAD |TXTJUST|PHEIGHT|PWIDTH|HANDLE|BORD|BEVEL|BUTTONS|FSIZE|FNAME|NDSLIMC|WEIGHT|SLANT|scheme_name" > "$USERTHEMES" +fi + #out+=("^sep($OBTHEME_LBL: $OBTHEME)") +out+=(" $QUICK_TWEAKS,^checkout(tweaks)") + + out2+=("^tag(tweaks)") + out2+=("^sep(Overall style)") + out2+=("Large,obtctl tweak large;$me") + out2+=("Big,obtctl tweak big;$me") + out2+=("Normal,obtctl tweak normal;$me") + out2+=("Small,obtctl tweak small;$me") + out2+=("Tiny,obtctl tweak tiny;$me") + out2+=("\"\"\"^sep($RAISED_OR_FLAT?)\"\"\"") + [[ "$BEVEL" == "flat" ]] && out2+=(" $FLAT,obtctl raised 0;$me") || out2+=(" $FLAT,obtctl raised 0;$me") + [[ "$BEVEL" == "raised" ]] && out2+=(" $RAISED,obtctl raised 1;$me") || out2+=(" $RAISED,obtctl raised 1;$me") + [[ "$BEVEL" == "sunken" ]] && out2+=(" $SUNKEN,obtctl raised 2;$me") || out2+=(" $SUNKEN,obtctl raised 2;$me") + out2+=("^sep($GRADIENT_TYPE)") + [[ "$GRAD" == Solid ]] && out2+=(" $SOLID_COLOR,obtctl gradient_type solid;$me") || out2+=(" $SOLID_COLOR,obtctl gradient_type solid;$me") + out2+=("^sep()") + [[ "$GRAD" == Vertical ]] && out2+=(" $VERTICAL,obtctl gradient_type vertical;$me") || out2+=(" $VERTICAL,obtctl gradient_type vertical;$me") + [[ "$GRAD" == Horizontal ]] && out2+=(" $HORIZONTAL,obtctl gradient_type horizontal;$me") || out2+=(" $HORIZONTAL,obtctl gradient_type horizontal;$me") + [[ "$GRAD" == MirrorHorizontal ]] && out2+=(" $MIRRORHORIZONTAL,obtctl gradient_type mirrorhorizontal;$me") || out2+=(" $MIRRORHORIZONTAL,obtctl gradient_type mirrorhorizontal;$me") + [[ "$GRAD" == SplitVertical ]] && out2+=(" $SPLITVERTICAL,obtctl gradient_type splitvertical;$me") || out2+=(" $SPLITVERTICAL,obtctl gradient_type splitvertical;$me") + [[ "$GRAD" == Diagonal ]] && out2+=(" $DIAGONAL,obtctl gradient_type diagonal;$me") || out2+=(" $DIAGONAL,obtctl gradient_type diagonal;$me") + [[ "$GRAD" == CrossDiagonal ]] && out2+=(" $CROSSDIAGONAL,obtctl gradient_type crossdiagonal;$me") || out2+=(" $CROSSDIAGONAL,obtctl gradient_type crossdiagonal;$me") + [[ "$GRAD" == Pyramid ]] && out2+=(" $PYRAMID,obtctl gradient_type pyramid;$me") || out2+=(" $PYRAMID,obtctl gradient_type pyramid;$me") + +#### COLOR SCHEMES  +out+=(" $THEMES,^checkout(schemes)") + out2+=("^tag(schemes)") + out2+=("^sep($THEMES)") + out2+=("^sep($SYSTEM_THEMES)") + n=1 + while IFS="|" read -r abg abgto afg aline nbg nbgto nfg nline grad txtjust pheight pwidth handle bord bevel buttons fsize fname ndslimc weight slant scheme_name + do + ((n=n+1)) + out2+=(" $(printf '%-20s' "${scheme_name}") inactive ,^checkout(schsys${n})") + out3+=("^tag(schsys${n}") + out3+=("^sep($THEME: ${scheme_name})") + out3+=("^sep($APPLY)") + out3+=("\"\"\" $APPLY_THEME\"\"\",obtctl applytheme sys ${n};$me") + out3+=("^sep()") + out3+=(" $APPLY_SCHEME ,obtctl applyscheme sys ${n};$me") + done < <(tail -n +2 "$SYSTHEMES") + out2+=("^sep($YOUR_THEMES)") + out2+=(" $SAVE_CURRTHEME,obtctl savetheme '${currvalues}';$me") + out2+=(" $OPEN_THEMEFILE,xdg-open $USERSCHEMES") + out2+=("^sep()") + n=1 + while IFS="|" read -r abg abgto afg aline nbg nbgto nfg nline grad txtjust pheight pwidth handle bord bevel buttons fsize fname ndslimc weight slant scheme_name + do + ((n=n+1)) + out2+=(" $(printf '%-20s' "${scheme_name}") inactive ,^checkout(sch${n})") + out3+=("^tag(sch${n}") + out3+=("^sep($THEME: ${scheme_name})") + out3+=("^sep($APPLY)") + out3+=("\"\"\" $APPLY_THEME\"\"\",obtctl applytheme usr ${n};$me") + out3+=("^sep()") + out3+=(" $APPLY_SCHEME ,obtctl applyscheme usr ${n};$me") + out3+=("^sep($DELETE)") + out3+=("󰗨 $DELETE_THEME: ${scheme_name},obtctl delscheme ${n};$me") + done < <(tail -n +2 "$USERTHEMES") + + out2+=("^sep($GENERATEFROMWP)") + out2+=(" $LIGHTBG ,w2theme ob light;$me") + out2+=(" $DARKBG ,w2theme ob dark;$me") + + 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')") +out+=("󰛖 $TITLEBAR_FONT [ ${FNAME} ${FSIZE} ],^checkout(titletext)") +out+=("󰧈 $PADDING [ $PHEIGHT $PWIDTH ],^checkout(padding)") +out+=("    $BUTTONS_LBL,^checkout(tbuttons)") +out+=("^sep($ACTIVE_WINDOW)") +out+=(" $ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg '${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')") +out+=(" title $TEXT_COLOR,^pipe(mbclr '$AFG' obtctl activetextcolor '${TEXT} ${ACTIVE_FG}' '$me')") +out+=("^sep($INACTIVE_WINDOW)") +out+=(" $INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg '${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+=(" title $TEXT_COLOR,^pipe(mbclr '$NFG' obtctl inactivetextcolor '${TEXT} ${INACTIVE_FG}' '$me')") out+=("^sep(Gradient)") -out+=("$GRADIENT_TYPE [ ${REST##* } ],^checkout(gradient)") +out+=("󰹸 $GRADIENT_TYPE [ ${GRAD} ],^checkout(gradient)") out+=(" $PRE_GRADIENTS,^pipe(mbgrad ob)") -out+=("凌 $GRADIENT_REVERSE,obtctl activegradient '${ABGTO}' '${ABG}';$me") +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+=("󰝣 $BORDER [ $BORD ],^checkout(border)") out+=("$HANDLEWIDTH [ $HANDLE ],^checkout(handlewidth)") -out+=("$ACTIVEHANDLE? [ $AHANDLE ],^checkout(handle)") +#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 @@ -294,7 +436,7 @@ fi #done #TBUTTONS out2+=("^tag(tbuttons)") -out2+=("^sep($BUTTONS)") +out2+=("^sep($BUTTONS_LBL)") out2+=("Tiny,obtctl buttons tiny;$me") out2+=("Normal,obtctl buttons normal;$me") out2+=("Bold,obtctl buttons bold;$me") @@ -322,11 +464,6 @@ out2+=("^sep($TEXTALIGN)") #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)") @@ -417,36 +554,32 @@ 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") +[[ "$GRAD" == Solid ]] && out2+=(" $SOLID_COLOR,obtctl gradient_type solid;$me") || 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") +[[ "$GRAD" == Vertical ]] && out2+=(" $VERTICAL,obtctl gradient_type vertical;$me") || out2+=(" $VERTICAL,obtctl gradient_type vertical;$me") +[[ "$GRAD" == Horizontal ]] && out2+=(" $HORIZONTAL,obtctl gradient_type horizontal;$me") || out2+=(" $HORIZONTAL,obtctl gradient_type horizontal;$me") +[[ "$GRAD" == MirrorHorizontal ]] && out2+=(" $MIRRORHORIZONTAL,obtctl gradient_type mirrorhorizontal;$me") || out2+=(" $MIRRORHORIZONTAL,obtctl gradient_type mirrorhorizontal;$me") +[[ "$GRAD" == SplitVertical ]] && out2+=(" $SPLITVERTICAL,obtctl gradient_type splitvertical;$me") || out2+=(" $SPLITVERTICAL,obtctl gradient_type splitvertical;$me") +[[ "$GRAD" == Diagonal ]] && out2+=(" $DIAGONAL,obtctl gradient_type diagonal;$me") || out2+=(" $DIAGONAL,obtctl gradient_type diagonal;$me") +[[ "$GRAD" == CrossDiagonal ]] && out2+=(" $CROSSDIAGONAL,obtctl gradient_type crossdiagonal;$me") || out2+=(" $CROSSDIAGONAL,obtctl gradient_type crossdiagonal;$me") +[[ "$GRAD" == Pyramid ]] && out2+=(" $PYRAMID,obtctl gradient_type pyramid;$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(handle)") +#out2+=("^sep($ACTIVEHANDLE)") +#out2+=("$NO,obtctl activehandle no;$me") +#out2+=("$YES,obtctl activehandle yes;$me") +#out2+=("$GRIPONLY,obtctl activehandle grip;$me") +#HANDLE WIDTH out2+=("^tag(handlewidth)") out2+=("^sep($HANDLEWIDTH)") out2+=("0,obtctl handlewidth 0;$me") out2+=("^sep()") +out2+=("1,obtctl handlewidth 1;$me") out2+=("2,obtctl handlewidth 2;$me") out2+=("3,obtctl handlewidth 3;$me") out2+=("4,obtctl handlewidth 4;$me") @@ -560,6 +693,7 @@ cat < ${MENU_ITEMS} @text,,$((jgtools_padding + 138)),$((jgtools_padding + 120)),130,30,0,left,top,#FFFFFF ,${WINCLR},Colorizer Openbox $(printf '%s\n' "${out[@]}") $(printf '%s\n' "${out2[@]}") +$(printf '%s\n' "${out3[@]}") EOF jgmenu --config-file=${CONFIG_FILE} --csv-file=${MENU_ITEMS} 2>/dev/null @@ -569,3 +703,4 @@ exit 0 fi printf '%s\n' "${out[@]}" printf '%s\n' "${out2[@]}" +printf '%s\n' "${out3[@]}" diff --git a/bin/obtctl b/bin/obtctl index 4f71ad7..235af2c 100755 --- a/bin/obtctl +++ b/bin/obtctl @@ -73,7 +73,7 @@ borderWidth () { sd "^border.width:.*$" "border.width: ${BWIDTH}" ${THEMERC} fi ;; - 0|1|2|3|4|5|6|7|8) + *) sd "^border.width:.*$" "border.width: $1" ${THEMERC} ;; esac @@ -179,14 +179,59 @@ random_gradient () { activegradient "$CLR" "$CLRTO" } activegradient () { - #notify-send.sh "zmiennne obtctl" "${1} ${2}" + # ACTIVE + + # ACTIVE GRIP and HANDLE + colorTo=$(pastel darken 0.1 "${1}"|pastel format hex) + #activehandle? + ###read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)" + ###read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)" + ###if [ "$ABG" == "$AHBG" ];then + + ###fi + sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${1}" ${THEMERC} + sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${colorTo}" ${THEMERC} + sd "^window.active.title.bg.color:.*$" "window.active.title.bg.color: ${1}" ${THEMERC} + sd "\.active.border.color:.*$" ".active.border.color: ${1}" ${THEMERC} + + sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${colorTo}" ${THEMERC} + + #sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${1}" ${THEMERC} sd "^window.active.title.bg.color:.*$" "window.active.title.bg.color: ${1}" ${THEMERC} sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${2}" ${THEMERC} - # Border color = active.title.bg.color (gradient start color) sd "\.active.border.color:.*$" ".active.border.color: $1" ${THEMERC} + #### INACTIVE + icolor=$(pastel mix -s RGB -f 0.3 ${1} '#000000' |pastel format hex) + icolorTo=$(pastel mix -s RGB -f 0.3 ${2} '#000000' |pastel format hex) + + + sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${icolor}" ${THEMERC} + sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${icolorTo}" ${THEMERC} + # Border color = active.title.bg.color (gradient start color) + sd "\.inactive.border.color:.*$" ".inactive.border.color: ${icolor}" ${THEMERC} + + ## INACTIVE GRIP and HANDLE + #normalhandle? + ###read IBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)" + ###read IHBG <<< "$(grep .inactive.handle.bg.color: ${THEMERC} | cut -d':' -f2)" + ###if [ "$IBG" == "$IHBG" ];then + sd "\.inactive.handle.bg.color:.*$" ".inactive.handle.bg.color: ${icolor}" ${THEMERC} + sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${icolorTo}" ${THEMERC} + ###fi + sd "\.inactive.grip.bg.color:.*$" ".inactive.grip.bg.color: ${icolor}" ${THEMERC} + sd "\.inactive.grip.bg.colorTo:.*$" ".inactive.grip.bg.colorTo: ${icolorTo}" ${THEMERC} + sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${icolor}" ${THEMERC} + sd "\.inactive.border.color:.*$" ".inactive.border.color: ${icolor}" ${THEMERC} + sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${icolorTo}" ${THEMERC} + + ## Active handle always have inactive colors + sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${icolor}" ${THEMERC} + sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${icolorTo}" ${THEMERC} + + # calculate color for title.fg and buttons TITLE_FG=$(pastel textcolor ${2}|pastel format hex) if [[ "${TITLE_FG}" == *"ffffff"* ]];then @@ -207,10 +252,47 @@ activegradient () { shadow light fi fi - - } -activegradient_reverse () { +gradient () { + sd "^window.active.title.bg.color:.*$" "window.active.title.bg.color: ${1}" ${THEMERC} + sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${2}" ${THEMERC} + # Border color = active.title.bg.color (gradient start color) + sd "\.active.border.color:.*$" ".active.border.color: $1" ${THEMERC} + + #### INACTIVE + icolor=$(pastel darken 0.5 ${1}|pastel format hex) + icolorTo=$(pastel darken 0.5 ${2}|pastel format hex) + + sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${icolor}" ${THEMERC} + sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${icolorTo}" ${THEMERC} + # Border color = active.title.bg.color (gradient start color) + sd "\.inactive.border.color:.*$" ".inactive.border.color: ${icolor}" ${THEMERC} + + + + # calculate color for title.fg and buttons + TITLE_FG=$(pastel textcolor ${2}|pastel format hex) + if [[ "${TITLE_FG}" == *"ffffff"* ]];then + TITLE_FG="#E5E5E5" + else + TITLE_FG="#222222" + fi + sd "\.active.label.text.color:.*$" ".active.label.text.color: ${TITLE_FG}" ${THEMERC} + + # Button colors + activebuttonscolors "${TITLE_FG}" + # Shadow + read SHADOW <<< "$(grep .active.label.text.font: ${THEMERC} | cut -d':' -f2| cut -d'=' -f2)" + if [ "$SHADOW" == "y" ];then + if [ "$TITLE_FG" == "#E5E5E5" ];then + shadow dark + else + shadow light + fi + fi + +} +gradient_reverse () { : } activehandle () { @@ -305,39 +387,33 @@ clrnormalbg_only () { clrnormalbg () { colorTo=$(pastel darken 0.1 "${1}"|pastel format hex) - #normalhandle? - read IBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)" - read IHBG <<< "$(grep .inactive.handle.bg.color: ${THEMERC} | cut -d':' -f2)" - if [ "$IBG" == "$IHBG" ];then - sd "\.inactive.handle.bg.color:.*$" ".inactive.handle.bg.color: ${1}" ${THEMERC} - sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${colorTo}" ${THEMERC} - fi + + ###sd "\.inactive.handle.bg.color:.*$" ".inactive.handle.bg.color: ${1}" ${THEMERC} + ###sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${colorTo}" ${THEMERC} + sd "\.handle.bg.color:.*$" ".handle.bg.color: ${1}" ${THEMERC} + sd "\.handle.bg.colorTo:.*$" ".handle.bg.colorTo: ${colorTo}" ${THEMERC} + sd "\.inactive.grip.bg.color:.*$" ".inactive.grip.bg.color: ${1}" ${THEMERC} sd "\.inactive.grip.bg.colorTo:.*$" ".inactive.grip.bg.colorTo: ${colorTo}" ${THEMERC} sd "^window.inactive.title.bg.color:.*$" "window.inactive.title.bg.color: ${1}" ${THEMERC} - sd "\.inactive.border.color:.*$" ".inactive.border.color: ${1}" ${THEMERC} sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${colorTo}" ${THEMERC} + sd "\.inactive.border.color:.*$" ".inactive.border.color: ${1}" ${THEMERC} } clractivebgto () { sd "^window.active.title.bg.colorTo:.*$" "window.active.title.bg.colorTo: ${1}" ${THEMERC} #activehandle? - read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)" - read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)" - if [ "$ABG" == "$AHBG" ];then + ###read ABG <<< "$(grep .active.title.bg.color: ${THEMERC} | cut -d':' -f2)" + ###read AHBG <<< "$(grep .active.handle.bg.color: ${THEMERC} | cut -d':' -f2)" + ###if [ "$ABG" == "$AHBG" ];then sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${1}" ${THEMERC} - fi + ###fi sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${1}" ${THEMERC} } clrnormalbgto () { sd "^window.inactive.title.bg.colorTo:.*$" "window.inactive.title.bg.colorTo: ${1}" ${THEMERC} - #normalhandle? - read IBG <<< "$(grep .inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)" - read IHBG <<< "$(grep .inactive.handle.bg.color: ${THEMERC} | cut -d':' -f2)" - if [ "$IBG" == "$IHBG" ];then sd "\.inactive.handle.bg.colorTo:.*$" ".inactive.handle.bg.colorTo: ${1}" ${THEMERC} - fi sd "\.inactive.grip.bg.colorTo:.*$" ".inactive.grip.bg.colorTo: ${1}" ${THEMERC} } activetextcolor () { @@ -578,6 +654,107 @@ randomizer () { -o "Regenerate:randomizer ob" -o "Customize:colorizer-ob -s" } +tweak() { + case "$1" in + large) + fontsize 14 + paddingHeight 8 + buttons big-14 + borderWidth 4 + handlewidth 6 + ;; + big) + fontsize 12 + paddingHeight 6 + buttons big-12 + borderWidth 1 + handlewidth 4 + ;; + normal) + fontsize 11 + paddingHeight 4 + buttons tiny + borderWidth 0 + handlewidth 3 + ;; + small) + fontsize 10 + paddingHeight 2 + buttons dots + borderWidth 0 + handlewidth 2 + ;; + tiny) + fontsize 9 + paddingHeight 1 + buttons normal + borderWidth 0 + handlewidth 0 + ;; + *):;; + esac +} +savetheme () { + case "$LANG" in + pl*)SAVE_AS="Nowy motyw Openbox" + DESC="Zapisz obecne ustawionia Openbox jako nowy motyw..." + LABEL="Nazwa:" + NAME="nazwa";; + *) SAVE_AS="New Openbox theme" + DESC="Save current Openbox window decoration setup as theme..." + LABEL="Name:" + NAME="theme-name";; + esac + # ask for scheme name + schemename=$(yad --center --width=300 --borders=20 --window-icon=mbcc --title "$SAVE_AS" --text="$DESC" --entry --entry-label="$LABEL" --entry-text="$NAME") || exit 1 + + echo "${1}${schemename}" >> "$HOME/.config/colorizer/openbox/userthemes.csv" +} +applyscheme () { + theme MBcolors + case "$1" in + sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/ob.csv";; + usr) SCHEMEFILE="$HOME/.config/colorizer/openbox/userthemes.csv";; + esac + while IFS="|" read -r abg abgto afg aline nbg nbgto nfg nline grad txtjust pheight pwidth handle bord bevel button fsize fname ndslim weight slant scheme_name + do + clractivebg "${abg}" + clractivebgto "${abgto}" + activetextcolor "${afg}" + activeborderColor "${aline}" + clrnormalbg "${nbg}" + clrnormalbgto "${nbgto}" + inactivetextcolor "${nfg}" + inactiveborderColor "${nline}" + gradient_type "${grad}" + done < <(awk 'NR == n' n=$2 "$SCHEMEFILE") +} +applytheme() { + case "$1" in + sys) SCHEMEFILE="/usr/share/mabox-colorizer/colorschemes/ob.csv";; + usr) SCHEMEFILE="$HOME/.config/colorizer/openbox/userthemes.csv";; + esac + applyscheme "$1" "$2" + while IFS="|" read -r abg abgto afg aline nbg nbgto nfg nline grad txtjust pheight pwidth handle bord bevel button fsize fname ndslim weight slant scheme_name + do + textjustify "${txtjust}" + paddingHeight "${pheight}" + paddingWidth "${pwidth}" + handlewidth "${handle}" + borderWidth "${bord}" + raised "${bevel}" + buttons "${button}" + fontsize "${fsize}" + fontfamily "${fname}" + ndslimc "${ndslim}" + fontweight "${weight}" + fontslant "${slant}" + done < <(awk 'NR == n' n=$2 "$SCHEMEFILE") +} +delscheme() { + sed -i ${1}d "$HOME/.config/colorizer/openbox/userthemes.csv" +} + case "$1" in theme) theme "$2";; reset) reset;; @@ -595,6 +772,7 @@ case "$1" in gradient_type) gradient_type "$2";; random_gradient) random_gradient;; activegradient) activegradient "$2" "$3";; + gradient_reverse) gradient_reverse;; activehandle) activehandle "$2";; clractivebg_only) clractivebg_only "$2";; #ADVANCED - do not calculate colorTo clractivebg) clractivebg "$2";; @@ -614,6 +792,11 @@ case "$1" in fontweighttoggle) fontweighttoggle;; fontslanttoggle) fontslanttoggle;; randomizer) randomizer;; + tweak) tweak "$2";; + savetheme) savetheme "$2";; + applyscheme) applyscheme "$2" "$3";; + applytheme) applytheme "$2" "$3";; + delscheme) delscheme "$2";; *) : ;; esac diff --git a/bin/w2theme b/bin/w2theme index 8af734a..94b1fca 100755 --- a/bin/w2theme +++ b/bin/w2theme @@ -284,6 +284,7 @@ case "$1" in obtctl clrnormalbgto "$(pastel darken 0.1 "${w[1]}"|pastel format hex)" ;; esac + obtctl shadow 0 } colorize () { source ~/.config/colorizer/colorizer.conf diff --git a/share/mabox-colorizer/colorschemes/ob.csv b/share/mabox-colorizer/colorschemes/ob.csv new file mode 100644 index 0000000..2bb14b3 --- /dev/null +++ b/share/mabox-colorizer/colorschemes/ob.csv @@ -0,0 +1,7 @@ + ABG | ABGTO | AFG | ALINE | NBG | NBGTO | NFG | NLINE | GRAD |TXTJUST|PHEIGHT|PWIDTH|HANDLE|BORD|BEVEL|BUTTONS|FSIZE|FNAME|NDSLIMC|WEIGHT|SLANT|scheme_name +#579c8e|#41756a|#ffffff|#579c8e|#383838|#2a2a2a|#898989|#292929|vertical|center|4|4|4|1|raised|tiny|11|Noto Sans|NDSLIMC|Normal|Normal|Mabox Istredd +#d2cda1|#c6b76b|#222222|#d2cda1|#0c1d23|#000000|#898989|#0c1d23|vertical|center|4|4|2|0|raised|big-12|12|Noto Sans|NLIMC|Normal|Normal|Mabox Jaskier Light +#283433|#1a231a|#E5E5E5|#283433|#0c100f|#080b08|#898989|#0c100f|horizontal|center|4|4|2|0|raised|tiny|11|Noto Sans|NLIMC|Normal|Normal|Mabox Jaskier Dark +#D9D9D9|#B6B6B6|#0F0F0F|#BDBBB9|#D9D9D9|#B4B4B4|#656565|#BFBCBB|vertical|left|2|2|1|0|raised|bold|11|Ubuntu Bold|NLIMC|Bold|Normal|Light Grey +#CE5C00|#9b4600|#E5E5E5|#CE5C00|#D3D7CF|#B4B4B4|#656565|#BFBCBB|mirrorhorizontal|center|2|2|1|0|raised|dots|11|Noto Sans|NLIMC|Normal|Normal|Orange +#F7941E|#004E8F|#E5E5E5|#F7941E|#4a2c09|#00172b|#656565|#4a2c09|mirrorhorizontal|center|4|4|1|0|raised|big-14|13|Ubuntu|NLIMC|Normal|Normal|Sky and Sea