2022-05-15 03:25:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
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")
|
|
|
|
#echo "$OBTHEME"
|
2022-06-04 22:50:37 +02:00
|
|
|
THEMEDIR="$HOME/.themes/$OBTHEME/openbox-3"
|
2022-05-15 03:25:01 +02:00
|
|
|
THEMERC="$HOME/.themes/$OBTHEME/openbox-3/themerc"
|
|
|
|
|
|
|
|
if [ ! -f "${THEMERC}.bak" ]; then
|
|
|
|
cp ${THEMERC} ${THEMERC}.bak
|
|
|
|
fi
|
|
|
|
|
|
|
|
theme () {
|
|
|
|
xmlstarlet ed -L -N o="http://openbox.org/3.4/rc" -u '/o:openbox_config/o:theme/o:name' -v "$1" "$HOME/.config/openbox/rc.xml"
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
reset () {
|
|
|
|
rm ${THEMERC}
|
|
|
|
mv ${THEMERC}.bak ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
|
|
|
|
borderWidth () {
|
|
|
|
sd "^border.width:.*$" "border.width: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
activeborderColor () {
|
|
|
|
sd "\.active.border.color:.*$" ".active.border.color: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
inactiveborderColor () {
|
|
|
|
sd "\.inactive.border.color:.*$" ".inactive.border.color: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
paddingHeight () {
|
|
|
|
sd "^padding.height:.*$" "padding.height: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
paddingWidth () {
|
|
|
|
sd "^padding.width:.*$" "padding.width: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
textjustify () {
|
|
|
|
sd "\.text.justify:.*$" ".text.justify: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
shadow () {
|
|
|
|
case "$1" in
|
|
|
|
0)
|
|
|
|
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=n:shadowtint=70:shadowoffset=1" ${THEMERC}
|
|
|
|
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=n:shadowtint=20:shadowoffset=1" ${THEMERC}
|
|
|
|
;;
|
|
|
|
1)
|
|
|
|
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=y:shadowtint=70:shadowoffset=1" ${THEMERC}
|
|
|
|
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=y:shadowtint=20:shadowoffset=1" ${THEMERC}
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
sd "\.active.label.text.font:.*$" ".active.label.text.font: shadow=y:shadowtint=-70:shadowoffset=1" ${THEMERC}
|
|
|
|
sd "\.inactive.label.text.font:.*$" ".inactive.label.text.font: shadow=y:shadowtint=-20:shadowoffset=1" ${THEMERC}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
handlewidth () {
|
|
|
|
sd "\.handle.width:.*$" ".handle.width: $1" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
raised () {
|
|
|
|
#flat or raised
|
|
|
|
read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
case "$1" in
|
|
|
|
0)
|
|
|
|
sd "\.title.bg:.*$" ".title.bg: flat ${REST}" ${THEMERC}
|
|
|
|
sd "\.handle.bg:.*$" ".handle.bg: flat ${REST}" ${THEMERC}
|
|
|
|
sd "\.grip.bg:.*$" ".grip.bg: flat ${REST}" ${THEMERC}
|
|
|
|
openbox --reconfigure;;
|
|
|
|
1)
|
|
|
|
sd "\.title.bg:.*$" ".title.bg: raised ${REST}" ${THEMERC}
|
|
|
|
sd "\.handle.bg:.*$" ".handle.bg: raised ${REST}" ${THEMERC}
|
|
|
|
sd "\.grip.bg:.*$" ".grip.bg: raised ${REST}" ${THEMERC}
|
|
|
|
openbox --reconfigure;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
gradient () {
|
|
|
|
#solid or gradient gradient-type
|
|
|
|
read WINRAISED REST <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
case "$1" in
|
|
|
|
solid)
|
|
|
|
sd "\.title.bg:.*$" ".title.bg: ${WINRAISED} solid" ${THEMERC}
|
|
|
|
sd "\.handle.bg:.*$" ".handle.bg: ${WINRAISED} solid" ${THEMERC}
|
|
|
|
sd "\.grip.bg:.*$" ".grip.bg: ${WINRAISED} solid" ${THEMERC}
|
|
|
|
openbox --reconfigure;;
|
|
|
|
*)
|
|
|
|
sd "\.title.bg:.*$" ".title.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
|
|
|
|
sd "\.handle.bg:.*$" ".handle.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
|
|
|
|
sd "\.grip.bg:.*$" ".grip.bg: ${WINRAISED} gradient ${1}" ${THEMERC}
|
|
|
|
openbox --reconfigure;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
activehandle () {
|
|
|
|
case "$1" in
|
|
|
|
no) #no
|
|
|
|
read NBG <<< "$(grep inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read NBGTO <<< "$(grep inactive.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
#notify-send.sh "Normal" "${NBG} ${NBGTO}"
|
|
|
|
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${NBG}" ${THEMERC}
|
|
|
|
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${NBGTO}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg:.*$" ".active.grip.bg: parentrelative" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${NBG}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${NBGTO}" ${THEMERC}
|
|
|
|
;;
|
|
|
|
yes) #yes
|
|
|
|
read ABG <<< "$(grep window.active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read ABGTO <<< "$(grep window.active.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
#notify-send.sh "Active" "${ABG} ${ABGTO}"
|
|
|
|
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${ABG}" ${THEMERC}
|
|
|
|
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${ABGTO}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg:.*$" ".active.grip.bg: parentrelative" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${ABG}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${ABGTO}" ${THEMERC}
|
|
|
|
;;
|
|
|
|
grip)
|
|
|
|
read GRAD <<< "$(grep .title.bg: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read ABG <<< "$(grep window.active.title.bg.color: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read ABGTO <<< "$(grep window.active.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read NBG <<< "$(grep inactive.title.bg.color: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
read NBGTO <<< "$(grep inactive.title.bg.colorTo: ${THEMERC} | cut -d':' -f2)"
|
|
|
|
sd "\.active.grip.bg:.*$" ".active.grip.bg: ${GRAD}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.color:.*$" ".active.grip.bg.color: ${ABG}" ${THEMERC}
|
|
|
|
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${ABGTO}" ${THEMERC}
|
|
|
|
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${NBG}" ${THEMERC}
|
|
|
|
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${NBGTO}" ${THEMERC}
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
#openbox --reconfigure
|
|
|
|
}
|
|
|
|
clractivebg () {
|
|
|
|
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
|
|
|
|
sd "\.active.handle.bg.color:.*$" ".active.handle.bg.color: ${1}" ${THEMERC}
|
|
|
|
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${colorTo}" ${THEMERC}
|
|
|
|
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}
|
2022-06-29 16:31:14 +02:00
|
|
|
#menu (Openbox menu - not really used in Mabox)
|
|
|
|
sd "menu.title.bg.color:.*$" "menu.title.bg.color: ${1}" ${THEMERC}
|
|
|
|
sd "menu.title.bg.colorTo:.*$" "menu.title.bg.colorTo: ${colorTo}" ${THEMERC}
|
|
|
|
|
|
|
|
sd "menu.items.active.bg.color:.*$" "menu.items.active.bg.color: ${1}" ${THEMERC}
|
|
|
|
sd "menu.items.active.bg.colorTo:.*$" "menu.items.active.bg.colorTo: ${colorTo}" ${THEMERC}
|
2022-05-15 03:25:01 +02:00
|
|
|
|
|
|
|
openbox --reconfigure
|
2022-06-29 16:31:14 +02:00
|
|
|
|
|
|
|
|
2022-05-15 03:25:01 +02:00
|
|
|
}
|
|
|
|
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.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}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
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
|
|
|
|
sd "\.active.handle.bg.colorTo:.*$" ".active.handle.bg.colorTo: ${1}" ${THEMERC}
|
|
|
|
fi
|
|
|
|
sd "\.active.grip.bg.colorTo:.*$" ".active.grip.bg.colorTo: ${1}" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
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}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
activetextcolor () {
|
|
|
|
sd "\.active.label.text.color:.*$" ".active.label.text.color: ${1}" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
|
|
|
inactivetextcolor () {
|
|
|
|
sd "\.inactive.label.text.color:.*$" ".inactive.label.text.color: ${1}" ${THEMERC}
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
2022-06-04 22:50:37 +02:00
|
|
|
buttons () {
|
|
|
|
rm $THEMEDIR/*.xbm
|
|
|
|
cp -a /usr/share/mabox-colorizer/themes/obbuttons/${1}/*.xbm $THEMEDIR/
|
|
|
|
openbox --reconfigure
|
|
|
|
}
|
2022-05-15 03:25:01 +02:00
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
theme) theme "$2";;
|
|
|
|
reset) reset;;
|
|
|
|
borderWidth) borderWidth "$2";;
|
|
|
|
activeborderColor) activeborderColor "$2";;
|
|
|
|
inactiveborderColor) inactiveborderColor "$2";;
|
|
|
|
paddingHeight) paddingHeight "$2";;
|
|
|
|
paddingWidth) paddingWidth "$2";;
|
|
|
|
textjustify) textjustify "$2";;
|
|
|
|
shadow) shadow "$2";;
|
|
|
|
handlewidth) handlewidth "$2";;
|
|
|
|
raised) raised "$2";;
|
|
|
|
gradient) gradient "$2";;
|
|
|
|
activehandle) activehandle "$2"
|
|
|
|
openbox --reconfigure
|
|
|
|
;;
|
|
|
|
clractivebg) clractivebg "$2";;
|
|
|
|
clractivebgto) clractivebgto "$2";;
|
|
|
|
clrnormalbg) clrnormalbg "$2";;
|
|
|
|
clrnormalbgto) clrnormalbgto "$2";;
|
|
|
|
activetextcolor) activetextcolor "$2";;
|
|
|
|
inactivetextcolor) inactivetextcolor "$2";;
|
2022-06-04 22:50:37 +02:00
|
|
|
buttons) buttons "$2";;
|
2022-05-15 03:25:01 +02:00
|
|
|
*) : ;;
|
|
|
|
esac
|