gtk fonts

This commit is contained in:
Daniel Napora 2023-08-29 22:49:48 +02:00
parent b890992b56
commit c882092096

View File

@ -14,6 +14,15 @@ get_obfont () {
CURRENT_FONT="$NAME $WEIGHT $SLANT $SIZE"
}
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]}
CURRENT_FONT="${GTK_FAMILY} ${GTK_SIZE}"
}
get_menu_item_font () {
. ~/.config/mabox/mabox.conf
CURRENT_FONT="${menu_font_family} ${menu_font_size}"
@ -65,7 +74,15 @@ font_obtitle () {
exit 0
fi
}
font_gtk () {
if [[ "$FONT" ]]; then
sd "^gtk-font-name=.*" "gtk-font-name=\"${FONTNAME} ${FONTSTYLE} ${FONTSIZE}\"" ${GTK2RC}
sd "^gtk-font-name=.*" "gtk-font-name=${FONTNAME} ${FONTSTYLE} ${FONTSIZE}" ${GTK3RC}
reload-gtk
else
exit 0
fi
}
font_menu_item () {
if [[ "$FONT" ]]; then
mb-setvar menu_font_family="'${FONTNAME} ${FONTSTYLE}'"
@ -115,6 +132,11 @@ case "$1" in
selectfont
font_obtitle
;;
gtk)
get_gtkfont
selectfont
font_gtk
;;
menu_item)
get_menu_item_font
selectfont