Page 1 of 1

Gtkdialog: tooltip background: how to fill the whole bg?

Posted: Sun 09 Feb 2014, 12:32
by Bert
Hi all,

With a longer tooltip, I get these grey ends of line.

Here I exaggerated the amount of text a bit for the screenshot:

Image

Code: Select all

<button tooltip-markup="<span fgcolor='"'blue'"' bgcolor='"'lightyellow'"'> '$(gettext 'Lorem ipsum 
Is there a trick to make the tooltip background 100% "light-yellow"?

Thanks in advance!

Posted: Sun 09 Feb 2014, 14:12
by zigbert
I don't know the exact code, but you can sure set tooltip colors in an extra gtktheme.
The following example shows to do it (for monospace text).

Code: Select all

#!/bin/bash
echo 'style "specialmono"
{
  font_name="Mono 12"
}
widget "*mono" style "specialmono"
class "GtkText*" style "specialmono"' > /tmp/gtkrc_mono

export GTK2_RC_FILES=/tmp/gtkrc_mono:/root/.gtkrc-2.0

export test_app="
<vbox>
  <text name=\"mono\"><label>This text-widget uses monospace font....</label></text>
  <text><label>...while this text-widget don't.</label></text>
  <edit><default>All edit-widgets gets monospace.</default></edit>
</vbox>"
gtkdialog --program=test_app

Posted: Mon 10 Feb 2014, 22:43
by Bert
Thank you Zigbert,

I've been trying your idea, but didn't get results.

There was already a global "special" gtktheme in the dialog (as you can see from the fonts in the screenshot above).

At first I tried to integrate the tooltip stuff in that gtktheme. Didn't work. Then I added a new theme, following your example:

Code: Select all

#setting tooltip style...
echo 'style "specialtooltip" 
{ 
  font_name="Sans 10" 
  font_style="bold"
  fg[NORMAL]="blue"
  bg[NORMAL]="lightyellow"
} 
widget "*specialtooltip" style "specialtooltip" 
class "GtkTooltip*" style "specialtooltip"' > /tmp/gtkrc_specialtooltip
Tried another example (from SFR I think):

Code: Select all

#setting tooltip style..
FONT_NAME="Sans"
FONT_SIZE="10"
FONT_STYLE="bold"
echo 'style "custom1"
{
font_name="'$FONT_NAME' '$FONT_STYLE' '$FONT_SIZE'"
fg[NORMAL]="blue"
bg[NORMAL]="lightyellow"
}
widget "*GtkTooltip*" style "custom1" ' > /tmp/gtkrc_custom1
export GTK2_RC_FILES="${HOME}/.gtkrc-2.0:/tmp/gtkrc_custom1"
Again no luck.
I'm sure you are right and that it is possible, but I have to give up.
It is also not that important :wink:
It taught me to keep tooltips sweet and short...

Thanks again,
Bert

Posted: Tue 11 Feb 2014, 20:38
by zigbert
Be aware that some gtk-themes are hard to override. Try the Flat-grey or Stardust, as these has never given trouble for me.

Posted: Tue 11 Feb 2014, 21:40
by SFR
Did some trials and replacing "*GtkTooltip*" with just "*tooltip*" gave me control over tooltip's style.

Greetings!

Posted: Sat 15 Feb 2014, 12:20
by Bert
Thanks SFR! Working now ;)

Code: Select all

#setting tooltip style..
FONT_NAME="Sans"
FONT_SIZE="10"
FONT_STYLE="bold"
echo 'style "customtooltip"
{
font_name="'$FONT_NAME' '$FONT_STYLE' '$FONT_SIZE'"
fg[NORMAL]="blue"
bg[NORMAL]="lightyellow"
}
widget "*tooltip*" style "customtooltip" ' > /tmp/gtkrc_customtooltip
export GTK2_RC_FILES="${HOME}/.gtkrc-2.0:/tmp/gtkrc_customtooltip"

export DIALOG='

<frame>
	      <edit text-name="tooltip" tooltip-text=" "
:-)