Using different Gtk settings in different sessions

May 21, 2008

As is probably clear to the reader of this blog, I mainly use two window managers: Pekwm and Openbox. Both look very differently on this computer, though. My Openbox session is dark blue and purple; my Pekwm session, on the other hand, looks orange and black.

Up until very recently, the first thing I often had to do after I logged into either sessions, was to edit the .gtkrc-2.0 file and (re)set the appropriate Gtk theme settings. I have suggested elsewhere to use both the xfce-mcs-manager and the gnome-settings-daemon to avoid clashing themes between sessions, but I prefer not to load these daemons.

Here is my current solution. First, I created two new gtkrc files that contain the Gtk settings I use in Openbox and Pekwm: ~/.gtkrc-2.0.Openbox and ~/.gtkrc-2.0.Pekwm. I then added the following line to my (auto)start file to overwrite the default ~/.gtkrc-2.0 file with the gtkrc file for Pekmw/Openbox:

For Openbox:

cp /home/USERNAME/.gtkrc-2.0.Openbox /home/USERNAME/.gtkrc-2.0 &

For Pekwm:

cp /home/USERNAME/.gtkrc-2.0.Pekwm /home/USERNAME/.gtkrc-2.0 &

And voilà! No more Gtk settings that conflict with the Pekwm/Openbox theme or wallpaper. This solution is probably very obvious to many, but perhaps some of you will find it helpful. This will, of course, also work if you use Openbox and a destkop environment (as separate sessions); just uncomment everything your custom Gnome/Xfce gtkrc file (as above), so that its daemon can set the themes properly.

6 Responses to “Using different Gtk settings in different sessions”

  1. […] насколько она проблема, но вот суть. Оригинал поста здесь (англ.). Переводить полностью не буду, только суть. Если […]

  2. Leon said

    I suggest you to make the vice-versa operation either.
    I mean:
    cp /home/xxx/.config/openbox/gtk-rc.Openbox ~/.gtkrc-2.0&
    exec openbox-session &&
    cp /home/xxx/.gtkrc-2.0 /home/xxx/.config/openbox/gtk-rc.Openbox

    i didn’t try, but this way you could use gtk-chtheme without telling it which file you want to edit.

  3. urukrama said

    I’m not sure I get what you mean.

    When I overwrite the ~/.gtkrc-2.0 file with the command I mentioned above, I can still use Gtk-chtheme, LXappearance or any of such apps. I don’t need to tell it which file to use, as I’ve only made sure that the ~/.gtkrc-2.0 file contains the proper theme settings for the session.

    I also don’t need to copy the ~/.gtkrc-2.0 file back; there is no need to create a backup of that file, or make it overwrite the Openbox/Pekwm gtkrc file.

  4. Leon said

    Yes, but think about this:

    You have a config in Openbox, and another one in Pek.

    You overwrite de gtkrc “central”, and use the config of Openbox.

    You want to CHANGE the appereance of the Openbox gtk, but NOT the Pekwm config.

    So, if every time you start openbox, the “central” gtkrc file is overwritten, you won’t be able to save the Openbox gtkrc file preferences, because it’s been changed in the central, but not exported to the openbox gtkrc file.

  5. davidrobertlewis said

    I know its like two years old posting, but wondering if this ever got resolved. Surely must be a better method than overwriting the central file.

  6. […] I found in Urukrama's Weblog an article about using different Gtk settings in different sessions: https://urukrama.wordpress.com/2008/0…rent-sessions/ – This is an example with Openbox and Pekwm. I'll try it with openbox and fluxbox. Maybe this is […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s