7

I use a Metacity theme in my Ubuntu installation. Unfortunately, it isn't activated for programs with GUI that are started as root user and some other other certain programs like gufw. When I start gufw by command-line not as root, it uses an old, not very attractive theme.

For example, gufw gives the following output from the command-line:

/usr/share/themes/Finery/gtk-2.0/gtkrc:365: error: unexpected number `0', expected number (float)
/usr/share/themes/Finery/gtk-2.0/gtkrc:365: error: unexpected number `0', expected number (float)

What could be the reason for this issue? Is there a way to enable this theme for these other programs?

Kevin Bowen
  • 20,125
  • 57
  • 82
  • 84
NES
  • 33,975

4 Answers4

12

Themes you install via GNOME Appearance Settings reside in ~/.themes - your own home directory, where root won't be looking for them. You'll notice that themes that are installed system-wide (like ambiance/radiance) work fine, since those live in /usr/share/themes

To fix the issue, open your terminal and type

sudo ln -s ~/.themes /root/.themes

That way, root and your normal user will share the theme directory and everything will look the same.

Emma Heinle
  • 2,217
  • does this covers also the theme customizations that you can change with GTK-Chtheme? – NES Dec 29 '10 at 21:34
  • @NES: Probably not, since the customizations are stored in gconf2 settings database, and that is per-user storage. But at least all themes installed by user would be avaliable to root as well. And root can customize them (just open Appearance as root) – MestreLion Jun 27 '11 at 13:57
  • If you use a custom interface font, you can do the same with the .local/share/fonts directory in order to get the same fonts too – DifferentPseudonym Apr 13 '19 at 17:00
2

Found a solution.

  1. Open HOME folder
  2. Show hidden files
  3. Make a link for the .theme folder
  4. Open Nautilus as root - ALT + F2 then enter GKSU NAUTILUS
  5. Navigate to Root Home folder
  6. Show hidden files
  7. Move link to .theme folder into Root Home folder
  8. Rename folder to .theme

close Root Nautilus and re-open

Or

Open terminal:

sudo ln -s ~/.fonts /root/.fonts  

sudo ln -s ~/.icons /root/.icons

sudo ln -s ~/.themes /root/.themes
pst007x
  • 8,240
2

Do a

$ sudo ln -s ~/.themes /root

This symlinks your theme directory so it can be used by the superuser account. Now any application run as root (or sudo/gksudo) will use your selected theme.

Jonathon
  • 2,491
  • does this covers also the theme customizations that you can change with GTK-Chtheme? – NES Dec 29 '10 at 21:33
  • 1
    that command will link your theme folder to root's home folder. That will NOT work! – MestreLion Jun 27 '11 at 13:58
  • Also, when you are creating symlinks you should provide full paths. A good tip is to use ln -s 'readlink -f ./relative/path' /desired/symlink/path where the single quotes around the readlink command should be backticks (couldn't find a way to override them). The readlink -f command gets the absolute path of a given reachable relative path. – Severo Raz Oct 29 '11 at 08:50
0

First you have to make sure your theme and icon theme is in the "/usr/share/themes/" and "/usr/share/icons/" directory. You can do this by:

sudo cp -r /home/jeroen/.themes/YOURTHEME/ /usr/share/themes/
sudo cp -r /home/jeroen/.icons/YOURICONTHEME/ /usr/share/icons/


Change YOURTHEME/YOURICONTHEME to the theme/icontheme you want root programs to use. If you want to make all icons/themes availlable for root use:

sudo cp -r /home/jeroen/.themes/*/ /usr/share/themes/
sudo cp -r /home/jeroen/.icons/*/ /usr/share/icons/


Then open gnome-appereance manager as root. Type in terminal:

sudo gnome-appearance-properties

Choose the theme of your choosing and from now on all programs excecuted as root will use that theme.

19J94V
  • 59