one place to configure fonts

master 0.9.50
Daniel Napora 2023-08-30 14:00:09 +02:00
parent 7c0bd902af
commit 082d27f52e
8 changed files with 716 additions and 75 deletions

View File

@ -62,6 +62,7 @@ case "$LANG" in
REVERSE="odwrotnie"
CURRENTCONF="Obecna konfiguracja"
MODULES="Moduły"
FONTS="Konfiguruj <b>Czcionki</b>"
OBTHEME="Motyw Openbox"
MENUPANELS="Menu i Panele"
CAVA="Cava - wizualizacja dźwięku"
@ -158,6 +159,7 @@ case "$LANG" in
REVERSE="reverse"
CURRENTCONF="Current configuration"
MODULES="Modules"
FONTS="Configure <b>Fonts</b>"
OBTHEME="Openbox Theme"
MENUPANELS="Menus/Panels"
CAVA="Cava - Audio Visualizer"
@ -299,6 +301,8 @@ fi
out+=("^sep()")
out+=(" $COLORIZE,^pipe(randomizer c)")
out+=("^sep($MODULES)")
out+=("<big></big> $FONTS,^pipe(colorizer-fonts)")
out+=("^sep()")
out+=("$OBTHEME,^pipe(colorizer-ob)")
#out+=("TINT2,^pipe(colorizer-tint2)")

View File

@ -72,6 +72,7 @@ case "$LANG" in
FONTS="Czcionka"
SELECTFONT="Wybierz czcionkę..."
FONTFAMILY_LBL="czcionka"
_EDIT_FAVFONTS="Edytuj ulubione czcionki"
FONTSIZE_LBL="rozmiar czcionki"
INCREASE="Powiększ do"
DECREASE="Pomniejsz do"
@ -117,6 +118,7 @@ case "$LANG" in
FONTS="Font"
SELECTFONT="Select Font..."
FONTFAMILY_LBL="font family"
_EDIT_FAVFONTS="Edit favorite fonts list"
FONTSIZE_LBL="font size"
INCREASE="Increase to"
DECREASE="Decrease to"
@ -300,7 +302,15 @@ if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then
out2+=("^tag(font)")
out2+=("^sep($FONTS)")
out2+=("<big>󰛖</big> $SELECTFONT [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],mb-setfont conky_all;$me")
out2+=("^sep($FONTSIZE_LBL)")
out2+=("<big>󰧴</big> $INCREASE <b>$((FONTSIZE+1)) px</b>,conkyctl basefont_inc_all;$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((FONTSIZE-1)) px</b>,conkyctl basefont_dec_all;$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size_all $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size_all $i;$me")
done
if [ -f "$HOME/.config/mabox/fonts.list" ];then
mapfile -t favfonts < <( grep -vE "^($|#)" ~/.config/mabox/fonts.list)
else
@ -315,16 +325,8 @@ if pgrep -u $USER -af "conky.*mbcolor" >/dev/null; then
done
fi
out2+=("^sep()")
out2+=("<small> Edit favorited fonts list</small>,geany ~/.config/mabox/fonts.list")
out2+=("^sep($FONTSIZE_LBL)")
out2+=("<big>󰧴</big> $INCREASE <b>$((FONTSIZE+1)) px</b>,conkyctl basefont_inc_all;$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((FONTSIZE-1)) px</b>,conkyctl basefont_dec_all;$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size_all $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size_all $i;$me")
done
out2+=("<small> $_EDIT_FAVFONTS</small>,geany ~/.config/mabox/fonts.list")
[[ "$SHADOWS" == "shadow" ]] && out+=("<big>󰄲</big> $SHADOW,conkyctl shades_all no;$me") || out+=("<big>󰄱</big> $SHADOW,conkyctl shades_all shadow;$me")
[[ "$SHADOWS" == "outline" ]] && out+=("<big>󰄲</big> $OLINE,conkyctl shades_all no;$me") || out+=("<big>󰄱</big> $OLINE,conkyctl shades_all outline;$me")

406
bin/colorizer-fonts 100755
View File

