Page 1 of 1

How to color the gtk window?

Posted: Thu Dec 10, 2020 3:26 am
by arivas_2005

I want to color the whole window ..
especially .. background color to list
with the code that I have ..

Code: Select all

#!/bin/bash

export LISTADO="UNO
DOS
TRES
CUATRO
CINCO
"

   echo 'style "blackbg" {
    font_name="DejaVu Sans 8"
     bg[NORMAL]    = "cyan"
     fg[NORMAL]  = "green"
     base[NORMAL]   = "blue"
     bg[ACTIVE] ="red"
	fg[ACTIVE]="cyan"
	fg[INSENSITIVE]	= "magenta"
	fg[PRELIGHT]	= "black" 
	text[ACTIVE]	="red"
	text[PRELIGHT]	= "gold"
	text[SELECTED]	= "brown"
	fg[PRELIGHT]	= "black"
     }
 class "*" style "blackbg"    
widget "*arboles" style "blackbg
   
   '   > /tmp/gtkrc
   export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0

export auto='
<window>
   <vbox>
		<text name="texto"><label>elige</label></text>
       <tree name="arboles" rules-hint="true" headers-visible="false" activates-default="true" hover-selection="true"  file-monitor="true"  reorderable="true">
		<label>LISTAOPCIONES</label>
		<variable>SELECCIONA</variable> 
		<input>echo -e "$LISTADO"</input>
      </tree>      
   </vbox>
</window>'

gtkdialog -p auto -G 110x200+20+20

the list is not colored
and
I want to put blue background and bold yellow letter (to list UNO DOS TRES CUATRO CINCO)
Thanks!


Re: How to color the gtk window?

Posted: Fri Dec 11, 2020 6:39 pm
by Eastler_Dart

copied your script, saved it, execute it,
got Error:
/tmp/gtkrc:19: error: scanner: unterminated string constant

open /tmp/gtkrc in editor, look about line 19 =
widget "*arboles" style "blackbg
there is a " missing at the end

try it, maybe it works


Re: How to color the gtk window?

Posted: Sat Dec 12, 2020 1:24 am
by arivas_2005

Thank you
I already made the correction.
After several experiments, I found that it depends on the chosen gtk-theme. This is because after I changed the theme "Fusion" to another, the coloring of the tree frame already appeared.
So the coloring of the windows .. also depends on the gtk- puppy theme


Re: How to color the gtk window?

Posted: Sat Dec 12, 2020 5:45 am
by Eastler_Dart

yes, I think it's because you said it to puppy :-))

export GTK2_RC_FILES=/tmp/gtkrc:/root/.gtkrc-2.0
==> first theme with /tmp/gtkrc then : theme with root/.gtkrc-2.0

try to swap the both themefilenames ;

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

hope it helps