For example, can I keep Ambiance as main theme but assign elementary theme to elementary's app?
You can use the GTK environment variable
GTK_THEME=elementary to launch an app with the elementary theme. For example, running
GTK_THEME=elementary pantheon-files will launch the elementary Files app using the elementary GTK theme.
To get this to apply every time you launch a specific app, your best option is likely to create a custom .desktop file (launcher).
Create a custom .desktop file
- Open your file browser
- Navigate to
- Copy the launcher (highlight and Ctrl+C) for the app you want to launch with the elementary theme
- Navigate to
~/.local/share/applications/and paste the launcher (Ctrl+V)
- Right-click and open the launcher with a text editor
- Modify the line starting with
Exec=env GTK_THEME=elementaryand then the previous existing contents of the line. (So
Exec=env GTK_THEME=elementary pantheon-files)
- Save and close the file
The next time you launch the app from Unity (or your app launcher of choice) it will use the elementary theme.
Bonus: make it work when using command line
You may also want the app to launch with the elementary theme when launching it from the command line. To do so:
- Open your Terminal app
alias pantheon-files="GTK_THEME=elementary pantheon-files"(replacing
pantheon-fileswith the desired app)
- Press Enter
- This will not change your window manager's theme to the elementary theme.
- This (by design) will only apply to your account, not root or anyone else on the machine.
- The theme names are cAsE-sEnsItiVe and should be matched with the theme folder name.
- I'm an elementary contributor ;)
- GTK+ 3 Reference Manual: Running GTK+ Applications
- Set variable in .desktop file
The question is still valid and I found a way:
- create any folder
- create a
/share/themes/folder inside it (that is
- put any GTK3 theme inside the latter
rename the theme 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:
(The path after
GTK_DATA_PREFIX= has to be that (and only that) to the folder that contains
/share/themes/RENAMED_THEME. That's why it's NOT
path/to/MY_FOLDER/share/themes/RENAMED_THEME, but just
To have that inside a launcher, replace accordingly:
Exec=sh -c 'GTK_DATA_PREFIX=path/to/MY_FOLDER YOUR_APPLICATION'
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 app-specific 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 heavy 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.
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:
This on 12.04 for inkscape (which is still Gnome2 btw) produces this:
See more information about Gtk2 theme running here.
Yes you can, actually I googled and got some answers:
- 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 oofficein the terminal.
- Look for the bin folder where all applications put their binary executables. Type
echo $PATHin the terminal and you will ge the path. I recommend you to create a bin folder in your home directory by typing
gedit ~/.bashrcto open your bash rc file.
- Go to the bottom of this file and add this line
Now we will create a script which will execute your program with custom theme:
- Create application's script file by typing:
Type these lines in the opened file:
#!/bin/bash env GTK2_RC_FILES=/usr/share/themes/SlicknessX/gtk-2.0/gtkrc /usr/bin/ooffice "$@"
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 "$@"