Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

For example, can I keep Ambiance as main theme but assign elementary theme to elementary's app?

share|improve this question
3  
Current answers ara about Gtk2, I am asking about Gtk3. –  neonboy Jun 1 '12 at 17:02
    
I edited the question to better reflect what you seek. Sorry, but the short answer from my research is no, you cannot without having to spend some effort creating a new "hybrid" theme as @Kush explained :( It's not as simple as GTK2 any more. –  izx Jun 6 '12 at 6:42
add comment

4 Answers

Yes, the simple way is to point the application at the required path where your rc file lives, in the command that runs your application:

GTK2_RC_FILES=/usr/share/themes/Redmond/gtk-2.0/gtkrc inkscape

This on 12.04 for inkscape (which is still Gnome2 btw) produces this:

inkscape window with windows theme

See more information about Gtk2 theme running here.

share|improve this answer
4  
Question is about Gtk3 not Gtk2, thanks. –  neonboy Jun 1 '12 at 18:38
    
You didn't specify that in your original question. Please no antagonise the questioneers. –  Martin Owens -doctormo- Jun 3 '12 at 6:38
4  
Originally it was "Can I use different GTK3 themes for individual apps?" wich still had Gtk3 subject in the question, then foss freedom ask me to comment on non valid answers and edit the question if it was necessary, I'm not antagonise anyone. –  neonboy Jun 3 '12 at 12:57
add comment

Yes you can, actually I googled and got some answers:

  1. Look for the exact executable for the program you want to change the theme. for example, if you want it for ooffice then type which ooffice in the terminal.
  2. Look for the bin folder where all applications put their binary executables. Type echo $PATH in the terminal and you will ge the path. I recommend you to create a bin folder in your home directory by typing mkdir ~/bin
  3. Type gedit ~/.bashrc to open your bash rc file.
  4. Go to the bottom of this file and add this line export PATH=~/bin:${PATH}

No we will create a script which will execute your program with custom theme:

  1. Create application's script file by typing: gedit ~/bin/ooffice
  2. Type these lines in the opened file:

    1. #!/bin/bash
    2. env GTK2_RC_FILES=/usr/share/themes/SlicknessX/gtk-2.0/gtkrc /usr/bin/ooffice "$@"
  3. Change the mode of the file to executable by typing: chmod +x ~/bin/ooffice.

Hope this helps, you have to remember only one thing, the format of the script as shown below:

#!/bin/bash
env GTK2_RC_FILES=PATH_TO_GTKRC PATH_TO_EXECUTABLE "$@"
share|improve this answer
    
It is certainly possible for GTK2 apps using GTK2_RC_FILES env. variable. Also, what themes are you talking about compiling? The question is about systemwide GTK themes available in Ubuntu. –  izx May 27 '12 at 9:45
1  
I believe the method you mentioned targets Gtk2.0 while Ubuntu 12.04 uses Gtk3.0 for themes, so if might not work. –  Kush May 27 '12 at 10:11
4  
I'm sorry, that's a solution for Gtk2, question is about Gtk3. –  neonboy Jun 1 '12 at 18:33
add comment

Its certainly possible, I don't have much of themeing experience, but when you navigate to /usr/share/themes/*Theme Name*/gtk-3.0/apps/ directory, you'll find .css files, named with apps they target, to theme, so yes you can create the Themes.

Note that the way you mentioned to theme your apps may require some work to be done (like having both Ambiance and Elementary work simultaneously, since every theme has a base file on top of which app specific styling is done, (a file gtkrc in Gtk 2.0 while, a file gtk.css in case of Gtk3.0).

And this base theme file contains styling rules that specifically target the given theme, hence you cannot create Elementary like look and feel from Ambiance's base theme file without making some have changes, and even if you do, you'll loose Ambiance look itself.

Also, in GNOME, it is possible to have only single theme applied at a time, For Example, if you have used Appearance window in Ubuntu 12.04, you know can can select any single theme from the dropdown, in case you have used gnome-tweak-tool, than you can set different themes, for Gtk, Window frames, and icons, but still, it doesn't allow to target specific applications to theme, so as I said earlier, you can set totally different themes for different applications if you cleverly work with base theme file, as of now, no third party applications can do it by itself.

One way you can do it by yourself is that, let the base theme file (gtk.css) have only essential rules which are neutral to any theme, being dark or light. And have the actual theme design written in app-specific files that reside in above mentioned directory, i.e. for styling Nautilus, you can write all required properties in nautilus.css file. Same with every app you wish to target. Obviously, doing such requires some decent Gtk themeing experience.

You may refer this for creating your own theme using template, Also there's a decent documentation on Gtk+ themeing.

share|improve this answer
3  
I don't want to create a new theme, I want to assign an existing one. –  neonboy Jun 1 '12 at 18:38
    
@neonboy: As I said that with GTK3, its not that simple, a theme is distributed across multiple files, and if dependencies are not satisfied, broken theme is all you'll get. That's why I posted the answer that shows possible solution with GTK3, and not GTK2 (in which doing this is fairly easier). –  Kush Jun 2 '12 at 3:09
add comment

The question is still valid and I found a way: any folder <FOLDER> could be chosen and then a /share/themes/ folder should be created inside it. Afterward any GTK3 theme could be put inside the latter and renamed to the name of the CURRENTLY ACTIVE THEME. At last, this command will make an app use the renamed theme instead of the currently active one:

GTK_DATA_PREFIX=<FOLDER> app

share|improve this answer
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.