@ -0,0 +1,406 @@
#!/bin/bash
#
# colorizer - set of tools for Mabox (auto)theming
# Copyright (C) 2022-2023 Daniel Napora <napcok@gmail.com>
#
# 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 <http://www.gnu.org/licenses/>.
. $HOME/.config/mabox/mabox.conf
me="colorizer-fonts -s"
CONKYDIR="$HOME/.config/conky"
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
# Favorited fonts list
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
case "$LANG" in
pl*)
_INCREASE_ALL="Powiększ wszystkie"
_DECREASE_ALL="Pomniejsz wszystkie"
_RESET="Resetuj do domyślnych"
_ALL="Wszystko"
_OPENBOX_WM="Openbox"
_TITLEBAR_FONT="Czcionka tytułu"
_BOLD="Pogrubienie"
_ITALIC="Kursywa"
_TEXTALIGN="Wyrównanie"
_LEFT="Lewo"
_CENTER="Środek"
_RIGHT="Prowo"
_MENUS="Menu"
_MENU_TITLE="Nagłówek"
_MENU_ITEM="Element"
_MENU_TITLE_FONT="Czcionka nagłówka"
_MENU_ITEM_FONT="Czcionka elementu"
_FONT_CUSTOM="Wybierz czcionkę i rozmiar..."
_FONT_FAMILY="rodzina"
_EDIT_FAVFONTS="Edytuj ulubione czcionki"
_FONT_SIZE="rozmiar"
_INCREASE="Powiększ do"
_DECREASE="Pomniejsz do"
_CONKY="Conky"
_CONKYFONT="Czcionka dla Conky"
_CONKYBASEFONT="Czcionka podstawowa"
_C_EFFECTS="Efekty"
_SHADOW="Cień"
_OUTLINE="Poświata"
_PANEL="Panel tint2"
_GTK="GTK"
_FAVORITE_LBL="Ulubione czcionki"
_USE="Użyj czcionki"
_FOR="dla..."
;;
*)
_INCREASE_ALL="Increase all"
_DECREASE_ALL="Decrease all"
_RESET="Reset to defaults..."
_ALL="All"
_OPENBOX_WM="Openbox"
_TITLEBAR_FONT="TitleBar Font"
_BOLD="Bold"
_ITALIC="Italic"
_TEXTALIGN="Text align"
_LEFT="Left"
_CENTER="Center"
_RIGHT="Right"
_MENUS="Menus"
_MENU_TITLE="Menu Title"
_MENU_ITEM="Menu Item"
_MENU_TITLE_FONT="Menu Title Font"
_MENU_ITEM_FONT="Menu Item Font"
_FONT_CUSTOM="Select custom font and size..."
_FONT_FAMILY="font family"
_EDIT_FAVFONTS="Edit favorite fonts list"
_FONT_SIZE="font size"
_INCREASE="Increase to"
_DECREASE="Decrease to"
_CONKY="Widgets (Conky)"
_CONKYFONT="Conky Font"
_CONKYBASEFONT="Base font"
_C_EFFECTS="Effects"
_SHADOW="Shadow"
_OUTLINE="Outline"
_PANEL="Panel Tint2"
_GTK="GTK Font"
_FAVORITE_LBL="Favorite Fonts"
_USE="Use"
_FOR="font for ..."
;;
esac
getvalues () {
GTK2RC="$HOME"/.gtkrc-2.0
GTK_FONT=( $(grep "gtk-font-name" ${GTK2RC} | cut -d'"' -f2) )
GTK_FAMILY=${GTK_FONT[@]::${#GTK_FONT[@]}-1}
GTK_SIZE=${GTK_FONT[-1]}
nspace="http://openbox.org/3.4/rc"
obcfg="$HOME/.config/openbox/rc.xml"
OBFSIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$obcfg")
OBFNAME=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name' "$obcfg")
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' "$obcfg")
SLANT=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:slant' "$obcfg")
OBTHEME=$(awk '/<theme>/ {while (getline n) {if (match(n, /<name>/))
{l=n; exit}}} END {split(l, a, "[<>]"); print a[3]}' "$HOME/.config/openbox/rc.xml")
THEMERC="$HOME/.themes/$OBTHEME/openbox-3/themerc"
if [ -f "$THEMERC" ];then
read TXTJUST <<< "$(grep text.justify ${THEMERC} | cut -d':' -f2)"
else
:
fi
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
C_FONT=${FONTDEF%:*}
C_FONTSIZE=${FONTDEF#*=}
}
getvalues
out+=("<big>󰧴</big> $_INCREASE_ALL,fontctl inc_all;$me")
out+=("<big>󰧳</big> $_DECREASE_ALL,fontctl dec_all;$me")
out+=("^sep()")
out+=("<big>󰑓</big> $_RESET,^checkout(reset)")
out2+=("^tag(reset)")
out2+=("^sep($_RESET)")
out2+=("$_ALL,fontctl resetall;$me")
out2+=("^sep()")
out2+=("$_TITLEBAR_FONT,fontctl resetob;$me")
out2+=("$_MENUS,fontctl resetmenus;$me")
out2+=("$_CONKY,fontctl resetconky;$me")
out2+=("$_GTK,fontctl resetgtk;$me")
out+=("^sep($_OPENBOX_WM)")
out+=("$_TITLEBAR_FONT [ <b><span font_family=\"$OBFNAME\">$OBFNAME $OBFSIZE</span></b> ],^checkout(obtitletext)")
out+=("^sep($_MENUS)")
out+=("$_MENU_TITLE [ <b><span font_family=\"$menu_sep_font_family\">$menu_sep_font_family $menu_sep_font_size</span></b> ],^checkout(mtitlefont)")
out+=("$_MENU_ITEM [ <b><span font_family=\"$menu_font_family\">$menu_font_family $menu_font_size</span></b> ],^checkout(mitemfont)")
out+=("^sep($_GTK)")
out+=("$_GTK [ <b>${GTK_FAMILY} ${GTK_SIZE}</b> ],^checkout(gtkfont)")
out+=("^sep($_CONKY)")
out+=("$_CONKYBASEFONT [ <b><span font_family=\"${C_FONT}\">$C_FONT</span> $C_FONTSIZE</b> ],^checkout(conkyfont)")
#out+=("^sep($_PANEL)")
#out+=("<i>(not implemented yet)</i>")
# FAV FONTS in rootmenu
if [ "${#favfonts[@]}" -gt 0 ];then
out+=("^sep($_FAVORITE_LBL)")
i=0
for fon in "${favfonts[@]}";do
out+=("<span> </span><span font_family=\"${fon}\">${fon}</span>,^checkout(favfont$i),$me")
out2+=("^tag(favfont$i)")
out2+=("^sep($_USE)")
out2+=("^sep(<span font_family=\"${fon}\">${fon}</span>)")
out2+=("^sep($_FOR)")
out2+=("$_TITLEBAR_FONT,obtctl fontfamily \"${fon}\";$me")
out2+=("$_MENU_TITLE,mb-setvar \"menu_sep_font_family='${fon}'\";$me")
out2+=("$_MENU_ITEM,mb-setvar \"menu_font_family='${fon}'\";$me")
out2+=("$_GTK,fontctl gtk_fontfamily \"${fon}\";$me")
out2+=("$_CONKY,conkyctl basefont_family_all \"${fon}\";$me")
i=$((i+1))
done
out+=("^sep()")
out+=("<small> $_EDIT_FAVFONTS </small>,geany ~/.config/mabox/fonts.list")
fi
#SUBMENUS
# OpenBox Title Font
out2+=("^tag(obtitletext)")
out2+=("^sep($_TITLEBAR_FONT)")
out2+=("^sep(<span font_family=\"$OBFNAME\">$OBFNAME $OBFSIZE</span>)")
out2+=("<big>󰛖</big> $_FONT_CUSTOM,mb-setfont obtitle;$me")
out2+=("^sep($_FONT_SIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((OBFSIZE+1)) px</b>,fontctl ob_fontsize inc;$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((OBFSIZE-1)) px</b>,fontctl ob_fontsize dec;$me")
out2+=("^sep()")
sizes=(16 15 14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$OBFSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,obtctl fontsize $i;$me") || out2+=("<big>祿</big> $i px,fontctl ob_fontsize $i;$me")
done
out2+=("^sep($_FONT_FAMILY)")
if [ "${#favfonts[@]}" -gt 0 ];then
for fon in "${favfonts[@]}";do
[[ "${OBFNAME}" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,obtctl fontfamily \"${fon}\";$me")
done
fi
out2+=("^sep()")
[[ "$WEIGHT" =~ .*"old" ]] && out2+=("<big></big> <b>$_BOLD</b>,obtctl fontweight Normal;$me") || out2+=("<big></big> <b>$_BOLD</b>,obtctl fontweight Bold;$me")
[[ "$SLANT" =~ .*"talic" ]] && out2+=("<big></big> <i>$_ITALIC</i>,obtctl fontslant Normal;$me") || out2+=("<big></big> <i>$_ITALIC</i>,obtctl fontslant Italic;$me")
#SHADOW
out2+=("^sep($_TEXTALIGN)")
[[ "$TXTJUST" = left ]] && out2+=("<big>綠 </big> $_LEFT,obtctl textjustify left;$me")||out2+=("<big>祿 </big> $_LEFT,obtctl textjustify left;$me")
[[ "$TXTJUST" = center ]] && out2+=("<big>綠 </big> $_CENTER,obtctl textjustify center;$me")||out2+=("<big>祿 </big> $_CENTER,obtctl textjustify center;$me")
[[ "$TXTJUST" = right ]] && out2+=("<big>綠 </big> $_RIGHT,obtctl textjustify right;$me")||out2+=("<big>祿 </big> $_RIGHT,obtctl textjustify right;$me")
# Menu Title Font
out2+=("^tag(mtitlefont)")
out2+=("^sep($_MENU_TITLE_FONT)")
out2+=("^sep(<span font_family=\"$menu_sep_font_family\">$menu_sep_font_family $menu_sep_font_size</span>)")
out2+=("<big>󰛖</big> $_FONT_CUSTOM,mb-setfont menu_sep;$me")
out2+=("^sep($_FONT_SIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((menu_sep_font_size+1)) px</b>,mb-setvar menu_sep_font_size=$((menu_sep_font_size+1));$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((menu_sep_font_size-1)) px</b>,mb-setvar menu_sep_font_size=$((menu_sep_font_size-1));$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$menu_sep_font_size" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,$me") || out2+=("<big>祿</big> $i px,mb-setvar menu_sep_font_size=$i;$me")
done
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($_FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$menu_sep_font_family" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,mb-setvar \"menu_sep_font_family='${fon}'\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> $_EDIT_FAVFONTS </small>,geany ~/.config/mabox/fonts.list")
# Item font submenu
out2+=("^tag(mitemfont)")
out2+=("^sep($_MENU_ITEM_FONT)")
out2+=("^sep(<span font_family=\"$menu_font_family\">$menu_font_family $menu_font_size</span>)")
out2+=("<big>󰛖</big> $_FONT_CUSTOM,mb-setfont menu_item;$me")
out2+=("^sep($_FONT_SIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((menu_font_size+1)) px</b>,mb-setvar menu_font_size=$((menu_font_size+1));$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((menu_font_size-1)) px</b>,mb-setvar menu_font_size=$((menu_font_size-1));$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$menu_font_size" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,$me") || out2+=("<big>祿</big> $i px,mb-setvar menu_font_size=$i;$me")
done
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($_FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$menu_font_family" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,mb-setvar \"menu_font_family='${fon}'\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> $_EDIT_FAVFONTS</small>,geany ~/.config/mabox/fonts.list")
# Conky
out2+=("^tag(conkyfont)")
out2+=("^sep($_CONKYFONT)")
out2+=("^sep($C_FONT $C_FONTSIZE)")
out2+=("<big>󰛖</big> $_FONT_CUSTOM,mb-setfont conky_all;$me")
out2+=("^sep($_FONT_SIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((C_FONTSIZE+1)) px</b>,conkyctl basefont_inc_all;$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((C_FONTSIZE-1)) px</b>,conkyctl basefont_dec_all;$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$C_FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size_all $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size_all $i;$me")
done
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($_FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$C_FONT" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,conkyctl basefont_family_all \"${fon}\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> Edit favorited fonts list</small>,geany ~/.config/mabox/fonts.list")
out2+=("^sep($_C_EFFCTS)")
[[ "$SHADOWS" == "shadow" ]] && out2+=("<big>󰄲</big> $_SHADOW,conkyctl shades_all no;$me") || out2+=("<big>󰄱</big> $_SHADOW,conkyctl shades_all shadow;$me")
[[ "$SHADOWS" == "outline" ]] && out2+=("<big>󰄲</big> $_OUTLINE,conkyctl shades_all no;$me") || out2+=("<big>󰄱</big> $_OUTLINE,conkyctl shades_all outline;$me")
# GTK 2/3 font
out2+=("^tag(gtkfont)")
out2+=("^sep($_GTK)")
out2+=("^sep(<span font_family=\"$menu_font_family\">$menu_font_family $menu_font_size</span>)")
out2+=("<big>󰛖</big> $_FONT_CUSTOM,mb-setfont gtk;$me")
out2+=("^sep($_FONT_SIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((GTK_SIZE+1)) px</b>,fontctl gtk_fontsize inc;$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((GTK_SIZE-1)) px</b>,fontctl gtk_fontsize dec;$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$GTK_SIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,$me") || out2+=("<big>祿</big> $i px,fontctl gtk_fontsize $i;$me")
done
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($_FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$GTK_FAMILY" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,fontctl gtk_fontfamily \"${fon}\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> $_EDIT_FAVFONTS</small>,geany ~/.config/mabox/fonts.list")
### RUN
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+=(" ⮜⮜⮜ 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)
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 <<EOF > ${MENU_ITEMS}
@icon,,$((jgtools_padding+4)),$((jgtools_padding+4)),270,150,4,left,top,,,${THUMB}
#@icon,,$((jgtools_padding + 4)),$((jgtools_padding + 4)),270,150,4,left,top,,,/usr/share/mabox-colorizer/img/colorizer-conky.png
@rect,,$((jgtools_padding+4)),$((jgtools_padding + 120)),270,28,0,left,top,#222222 20,#222222 70,
@text,,$((jgtools_padding + 14)),$((jgtools_padding + 110)),100,28,0,left,top,#FFFFFF ,${WINCLR},<span size='41600' font_family='Ubuntu'><big></big></span>
@text,,$((jgtools_padding + 132)),$((jgtools_padding + 120)),150,28,0,left,top,#FFFFFF ,${WINCLR},<span size='10400' font_family='Ubuntu'>Mabox <b>Fonts</b> config</span>
$(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[@]}"

View File

@ -64,6 +64,14 @@ case "$LANG" in
PRE_GRADIENTS="Gotowe gradienty"
GRADIENT_REVERSE="Odwróć kolory Gradientu"
ITEM="Pozycja (element) menu "
FONT="Czcionka"
INCREASE="Powiększ do"
DECREASE="Pomniejsz do"
FONT_CUSTOM="Wybierz czcionkę i rozmiar..."
FONT_FAMILY="rodzina"
FONT_SIZE="rozmiar"
ITEM_FONT="Czcionka elementu"
TITLE_FONT="Czcionka nagłówka"
COLOR_NORM_FG="Kolor tekstu"
COLOR_SEL_BG="Tło aktywnej pozycji"
COLOR_SEL_FG="Tekst aktywnej pozycji"
@ -109,6 +117,14 @@ case "$LANG" in
PRE_GRADIENTS="Predefined gradients"
GRADIENT_REVERSE="Reverse gradient colors"
ITEM="Item"
FONT="Font"
INCREASE="Increase to"
DECREASE="Decrease to"
FONT_CUSTOM="Select custom font and size..."
FONT_FAMILY="font family"
FONT_SIZE="font size"
ITEM_FONT="Item Font"
TITLE_FONT="Title Font"
COLOR_NORM_FG="Text Color"
COLOR_SEL_BG="Selected Item Background"
COLOR_SEL_FG="Selected Item Text"
@ -216,6 +232,7 @@ out+=("<tt><span bgcolor='#16a084'> </span><span bgcolor='#43a480'> </span><span
out+=("^sep($ITEM)")
out+=("<big>󰛖</big> $FONT [ <b>$menu_font_family $menu_font_size</b> ],^checkout(mitemfont)")
out+=("<tt><small>$(printf '%3s' "$NFGA")</small> <span weight='bold' fgcolor='$NFG' fgalpha='${NFGA/#[0]/1}%'> AbCd </span></tt> $COLOR_NORM_FG,^pipe(mbclr '$NFG' jgctl color_norm_fg '${COLOR_NORM_FG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$SBGA")</small> <span bgcolor='$SBG' bgalpha='${SBGA/#[0]/1}%'> </span><span bgcolor='$SBG'> </span></tt> $COLOR_SEL_BG,^pipe(mbclr '$SBG' jgctl color_sel_bg '${COLOR_SEL_BG}' '$me')")
@ -225,7 +242,68 @@ out+=("^sep()")
[[ ! -z "$NORMBG" ]] && out+=("<tt><small>$(printf '%3s' "$NORMBGA")</small> <span bgcolor='${NORMBG}' bgalpha='${NORMBGA/#[0]/1}%'> </span><span bgcolor='${NORMBG}'> </span></tt> $COLOR_NORM_BG,^pipe(mbclr '$NORMBG' jgctl color_norm_bg '${COLOR_NORM_BG}' '$me')" "^sep()")
out+=("$ITEM_BORDER [ <b>$IBORDER</b> ],^checkout(itemborder)")
out+=("$ITEM_RADIUS [ <b>$IRADIUS</b> ],^checkout(itemradius)")
# Item font submenu
out2+=("^tag(mitemfont)")
out2+=("^sep($ITEM_FONT)")
out2+=("<big>󰛖</big> $FONT_CUSTOM,mb-setfont menu_item;$me")
out2+=("^sep($FONT_SIZE)")
out2+=("<big>󰧴</big> $INCREASE <b>$((menu_font_size+1)) px</b>,mb-setvar menu_font_size=$((menu_font_size+1));$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((menu_font_size-1)) px</b>,mb-setvar menu_font_size=$((menu_font_size-1));$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$menu_font_size" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,$me") || out2+=("<big>祿</big> $i px,mb-setvar menu_font_size=$i;$me")
done
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
out2+=("^sep($FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$menu_font_family" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,mb-setvar \"menu_font_family='${fon}'\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> Edit favorited fonts list</small>,geany ~/.config/mabox/fonts.list")
out+=("^sep($SEPARATOR_TITLE)")
out+=("<big>󰛖</big> $FONT [ <b>$menu_sep_font_family $menu_sep_font_size</b> ],^checkout(mtitlefont)")
out2+=("^tag(mtitlefont)")
out2+=("^sep($TITLE_FONT)")
out2+=("<big>󰛖</big> $FONT_CUSTOM,mb-setfont menu_sep;$me")
out2+=("^sep($FONT_SIZE)")
out2+=("<big>󰧴</big> $INCREASE <b>$((menu_sep_font_size+1)) px</b>,mb-setvar menu_sep_font_size=$((menu_sep_font_size+1));$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((menu_sep_font_size-1)) px</b>,mb-setvar menu_sep_font_size=$((menu_sep_font_size-1));$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$menu_sep_font_size" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,$me") || out2+=("<big>祿</big> $i px,mb-setvar menu_sep_font_size=$i;$me")
done
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($FONT_FAMILY)")
for fon in "${favfonts[@]}";do
[[ "$menu_sep_font_family" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,mb-setvar \"menu_sep_font_family='${fon}'\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> Edit favorited fonts list</small>,geany ~/.config/mabox/fonts.list")
out+=("<tt><small>$(printf '%3s' "$TBGA")</small> <span bgcolor='$TBG' bgalpha='${TBGA}%'> </span><span bgcolor='$TBG'> </span></tt> $COLOR_TITLE_BG,^pipe(mbclr '$TBG' jgctl color_title_bg '${COLOR_TITLE_BG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$TFGA")</small> <span weight='bold' bgcolor='$TBG' bgalpha='${TBGA/#[0]/1}%' fgcolor='$TFG' fgalpha='${TFGA}%'> AbCd </span></tt> $COLOR_TITLE_FG,^pipe(mbclr '$TFG' jgctl color_title_fg '${COLOR_TITLE_FG}' '$me')")
out+=("<tt><small>$(printf '%3s' "$TBORDERA")</small> <span bgcolor='$TBORDER' bgalpha='${TBORDERA/#[0]/1}%'> </span><span bgcolor='$TBORDER'> </span></tt> $COLOR_TITLE_BORDER,^pipe(mbclr '$TBORDER' jgctl color_title_border '${COLOR_TITLE_BORDER}' '$me')")

View File

@ -48,6 +48,9 @@ case "$LANG" in
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"
@ -109,7 +112,10 @@ case "$LANG" in
TITLEBAR_TEXT="Title Bar Text"
TITLEBAR_FONT="Title Bar Font"
FONT="Font"
FONTSIZE="Font size"
FONTSIZE="font size"
_INCREASE="Increase to"
_DECREASE="Decrease to"
FONTFAMILY="font family"
BOLD="Bold"
ITALIC="Italic"
TEXTALIGN="Title align"
@ -317,9 +323,21 @@ out2+=("^tag(titletext)")
out2+=("^sep(TEXT_COLOR)")
out2+=("<tt><span bgcolor='$ABG' fgcolor='$AFG'> <b>active title</b> </span></tt> $ACTIVE_FG,^pipe(mbclr '$AFG' obtctl activetextcolor '${TEXT} ${ACTIVE_FG}' '$me')")
out2+=("<tt><span bgcolor='$NBG' fgcolor='$NFG'> <b>inactive title</b> </span></tt> $INACTIVE_FG,^pipe(mbclr '$NFG' obtctl inactivetextcolor '${TEXT} ${INACTIVE_FG}' '$me')")
out2+=("^sep($TITLEBAR_FONT)")
out2+=("$FONT... [ <b> ${FNAME} ${FSIZE} </b> ],mb-setfont obtitle;$me")
out2+=("^sep(font family)")
out2+=("^sep($FONTSIZE)")
out2+=("<big>󰧴</big> $_INCREASE <b>$((FSIZE+1)) px</b>,fontctl ob_fontsize inc;$me")
out2+=("<big>󰧳</big> $_DECREASE <b>$((FSIZE-1)) px</b>,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+=("<big>綠</big> <b>$i px</b>,obtctl fontsize $i;$me") || out2+=("<big>祿</big> $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)
@ -337,12 +355,7 @@ fi
out2+=("^sep()")
[[ "$WEIGHT" =~ .*"old" ]] && out2+=("<big></big> <b>$BOLD</b>,obtctl fontweight Normal;$me") || out2+=("<big></big> <b>$BOLD</b>,obtctl fontweight Bold;$me")
[[ "$SLANT" =~ .*"talic" ]] && out2+=("<big></big> <i>$ITALIC</i>,obtctl fontslant Normal;$me") || out2+=("<big></big> <i>$ITALIC</i>,obtctl fontslant Italic;$me")
out2+=("^sep($FONTSIZE)")
sizes=(16 15 14 13 12 11 10 9 8)
for i in "${sizes[@]}"
do
[[ "$FSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,obtctl fontsize $i;$me") || out2+=("<big>祿</big> $i px,obtctl fontsize $i;$me")
done
#SHADOW
out2+=("^sep($TEXTALIGN)")
[[ "$TXTJUST" = left ]] && out2+=("<big>綠 </big> $LEFT,obtctl textjustify left;$me")||out2+=("<big>祿 </big> $LEFT,obtctl textjustify left;$me")

View File

@ -413,6 +413,7 @@ languages () {
FONTS="Czcionka"
SELECTFONT="Wybierz czcionkę..."
FONTFAMILY_LBL="czcionka"
_EDIT_FAVFONTS="Edytuj ulubione czcionki"
FONTSIZE_LBL="rozmiar czcionki"
INCREASE="Powiększ do"
DECREASE="Pomniejsz do"
@ -475,6 +476,7 @@ languages () {
FONTS="Font"
SELECTFONT="Select Font..."
FONTFAMILY_LBL="font family"
_EDIT_FAVFONTS="Edit favorite fonts list"
FONTSIZE_LBL="font size"
INCREASE="Increase to"
DECREASE="Decrease to"
@ -537,6 +539,7 @@ languages () {
FONTS="Font"
SELECTFONT="Select Font..."
FONTFAMILY_LBL="font family"
_EDIT_FAVFONTS="Edit favorite fonts list"
FONTSIZE_LBL="font size"
INCREASE="Increase to"
DECREASE="Decrease to"
@ -760,54 +763,42 @@ if [[ "$OLD_SYNTAX" = "true" ]];then
if [[ "$1" != *"logo_mbcolor"* ]]; then
if [[ "$1" != *"quoter_mbcolor"* ]]; then
out+=("<big>󰛖</big> $FONTS [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],^checkout(fontsingle)")
out2+=("^tag(fontsingle)")
out2+=("^sep($FONTS)")
out2+=("<big>󰛖</big> $SELECTFONT [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],mb-setfont conky_single ${1};$me")
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
#notify-send.sh "Ile" "${#favfonts[@]}"
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($FONTFAMILY_LBL)")
for fon in "${favfonts[@]}";do
[[ "$FONT" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,conkyctl basefont_family ${1} \"${fon}\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> Edit favorited fonts list</small>,geany ~/.config/mabox/fonts.list")
out2+=("^sep($FONTSIZE_LBL)")
out2+=("<big>󰧴</big> $INCREASE <b>$((FONTSIZE+1)) px</b>,conkyctl basefont_inc ${1};$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((FONTSIZE-1)) px</b>,conkyctl basefont_dec ${1};$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size ${1} $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size ${1} $i;$me")
done
out+=("<big>󰛖</big> $FONTS [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],^checkout(fontsingle)")
out2+=("^tag(fontsingle)")
out2+=("^sep($FONTS)")
out2+=("<big>󰛖</big> $SELECTFONT [ <b><span font_family=\"${FONT}\">$FONT</span> $FONTSIZE</b> ],mb-setfont conky_single ${1};$me")
out2+=("^sep($FONTSIZE_LBL)")
out2+=("<big>󰧴</big> $INCREASE <b>$((FONTSIZE+1)) px</b>,conkyctl basefont_inc ${1};$me")
out2+=("<big>󰧳</big> $DECREASE <b>$((FONTSIZE-1)) px</b>,conkyctl basefont_dec ${1};$me")
out2+=("^sep()")
sizes=(14 13 12 11 10 9 8 7 6)
for i in "${sizes[@]}"
do
[[ "$FONTSIZE" == "$i" ]] && out2+=("<big>綠</big> <b>$i px</b>,conkyctl basefont_size ${1} $i;$me") || out2+=("<big>祿</big> $i px,conkyctl basefont_size ${1} $i;$me")
done
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
#notify-send.sh "Ile" "${#favfonts[@]}"
if [ "${#favfonts[@]}" -gt 0 ];then
out2+=("^sep($FONTFAMILY_LBL)")
for fon in "${favfonts[@]}";do
[[ "$FONT" == "$fon" ]] && out2+=("<big>綠</big> <span font_family=\"${fon}\">${fon}</span>,$me") || out2+=("<big>祿</big> <span font_family=\"${fon}\">${fon}</span>,conkyctl basefont_family ${1} \"${fon}\";$me")
done
fi
out2+=("^sep()")
out2+=("<small> $_EDIT_FAVFONTS</small>,geany ~/.config/mabox/fonts.list")
fi
[[ "$SHADOWS" == "shadow" ]] && out+=("<big>󰄲</big> $SHADOW,conkyctl shades no ${1};$me") || out+=("<big>󰄱</big> $SHADOW,conkyctl shades shadow ${1};$me")
[[ "$SHADOWS" == "outline" ]] && out+=("<big>󰄲</big> $OLINE,conkyctl shades no ${1};$me") || out+=("<big>󰄱</big> $OLINE,conkyctl shades outline ${1};$me")
out+=("^sep()")
#out+=("$OLINE/$SHADOW [ <b>$SHADOWS</b> ],^checkout(outline2)")
#out2+=("^tag(outline2)")
#out2+=("^sep($DRAW $OLINE/$SHADOW?)")
#out2+=("$NO,conkyctl shades no ${1};$me")
#out2+=("^sep()")
#out2+=("$DRAW $SHADOW,conkyctl shades shadow ${1};$me")
#out2+=("$DRAW $OLINE,conkyctl shades outline ${1};$me")
#out+=("^sep()")
fi
[[ "$BORD" == false ]] && out+=("<big>󰄱</big> $BORDERS [ <b>$STIP</b> ],^checkout(bordersingle)") || out+=("<big>󰄲</big> $BORDERS [ <b>$STIP</b> ],^checkout(bordersingle)")
out2+=("^tag(bordersingle)")
out2+=("^sep($DRAW $BORDERS?)")

146
bin/fontctl 100755
View File

@ -0,0 +1,146 @@
#!/bin/bash
# fontctl - cli to handle fonts in Mabox: openbox, jgmenu, tint2, conky, gtk
CONKYDIR="$HOME"/.config/conky
BASECONKY="$CONKYDIR/sysinfo_mbcolor.conkyrc"
. $HOME/.config/mabox/mabox.conf
get_gtkfont() {
GTK2RC="$HOME"/.gtkrc-2.0
GTK3RC="$HOME"/.config/gtk-3.0/settings.ini
GTK_FONT=( $(grep "gtk-font-name" ${GTK2RC} | cut -d'"' -f2) )
GTK_FAMILY=${GTK_FONT[@]::${#GTK_FONT[@]}-1}
GTK_SIZE=${GTK_FONT[-1]}
}
gtk_fontfamily() {
get_gtkfont
sd "^gtk-font-name=.*" "gtk-font-name=\"${1} ${GTK_SIZE}\"" ${GTK2RC}
sd "^gtk-font-name=.*" "gtk-font-name=${1} ${GTK_SIZE}" ${GTK3RC}
reload-gtk
}
gtk_fontsize() {
get_gtkfont
case "$1" in
inc) SIZE=$((GTK_SIZE+1));;
dec) SIZE=$((GTK_SIZE-1));;
*) SIZE=${1};;
esac
sd "^gtk-font-name=.*" "gtk-font-name=\"${GTK_FAMILY} ${SIZE}\"" ${GTK2RC}
sd "^gtk-font-name=.*" "gtk-font-name=${GTK_FAMILY} ${SIZE}" ${GTK3RC}
reload-gtk
}
resetgtk() {
get_gtkfont
sd "^gtk-font-name=.*" "gtk-font-name=\"Ubuntu 10\"" ${GTK2RC}
sd "^gtk-font-name=.*" "gtk-font-name=Ubuntu 10" ${GTK3RC}
reload-gtk
}
resetob () {
nspace="http://openbox.org/3.4/rc"
cfg="$HOME/.config/openbox/rc.xml"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name' -v "Ubuntu" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:name' -v "Ubuntu" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v 9 "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v 9 "$cfg"
#add Weight and slant
openbox --reconfigure
}
resetmenus () {
mb-setvar menu_font_size=10
mb-setvar menu_sep_font_size=11
mb-setvar "menu_font_family=\'Ubuntu\'"
mb-setvar "menu_sep_font_family=\'Ubuntu Bold\'"
}
resetconky () {
sd "font .*=.*,$" "font = 'Ubuntu:size=8'," ${CONKYDIR}/*mbcolor.conkyrc
}
resetall () {
resetconky
resetob
resetmenus
resetgtk
}
inc_all() {
gtk_fontsize inc
inc_conky
inc_menus
}
dec_all() {
gtk_fontsize dec
dec_conky
dec_menus
}
inc_conky () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE++))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
}
dec_conky () {
read FONTDEF <<< "$(grep "font .*=.*,$" ${BASECONKY} | cut -d'=' -f2,3 |cut -d"'" -f2)"
FONT=${FONTDEF%:*}
FONTSIZE=${FONTDEF#*=}
((FONTSIZE--))
sd "font .*=.*,$" "font = '${FONT}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
}
inc_menus () {
mb-setvar menu_font_size=$((menu_font_size+1))
mb-setvar menu_sep_font_size=$((menu_sep_font_size+1))
}
dec_menus () {
mb-setvar menu_font_size=$((menu_font_size-1))
mb-setvar menu_sep_font_size=$((menu_sep_font_size-1))
}
ob_fontsize () {
nspace="http://openbox.org/3.4/rc"
cfg="$HOME/.config/openbox/rc.xml"
case "$1" in
inc|increase)
SIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
if [ "$SIZE" -lt "21" ];then
((SIZE=SIZE+1))
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "$SIZE" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "$SIZE" "$cfg"
fi
;;
dec|decrease)
SIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
if [ "$SIZE" -gt "7" ];then
((SIZE=SIZE-1))
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "$SIZE" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "$SIZE" "$cfg"
fi
;;
*)
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "$1" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "$1" "$cfg"
;;
esac
openbox --reconfigure
}
case "$1" in
gtk_fontfamily) gtk_fontfamily "$2";;
gtk_fontsize) gtk_fontsize "$2";;
inc_all) inc_all;;
dec_all) dec_all;;
inc_conky) inc_conky;;
dec_conky) dec_conky;;
inc_menus) inc_menus;;
dec_menus) dec_menus;;
ob_fontsize) ob_fontsize "$2";; # arg: size, inc or dec
resetall) resetall;;
resetob) resetob;;
resetmenus) resetmenus;;
resetconky) resetconky;;
resetgtk) resetgtk;;
*):;;
esac

View File

@ -402,7 +402,7 @@ fontsize () {
nspace="http://openbox.org/3.4/rc"
cfg="$HOME/.config/openbox/rc.xml"
case "$1" in
increase)
inc|increase)
SIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
if [ "$SIZE" -lt "21" ];then
((SIZE=SIZE+1))
@ -410,7 +410,7 @@ fontsize () {
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "$SIZE" "$cfg"
fi
;;
decrease)
dec|decrease)
SIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
if [ "$SIZE" -gt "7" ];then
((SIZE=SIZE-1))
@ -484,21 +484,21 @@ randomizer () {
activegradient "$CLR" "$CLRTO"
### rand gradient type
TYPES=(solid vertical horizontal mirrorhorizontal splitvertical)
rand=$((RANDOM%5))
TYPES=(solid vertical horizontal mirrorhorizontal diagonal pyramid)
rand=$((RANDOM%6))
G_TYPE="${TYPES[$rand]}"
gradient_type "${G_TYPE}"
#rand
### Random border
BORDERS=(0 1 2 4)
rand=$((RANDOM%4))
rand=$((RANDOM%3))
BORDER="${BORDERS[$rand]}"
borderWidth "${BORDER}"
### Random padding
PADDINGS=(2 4 8 12 16)
PADDINGS=(2 4 8 12)
rand=$((RANDOM%4))
PADDING="${PADDINGS[$rand]}"
@ -511,13 +511,7 @@ randomizer () {
raised "${STYLE}"
### Buttons
BUTTONS=(tiny normal bold dots)
rand=$((RANDOM%4))
BUTTON="${BUTTONS[$rand]}"
buttons "${BUTTON}"
### TEXT ALIGN
ALIGNS=(left center right)
rand=$((RANDOM%3))
@ -526,8 +520,8 @@ randomizer () {
textjustify "${ALIGN}"
### FONT FAMILY
FAMILIES=(Ubuntu Sans "Roboto Condensed" "GE Inspira")
rand=$((RANDOM%4))
FAMILIES=(Ubuntu "Noto Sans" "Roboto Condensed" "GE Inspira" "JetBrains Mono")
rand=$((RANDOM%5))
FAMILY="${FAMILIES[$rand]}"
fontfamily "${FAMILY}"
@ -555,6 +549,13 @@ randomizer () {
fontsize "${FONTSIZE}"
### Buttons
BUTTONS=(tiny normal bold dots big-12 big-14)
rand=$((RANDOM%6))
BUTTON="${BUTTONS[$rand]}"
buttons "${BUTTON}"
#MSG="
#Openbox Window Decoration settings