[Openbox module] title text and buttons handling improvements

master 0.9.45
Daniel Napora 2023-07-31 01:14:59 +02:00
parent 69f0299723
commit 6523ccd67a
23 changed files with 204 additions and 15 deletions

View File

@ -42,11 +42,14 @@ case "$LANG" in
LIGHTBG="Jasne"
DARKBG="Ciemne"
TITLEBAR="Pasek tytułowy"
TITLEBAR_FONT="Czcionka"
ACTIVE_BG="Tło aktywnego okna"
INACTIVE_BG="Tło nieaktywnego okna"
TITLEBAR_TEXT="Tekst paska tytułowego"
FONT="Czcionka"
TEXTALIGN="Wyrównanie tekstu"
BOLD="Pogrubienie"
ITALIC="Kursywa"
TEXTALIGN="Wyrównanie tytułu"
LEFT="do lewej"
CENTER="po środku"
RIGHT="do prawej"
@ -100,8 +103,11 @@ case "$LANG" in
ACTIVE_BG="Active Background"
INACTIVE_BG="Inactive Background"
TITLEBAR_TEXT="Title Bar Text"
TITLEBAR_FONT="Title Bar Font"
FONT="Font"
TEXTALIGN="Text align"
BOLD="Bold"
ITALIC="Italic"
TEXTALIGN="Title align"
LEFT="left"
CENTER="center"
RIGHT="right"
@ -200,15 +206,27 @@ getvalues () {
else
AHANDLE="no"
fi
#from RC.xml
nspace="http://openbox.org/3.4/rc"
cfg="$HOME/.config/openbox/rc.xml"
FSIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
FNAME=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:name' "$cfg")
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' "$cfg")
SLANT=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:slant' "$cfg")
}
getvalues
out+=("^sep($OBTHEME_LBL: <i>$OBTHEME</i>)")
out+=("^sep($TITLEBAR)")
out+=("<tt><span bgcolor='$ABG' fgcolor='$AFG'> <b>AbCd</b> </span></tt> $TITLEBAR_TEXT,^checkout(titletext)")
out+=("<tt><span bgcolor='$ABG' fgcolor='$AFG'><small>    </small></span></tt> $BUTTONS,^checkout(tbuttons)")
out+=("<tt><span bgcolor='$ABG'> </span></tt> $ACTIVE_BG,^pipe(mbclr '$ABG' obtctl clractivebg_only '${ACTIVE_BG}' '$me')")
[[ ! -z "$ABGTO" ]] && out+=("<tt><span bgcolor='$ABG'> </span><span bgcolor='$ABGTO'> </span></tt> $ACTIVE_BG_TO,^pipe(mbclr '$ABGTO' obtctl clractivebgto '${ACTIVE_BG_TO}' '$me')")
out+=("<tt><span bgcolor='$ABG' fgcolor='$AFG'> <b>AbCd</b> </span></tt> $TITLEBAR_TEXT,^checkout(titletext)")
out+=("^sep()")
out+=("<tt><span bgcolor='$NBG'> </span></tt> $INACTIVE_BG,^pipe(mbclr '$NBG' obtctl clrnormalbg_only '${INACTIVE_BG}' '$me')")
@ -218,7 +236,6 @@ out+=("^sep()")
out+=("$PADDING [ <b>$PHEIGHT $PWIDTH</b> ],^checkout(padding)")
out+=("\"\"\"$RAISED_OR_FLAT? [ <b>$WINRAISED</b> ]\"\"\",^checkout(raised)")
out+=("^sep()")
out+=("$BUTTONS,^checkout(tbuttons)")
out+=("^sep(Gradient)")
out+=("$GRADIENT_TYPE [ <b>${REST##* }</b> ],^checkout(gradient)")
out+=("<tt><span bgcolor='#16a084'> </span><span bgcolor='#43a480'> </span><span bgcolor='#5da97b'> </span><span bgcolor='#72ad77'> </span><span bgcolor='#84b171'> </span><span bgcolor='#95b66c'> </span><span bgcolor='#a5ba66'> </span><span bgcolor='#b5be61'> </span><span bgcolor='#c3c15a'> </span><span bgcolor='#d1c753'> </span><span bgcolor='#dfc94c'> </span><span bgcolor='#edce44'> </span><span bgcolor='#f4d03f'> </span></tt> $PRE_GRADIENTS,^pipe(mbgrad ob)")
@ -262,21 +279,54 @@ out2+=("Bold,obtctl buttons bold;$me")
out2+=("Dots,obtctl buttons dots;$me")
out2+=("^sep()")
out2+=("Big 12px,obtctl buttons big-12;$me")
out2+=("Big 14px,obtctl buttons big-14;$me")
out2+=("^sep(TITLE_LAYOUT)")
[[ "$NDSLIMC" == NDSLIMC ]] && out2+=("<big>綠</big> <tt>full </tt> <b>NDSLIMC</b> (default),obtctl ndslimc NDSLIMC;$me") || out2+=("<big>祿</big> <tt>full </tt> <b>NDSLIMC</b> (default),obtctl ndslimc NDSLIMC;$me")
[[ "$NDSLIMC" == NLIMC ]] && out2+=("<big>綠</big> <tt>mini </tt> <b>NLIMC</b>,obtctl ndslimc NLIMC;$me") || out2+=("<big>祿</big> <tt>mini </tt> <b>NLIMC</b>,obtctl ndslimc NLIMC;$me")
[[ "$NDSLIMC" == LIMC ]] && out2+=("<big>綠</big> <tt>mini (no icon)</tt> <b>LIMC</b>,obtctl ndslimc LIMC;$me") || out2+=("<big>祿</big> <tt>mini (no icon)</tt> <b>LIMC</b>,obtctl ndslimc LIMC;$me")
[[ "$NDSLIMC" == CMIL ]] && out2+=("<big>綠</big> <tt>crazy </tt> <b>CMIL</b>,obtctl ndslimc CMIL;$me") || out2+=("<big>祿</big> <tt>crazy </tt> <b>CMIL</b>,obtctl ndslimc CMIL;$me")
out2+=("^sep(<small>LEGEND</small>)")
out2+=("^sep(N:<small> Window icon</small>)")
out2+=("^sep(L:<small> Window label (Title)</small>)")
out2+=("^sep(I:<small> Iconify (Minimize)</small>)")
out2+=("^sep(M:<small> Maximize</small>)")
out2+=("^sep(C:<small> Close</small>)")
out2+=("^sep(S:<small> Shade (Roll up)</small>)")
out2+=("^sep(D:<small> Omnipresent (On all desktops)</small>)")
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")
#TEXT
out2+=("^tag(titletext)")
out2+=("^sep($TITLEBAR_TEXT)")
out2+=("$FONT...,mb-setfont obtitle;$me")
out2+=("$TEXTALIGN [ <b>$TXTJUST</b> ],^checkout(talign)")
out2+=("$SHADOW,^checkout(shadow)")
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)")
fonts=("Noto Sans" "DejaVu Serif" "Roboto Light" "Inconsolata" "Ubuntu" "Source Code Pro")
for i in "${fonts[@]}"
do
[[ "$FNAME" == "$i" ]] && out2+=("<big>綠</big> <span size=\"large\" font_family=\"${i}\">$i</span>,$me") || out2+=("<big>祿</big> <span size=\"large\" font_family=\"${i}\">$i</span>,obtctl fontfamily \"${i}\";$me")
done
out2+=("^sep()")
out2+=("<tt><span bgcolor='$AFG'> </span></tt> $ACTIVE_FG,^pipe(mbclr '$AFG' obtctl activetextcolor '${TEXT} ${ACTIVE_FG}' '$me')")
out2+=("<tt><span bgcolor='$NFG'> </span></tt> $INACTIVE_FG,^pipe(mbclr '$NFG' obtctl inactivetextcolor '${TEXT} ${INACTIVE_FG}' '$me')")
#TEXTALIGN
out2+=("^tag(talign)")
[[ "$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(size)")
sizes=(8 9 10 11 12 13 14 15 16)
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)")
out2+=(" $LEFT,obtctl textjustify left;$me")
out2+=(" $CENTER,obtctl textjustify center;$me")
out2+=(" $RIGHT,obtctl textjustify right;$me")
[[ "$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")
out2+=("^sep()")
out2+=("$SHADOW,^checkout(shadow)")
out2+=("^tag(shadow)")
out2+=("^sep($SHADOW)")
out2+=("$NOSHADOW,obtctl shadow 0;$me")

View File

@ -356,11 +356,23 @@ buttons () {
if [ "$SIZE" -lt "12" ]; then
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "12" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "12" "$cfg"
fi
;;
big-14)
nspace="http://openbox.org/3.4/rc"
cfg="$HOME/.config/openbox/rc.xml"
SIZE=$(xmlstarlet sel -N a="$nspace" -t -v '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' "$cfg")
if [ "$SIZE" -lt "14" ]; then
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="ActiveWindow"]/a:size' -v "14" "$cfg"
xmlstarlet ed -L -N a="$nspace" -u '/a:openbox_config/a:theme/a:font[@place="InactiveWindow"]/a:size' -v "14" "$cfg"
fi
;;
*) : ;;
esac
}
ndslimc() {
xmlstarlet ed -L -N o="http://openbox.org/3.4/rc" -u '/o:openbox_config/o:theme/o:titleLayout' -v "$1" "$HOME/.config/openbox/rc.xml"
}
activebuttonscolors () {
sd "^window.active.button.*.unpressed.image.color:.*$" "window.active.button.*.unpressed.image.color: ${1}" ${THEMERC}
# Calculate colors for other button states (mix of ${1} and clractivebg
@ -581,6 +593,7 @@ case "$1" in
activetextcolor) activetextcolor "$2";;
inactivetextcolor) inactivetextcolor "$2";;
buttons) buttons "$2";;
ndslimc) ndslimc "$2";;
activebuttonscolors) activebuttonscolors "$2";;
fontfamily) fontfamily "$2";;
fontweight) fontweight "$2";;

