Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way to set gtk-application-prefer-dark-theme for an application?

This is normally set in the code by the application. Apps such as Eye of Gnome and Totem turn it on. I want to, as a user turn it on, on a per application bases.

For gnome-terminal, I normally use a white text on black background color scheme, and having the dark window border would improve the overall look.

I also want to turn it on for vlc.

share|improve this question
add comment

2 Answers

Here is a bash script I have used to launch a application with a different theme. Haven't used it in years though, so I don't know if it will work with the current GTK.

#!/bin/bash
# lauch a gtk application with a different theme
# set GTKRCFILE variable to your favourite theme
GTKRCFILE=Clearlooks
GTK2_RC_FILES=/usr/share/themes/"$GTKRCFILE"/gtk-2.0/gtkrc "$@"

Here is a bit of info I got off the ubuntu fourms archives. Not sure if it will be a problem. (here) There is also a blog post detailing this method a little more. (here) and (here). There is also a similar question on this site that has already been answered. (here)

Under gnome, apps get their theme from the gnome-settings-daemon. This instantaneously applies any theme change to all active applications, making per-appplication theme changing impossible.

share|improve this answer
1  
Typo or mistake? ('gnome-settings-demon")... The word is daemon (not demon).. It has a very different root meaning: …(in ancient Greek belief) Daemons are good or benevolent supernatural beings between mortals and gods ... daemon=good / demon=bad ... en.wikipedia.org/wiki/Daemon_%28classical_mythology%29 .. (pronounced day-mon) –  Peter.O Jun 10 '11 at 8:03
    
Typo, that's what happens when you don't spell check everything :| –  giodamelio Jun 10 '11 at 9:27
add comment

For GTK+-3 applications, you can enforce the dark theme variant using GtkSettings' settings.ini:

$ mkdir -p $HOME/.config/gnome-terminal/gtk-3.0 # the path before gtk-3.0 is arbitrary
$ cat >> $HOME/.config/gnome-terminal/gtk-3.0/settings.ini << EOF
[Settings]
gtk-application-prefer-dark-theme=true
EOF
$ echo 'alias gnome-terminal="XDG_CONFIG_HOME=$HOME/.config/gnome-terminal gnome-terminal" >> $HOME/.bashrc

For non-GTK+ applications like vnc, you can still enforce dark window decorations by setting the _GTK_THEME_VARIANT X property of type UTF8_STRING to dark - I don't know if any tools like devilspie support that functionality though (xprop can be used to set properties, but it does not support UTF8_STRING).

share|improve this answer
    
Sorry for taking so long to try this. I tried it, but I get this error message: Gtk-WARNING **: Unknown key gtk-application-prefer-dark-theme-variant in /home/garyvdm/.config/gnome-terminal/gtk-3.0/settings.ini –  Gary van der Merwe Jan 18 '12 at 8:11
    
The correct setting name is gtk-application-prefer-dark-theme without the -variant at the end. I've edited the answer appropriately. –  Jan Larres Apr 11 '13 at 5:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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