Kasperian Moving Parts

kinda like Batman, but with a wife and 3 kids

Gtk+ theme changes not… changing… in SuSE

This one threw me for a loop.

I found a nice new program to change Gtk+ themes. It seems cleaner, nicer, and more finished-er than muhri’s gtk-theme-switch programs. And it does previews nicely, etc., and the only thing that it didn’t seem to do well was actually activate the theme that I wanted to use–which was, after all, the entire point of using said program.

What I found was that SuSE has done something to change gtk programs and where said gtk programs actually look for for their style configuration settings is in $HOME/.kde/share/config/gtkrc and $HOME/.kde/share/config/gtkrc-2.0. So, when I used the gtk theme switcher program, gtk programs didn’t notice the change since I was changing the standard $HOME/.gtkrc* files.

Ah hah, I thought to myself–I can be smarter than that! So I created soft links (ln -s) to these files from $HOME/.gtkrc*. And it worked! Once. The very first time I made a change after I created the soft link, the change was recognized. But nothing after that. So I used hard links instead (ln) and all seems to be working correctly now.

ln $HOME/.gtkrc $HOME/.kde/share/config/gtkrc
ln $HOME/.gtkrc-2.0 $HOME/.kde/share/config/gtkrc-2.0

Hope this helps somebody else who is trying to change Gtk+ themes in SuSE or OpenSuSE and doesn’t run a GNOME environment….

7 Replies to “Gtk+ theme changes not… changing… in SuSE”

  • Hi Aristotle! I am thrilled to hear from you! =:)

    Hey–VERY nice job on the Change Theme program! It is worlds better than Muhri’s! (not to mention completed =:) )

    On the dotfile…. Hm. I don’t think it’s entirely your program’s problem. What I mean about that is that even if your program changed/created those files, something in OpenSuSE’s distribution is causing them to be removed when startkde runs again. Well, I guess if you were able to detect that they should be created, it would be an improvement, since that would take half of the pain out. As well as–I’m not sure why OpenSuSE’s gtk even looks in ~/.kde/share/config/gtkrc*!! Yeah, actually, now that I think of it, if Change Theme would be able to create those files, that would be great!! =:) I’ve already opened a bug with OpenSuSE (https://bugzilla.novell.com/show_bug.cgi?id=114770) about their part of the problem. =:)

    Thanks for the reply, Aristotle! And for the really nice program!! =:)

  • Thanks for the praise, I’m thrilled myself to hear of people loving it. πŸ™‚ I wrote it in the first place because I was so frustrated with the hugely annoying theme-switch — particularly how it would blithely assume that everything in /usr/share/themes was a gtk+ theme, so the already cumbersome to operate list would be cluttered with duds. I’m glad to see others like this thing as well. πŸ™‚

    Okay, I understand the problem better after reading the bug you filed. I’m not so sure my “fix” would work now, or how to approach the issue, if I can. So I’d like to ask you to compile this (unfortunately, there’s no indication of what kind of comment formatting is allowed/expected and there’s no preview button either, so I’ll just hope for the best):

    #include
    int main()
    {
    gchar ** rc = gtk_rc_get_default_files();
    for(;*rc;++rc) g_print(“%s\n”,*rc);
    return 0;
    }

    Save it as, say, “rc.c”, and compile it like so:

    gcc -pedantic-errors -Wall `pkg-config –cflags –libs gtk+-2.0` rc.c -o rc

    Could you let me know what running “./rc” prints?

  • Okay, that didn’t work, because HTML seems to be allowed, so let’s try this again:

    #include <gtk/gtk.h>
    int main()
    {
    gchar ** rc = gtk_rc_get_default_files();
    for(;*rc;++rc) g_print("%s\n",*rc);
    return 0;
    }

  • Ahh, okay, I found something on the ‘net. If I set this:

    export GTK2_RC_FILES=$HOME/.gtkrc-2.0

    before I start a gtk+ application, then it does watch the specified file for changes and Gtk+ Change Theme does, in fact, work perfectly as expected (or rather, the launched gtk+ application works as expected). I’ll update the bug, but I’m leaving it open because this is just plain weird.

  • Okay, so the dotfile would still end up in the same place with my “fix,” so it’s something only Suse can correct.

    Oh well. Case closed for me I suppose… good luck with the bug you filed. πŸ™‚

    And thanks for the kind words. πŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.