View File

@ -0,0 +1,6 @@
#define close_width 14
#define close_height 14
static unsigned char close_bits[] = {
0x00, 0x00, 0x0e, 0x1c, 0x1e, 0x1e, 0x3e, 0x1f, 0x7c, 0x0f, 0xf8, 0x06,
0xf0, 0x01, 0xe0, 0x03, 0xd8, 0x07, 0xbc, 0x0f, 0x3e, 0x1f, 0x1e, 0x1e,
0x0e, 0x1c, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define close_hover_width 14
#define close_hover_height 14
static unsigned char close_hover_bits[] = {
0x00, 0x00, 0x0e, 0x1c, 0x1e, 0x1e, 0x3e, 0x1f, 0x3c, 0x0f, 0x38, 0x07,
0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0x3c, 0x0f, 0x3e, 0x1f, 0x1e, 0x1e,
0x0e, 0x1c, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define close_pressed_width 14
#define close_pressed_height 14
static unsigned char close_pressed_bits[] = {
0x00, 0x00, 0x0e, 0x1c, 0x0e, 0x1c, 0x0e, 0x1c, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x1c, 0x0e, 0x1c,
0x0e, 0x1c, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_width 14
#define desk_height 14
static unsigned char desk_bits[] = {
0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x11, 0x3e, 0x11, 0x3e, 0x11, 0x3e, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x1f, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11,
0x3e, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_hover_width 14
#define desk_hover_height 14
static unsigned char desk_hover_bits[] = {
0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f,
0x3e, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_pressed_width 14
#define desk_pressed_height 14
static unsigned char desk_pressed_bits[] = {
0x00, 0x00, 0x06, 0x18, 0x1e, 0x1e, 0x1c, 0x0e, 0x1c, 0x0e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0e, 0x1c, 0x0e, 0x1e, 0x1e,
0x06, 0x18, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_toggled_width 14
#define desk_toggled_height 14
static unsigned char desk_toggled_bits[] = {
0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f, 0x3e, 0x1f,
0x3e, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_toggled_hover_width 14
#define desk_toggled_hover_height 14
static unsigned char desk_toggled_hover_bits[] = {
0x00, 0x00, 0x3e, 0x1f, 0x3e, 0x11, 0x3e, 0x11, 0x3e, 0x11, 0x3e, 0x1f,
0x00, 0x00, 0x00, 0x00, 0x3e, 0x1f, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11,
0x3e, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define desk_toggled_pressed_width 14
#define desk_toggled_pressed_height 14
static unsigned char desk_toggled_pressed_bits[] = {
0x00, 0x00, 0x06, 0x18, 0x1e, 0x1e, 0x1c, 0x0e, 0x1c, 0x0e, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0e, 0x1c, 0x0e, 0x1e, 0x1e,
0x06, 0x18, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define iconify_width 14
#define iconify_height 14
static unsigned char iconify_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x1f, 0xfe, 0x1f,
0xfe, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define iconify_hover_width 14
#define iconify_hover_height 14
static unsigned char iconify_hover_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x07,
0x00, 0x00, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define iconify_pressed_width 14
#define iconify_pressed_height 14
static unsigned char iconify_pressed_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x3f,
0xff, 0x3f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define max_width 14
#define max_height 14
static unsigned char max_bits[] = {
0x00, 0x00, 0xfe, 0x1f, 0xfe, 0x1f, 0xfe, 0x1f, 0x02, 0x10, 0x02, 0x10,
0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
0xfe, 0x1f, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define max_hover_width 14
#define max_hover_height 14
static unsigned char max_hover_bits[] = {
0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0xff, 0x3f, 0x03, 0x30, 0x03, 0x30,
0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30, 0x03, 0x30,
0xff, 0x3f, 0xff, 0x3f };

View File

@ -0,0 +1,6 @@
#define max_toggled_width 14
#define max_toggled_height 14
static unsigned char max_toggled_bits[] = {
0xe0, 0x3f, 0xe0, 0x3f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xff, 0x21,
0xff, 0x21, 0x01, 0x21, 0x01, 0x3f, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0xff, 0x01 };

View File

@ -0,0 +1,6 @@
#define max_toggled_hover_width 14
#define max_toggled_hover_height 14
static unsigned char max_toggled_hover_bits[] = {
0x00, 0x22, 0x00, 0x12, 0x00, 0x0a, 0x00, 0x06, 0x00, 0x3e, 0xff, 0x01,
0xff, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0xff, 0x01 };

View File

@ -0,0 +1,6 @@
#define shade_width 14
#define shade_height 14
static unsigned char shade_bits[] = {
0xc0, 0x00, 0xe0, 0x01, 0xf0, 0x03, 0xf8, 0x07, 0xfc, 0x0f, 0xfe, 0x1f,
0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0x00, 0x00, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define shade_hover_width 14
#define shade_hover_height 14
static unsigned char shade_hover_bits[] = {
0x00, 0x00, 0xfe, 0x1f, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define shade_pressed_width 14
#define shade_pressed_height 14
static unsigned char shade_pressed_bits[] = {
0x00, 0x00, 0xff, 0x3f, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };

View File

@ -0,0 +1,6 @@
#define shade_toggled_width 14
#define shade_toggled_height 14
static unsigned char shade_toggled_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00, 0xc0, 0x00,
0xc0, 0x00, 0xc0, 0x00, 0xfe, 0x1f, 0xfc, 0x0f, 0xf8, 0x07, 0xf0, 0x03,
0xe0, 0x01, 0xc0, 0x00 };

View File

@ -0,0 +1,6 @@
#define shade_toggled_hover_width 14
#define shade_toggled_hover_height 14
static unsigned char shade_toggled_hover_bits[] = {
0x00, 0x00, 0xfe, 0x1f, 0xfe, 0x1f, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10,
0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0x02, 0x10, 0xfe, 0x1f, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 };