106 lines
2.9 KiB
Bash
Executable File
106 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# mb-setfont
|
|
getfont () {
|
|
case "$LANG" in
|
|
pl*)
|
|
SELECTFONT="Wybierz czcionkę i jej rozmiar"
|
|
CANCEL="Anuluj"
|
|
SELECT="Wybierz"
|
|
;;
|
|
*)
|
|
SELECTFONT="Select A Font"
|
|
CANCEL="Cancel"
|
|
SELECT="Select"
|
|
;;
|
|
esac
|
|
|
|
FONT=$(yad --title="${SELECTFONT}" --font --separate-output --button="$CANCEL:1" --button="$SELECT:0")
|
|
FONTNAME=$(echo $FONT | cut -d'|' -f1)
|
|
FONTSTYLE=$(echo $FONT | cut -d'|' -f2)
|
|
FONTSIZE=$(echo $FONT | cut -d'|' -f3)
|
|
}
|
|
|
|
font_obtitle () {
|
|
if [[ "$FONT" ]]; then
|
|
[[ "$FONTSTYLE" =~ .*"Bold".* ]] && WEIGHT="Bold" || WEIGHT="Normal"
|
|
[[ "$FONTSTYLE" =~ .*"Italic".* ]] && SLANT="Italic" || SLANT="Normal"
|
|
|
|
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 "$FONTNAME" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "$FONTSIZE" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:weight' -v "$WEIGHT" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:slant' -v "$SLANT" "$cfg"
|
|
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:name' -v "$FONTNAME" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "$FONTSIZE" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:weight' -v "$WEIGHT" "$cfg"
|
|
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:slant' -v "$SLANT" "$cfg"
|
|
openbox --reconfigure
|
|
else
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
font_menu_item () {
|
|
if [[ "$FONT" ]]; then
|
|
mb-setvar menu_font_family="'${FONTNAME} ${FONTSTYLE}'"
|
|
mb-setvar menu_font_size=${FONTSIZE}
|
|
else
|
|
exit 0
|
|
fi
|
|
}
|
|
font_menu_sep () {
|
|
if [[ "$FONT" ]]; then
|
|
mb-setvar menu_sep_font_family="'${FONTNAME} ${FONTSTYLE}'"
|
|
mb-setvar menu_sep_font_size=${FONTSIZE}
|
|
else
|
|
exit 0
|
|
fi
|
|
}
|
|
font_conky_single () {
|
|
# if -f "$1"
|
|
if [[ "$FONT" ]]; then
|
|
sd "font .*=.*,$" "font = '${FONTNAME}:size=${FONTSIZE}'," ${1}
|
|
else
|
|
exit 0
|
|
fi
|
|
#fi
|
|
}
|
|
font_conky_all () {
|
|
if [[ "$FONT" ]]; then
|
|
CONKYDIR="$HOME/.config/conky"
|
|
sd "font .*=.*,$" "font = '${FONTNAME}:size=${FONTSIZE}'," ${CONKYDIR}/*mbcolor.conkyrc
|
|
else
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
case "$1" in
|
|
obtitle)
|
|
getfont
|
|
font_obtitle
|
|
;;
|
|
menu_item)
|
|
getfont
|
|
font_menu_item
|
|
;;
|
|
menu_sep)
|
|
getfont
|
|
font_menu_sep
|
|
;;
|
|
conky_single)
|
|
getfont
|
|
font_conky_single "${2}"
|
|
;;
|
|
conky_all)
|
|
getfont
|
|
font_conky_all
|
|
;;
|
|
*)
|
|
:
|
|
;;
|
|
esac
|