1

I'm doing some slight modification of an existing theme, and I want to have the sliders be different colors in active and inactive windows. Here is an example of the slider code in the gtkrc file

image {
  function          = SLIDER
  recolorable       = TRUE
  state             = NORMAL
  file              = "slider.png"
  border            = { 2, 2, 2, 2 }
  stretch           = TRUE
  orientation       = VERTICAL
}

The option "state" seems to have only 3 choices: NORMAL, PRELIGHT, and INSENSITIVE There doesn't seem to be an "INACTIVE" which is what I need. I want to set the image file for sliders on an inactive window to something different.

1

The inactive state is the NORMAL state. From the Python gtk docs

A gtk.Style holds information for the five possible widget states though not every widget supports all five states:

gtk.STATE_NORMAL The state of a sensitive widget that is not active and does not have the focus

gtk.STATE_ACTIVE The state of a sensitive widget when it is active e.g. a button that is pressed but not yet released

gtk.STATE_PRELIGHT The state of a sensitive widget that has the focus e.g. a button that has the mouse pointer over it.

gtk.STATE_SELECTED The state of a widget that is selected e.g. selected text in a gtk.Entry widget

gtk.STATE_INSENSITIVE The state of a widget that is insensitive and will not respond to any events e.g. cannot be activated, selected or prelit.

I've done some GTK2 programming in Python over the last few years, but I'm certainly not an expert in all of its intricacies. And I haven't played around much with themes. I'm not sure if what you want to do can be done, but hopefully someone with more expertise will be able to make a definitive statement in this regard.

FWIW, I do know how to make a slider in an GTK application change color depending on whether the main window currently has focus or not, but I guess that's not much use to you. But if you want to play around with it, let me know & I'll paste my Python code into this answer.

  • Thanks this is very helpful. I think I'll just try to make the theme work with a constant slider color – stss Nov 26 '14 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.