2

I have a computer at home that I log into remotely. The "monitor" for it is a TV, so I want gtk applications to use a large font and icon theme, which I managed to do by editing the ~/.gtkrc-2.0 file and some other similar stuff. What I want to be able to do is have a separate theme for when I'm logging in remotely. The best way to explain is that I would like my gtk theme choice to be dependent on the X display that the application is started on. For example, if I start something on :0.0 then that is the TV and I want large fonts, but if I start it on localhost:10.0 I want to use a regular size font, because it will get rendered on my laptop screen.

The elegant solution would be to have some sort of IF statement in the .gtkrc-2.0 file that checks the $DISPLAY variable and behaves accordingly. The problem is I can't find any documentation on control structures in .gktrc files, or if it's even possible to do that.

[Edit] Additionally, is there any way to do this in GTK+ 3 without having to install gnome?

2 Answers 2

1

You can achieve this by running an XSETTINGS daemon, e.g. xsettingsd (or Xfce xfsettingsd or GNOME gsd-xsettings) locally on both machines. It will affect all clients of the X display it's running on, overriding gtkrc.

If the program uses GTK+ 2, you can point $GTK2_RC_FILES to a colon-separated list of alternative gtkrc's. (There is no direct alternative for GTK+ 3 settings.ini; it uses Xsettings as the primary mechanism.)

Note: This method will likely stop working in GTK 4, which prefers reading internal GSettings.

4
  • I am pretty sure gnome-settings-daemon requires installing gnome, which is something I'm trying to avoid, as I want to keep a somewhat minimalistic setup. A google search for Xsettings daemon returns gnome-settings-daemon and basically nothing else. Is there a way to have this work for both GTK+ 2/3 without having to install the fullness of gnome?
    – vlsd
    Nov 22, 2011 at 19:42
  • I am pretty sure it doesn't. I've used it with wmii myself. Nov 22, 2011 at 19:50
  • OK, I'll give it a try, I was probably reading the dependency list wrong.
    – vlsd
    Nov 22, 2011 at 19:52
  • Update: In recent GNOME versions, it might be more difficult to run g-s-d (now split off to gsd-xsettingsd`) without the rest of GNOME, however there are new alternatives available. Nov 3, 2019 at 18:31
0

AFAIK it is not possible to make do any scripting for gtkrc. You can copy both configurations to somewhere where you can restore them from .xinitrc, .xsession or other X startup file. The only problem is that you can't use both :0.0 and :10.0 running in parallel with different themes. You should either run only one X at time or make different user with different home directory for your TV setup for instance. You can even use the same UID/GID for both users and will have access to all files.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .