63 lines
1.9 KiB
Bash
Executable File
63 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# mb-setfont
|
|
getfont () {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FONT=$(yad --title='Select A Font' --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 () {
|
|
if [[ "$FONT" ]]; then
|
|
mb-setvar menu_font_family="'${FONTNAME} ${FONTSTYLE}'"
|
|
mb-setvar menu_font_size=${FONTSIZE}
|
|
else
|
|
exit 0
|
|
fi
|
|
}
|
|
|
|
|
|
case "$1" in
|
|
obtitle)
|
|
getfont
|
|
font_obtitle
|
|
;;
|
|
menu)
|
|
getfont
|
|
font_menu
|
|
;;
|
|
*)
|
|
:
|
|
;;
|
|
esac
|