TIP Change Appearance of GTK Applications
From Gentoo Linux Wiki
| Terminals / Shells • Network • X Window System • Portage • System • Filesystems • Kernel • Other |
[edit] Introduction
The GIMP Toolkit (abbreviated GTK+) is a popular widget toolkit for the X Windows System for creating graphical user interfaces. GTK+ makes use of themes, which effects the appearances of different widgets and key bindings in applications which use GTK+. System wide GTK+ themes that anyone on the machine can use are located in /usr/share/themes. Each user can also have additional GTK+ themes which are located in ~/.themes.
[edit] How to Change GTK+ Themes without GNOME
The easiest method is to emerge gtk-chtheme or emerge gtk-theme-switch. After one of these programs are installed you can run them with gtk-chtheme and switch2 respectively and pick the theme you want to use and apply the change.
[edit] By Hand Alternative
Alternatively you can change which GTK+ theme to use by hand. Open ~/.gtkrc-2.0 in a text editor and change the paths of the theme files to include.
| File: example ~/.gtkrc-2.0 |
include "/usr/share/themes/Industrial/gtk-2.0/gtkrc" |
To make finding installed themes easier you can copy and paste the gtkthemes script into some text editor.
- Save in /usr/local/bin as gtkthemes
- Next make gtkthemes executable by typing chmod +x /usr/local/bin/gtkthemes
- Finally run gtkthemes to see what themes you can use.
| File: /usr/local/bin/gtkthemes |
#!/bin/bash
THEMEDIR="/usr/share/themes"
if [[ $# -lt 1 ]]; then
GLB="`find $THEMEDIR -regex '.+?/gtk\(-[0-9.]+\)?/gtkrc' -printf '%P ' | sed 's,\([^/]\+\)/\S*,\1,g'`"
USR="`find ~/.themes -regex '.+?/gtk\(-[0-9.]+\)?/gtkrc' -printf '%P ' | sed 's,\([^/]\+\)/\S*,\1,g'`"
if [[ -z $GLB && -z $USR ]]; then
echo "No GTK+ themes are installed on this machine."
exit 1
else
if [[ -n $GLB ]]; then echo -e "GTK+ Themes anyone can use:\n" $GLB; fi
if [[ -n $GLB && -n $USR ]]; then echo " "; fi
if [[ -n $USR ]]; then echo -e "GTK+ Themes $USER can use:\n" $USR; fi
exit 0
fi
else
GTKFILES=""
if [[ -d "~/.themes/$1" ]]; then GTKFILES="`find ~/.themes/$1 -name 'gtkrc'`"; fi
if [[ -d "$THEMEDIR/$1" ]]; then GTKFILES="`find $THEMEDIR/$1 -name 'gtkrc'`"; fi
if [[ -n $GTKFILES ]]; then
echo "Put these paths into your .gtkrc-2.0 file:"
echo $GTKFILES
else
echo "No GTK theme named '$1'"
fi
fi
|
