GTK2 - color,font,icon
Gtkdialog (and gtk2dialog) if it is compiled for GTK2 can change some features like
background color
font
size of stock gtk icons
I wrote a script to test
Code: Select all
#!/bin/bash
for P in gtk2dialog gtkdialog; do
GTKDIALOG=$(which $P) && break
done
export WORKDIR=$HOME/.testscript/tmp
if [ ! -d $WORKDIR ]; then
mkdir -p $WORKDIR
fi
funcgtkrcCreate() {
echo '
style "styleBgYellow" {
bg[NORMAL] = "#AAFFED"
}
widget "*BgYellow" style "styleBgYellow"
style "font"
{
font_name = "Mono 12"
}
widget_class "*" style "font"
gtk-font-name = "Mono 12"
' > "$WORKDIR"/gtkrc
export GTK2_RC_FILES=$WORKDIR/gtkrc:/root/.gtkrc-2.0 #include theme stuff with system themes
}
funcgtkrcCreate
#gtk-theme
echo 'gtk-icon-sizes="gtk-button=72,72"
' >> $WORKDIR/gtkrc
export GTK2_RC_FILES=$WORKDIR/gtkrc:/root/.gtkrc-2.0 #include theme stuff with system themes
DISTRO="$(grep DISTRO_NAME /etc/DISTRO_SPECS)"
VERSION=1.0
LENGTH=60
$GTKDIALOG -v > /tmp/GTK
export TEST='
<window title="'Test' '"$VERSION"'" width-request="600" name="BgYellow">
<vbox>
<frame>
<text>
<label>'"$DISTRO"'</label>
</text>
<text>
<input file>'/tmp/GTK'</input>
</text>
</frame>
<hbox homogeneous="true">
<hbox>
<hbox><frame Length>
<comboboxentry width-request="80">
<variable>LENGTH</variable>
<default>'$LENGTH'</default>
<item>30</item>
<item>60</item>
<item>90</item>
<item>120</item>
<item>180</item>
<item>240</item>
</comboboxentry>
</frame>
</hbox>
<frame Source Device>
<hbox>
<comboboxentry activates_default="true">
<default>default</default>
<item>hw:0</item>
<item>hw:1</item>
<variable>DEV</variable>
</comboboxentry>
</hbox></frame>
<frame Quit>
<hbox>
<button relief="2">
<input file stock="gtk-quit"></input>
<label>Stop</label>
<action>exit:EXIT</action>
</button>
</hbox></frame>
</hbox>
</hbox>
</vbox>
</window>
'
$GTKDIALOG -p TEST -c
exit 0
Run script in any recent puppy (including fatdog64 and bookwormpup)
Here is ouput
Notice that the Quit icon (a stock gtk icon)
is unusually big. This makes it blur because it is a bitmap
A more reasonable size would be 32
Code: Select all
echo 'gtk-icon-sizes="gtk-button=32,32"
_________________________________________________________________
The gtk theme is called BgYellow. Don't forget to add this to the window directive
<window title="'Test' '"$VERSION"'" width-request="600" name="BgYellow">
________________________________________
Experiment - change the color by changing the hex number #AAFFED
______________________________________________
Change the font from Mono to Dejavu
and there is a noticeable change
__________________________________________
Code: Select all
for P in gtk2dialog gtkdialog; do
GTKDIALOG=$(which $P) && break
done
This allows the script to work properly in Bookwormpup
_____________________________________________