9

I would like the the applications I launch as root to look differently from the application launched as a normal user.

This can be done by using a theme that does not come from usr/share/themes but I haven't found a way to modify the default theme the root applications use.

Can this be done?

Using sudo gnome-appearance-properties doesn’t work.

4

You are right when you found out that applications launched as root adopt the theme of the user that invokes them.

However there are few applications only that make sense to be launched as root. Fortunately for me these are three applications only:

  • Gedit
  • Nautilus
  • Terminal

All these three applications can at least partly be themed independent of the desktop theme. Once they are issued as root changes to the theme can be applied and will be kept:

enter image description here

Left: default themes | right: root themes

| improve this answer | |
  • Thanks a lot the only programs I really wanted with a different theme are gedit and nautilus. I won't accept your answer yet hopping someone has a system wide answer. – danjjl Aug 20 '11 at 18:20
  • That was a creative workaround. +1 – Jo-Erlend Schinstad Aug 20 '11 at 19:10
  • @danjjl: I'd love to see a better solution too ;) – Takkat Aug 20 '11 at 20:35
  • 1
    found a way to get a system wide change :) – danjjl Aug 28 '11 at 17:06
  • how can we do this?? – Sukupa91 Nov 26 '13 at 12:44
3

I found a hack to get get a system wide change :)

  • From the Appearance Preferences choose a theme you have installed in ~/.themes
  • Make a .themes folder in /root :

sudo mkdir /root/.themes

  • Copy your theme to /root/.themes :

sudo cp -r ~/.themes/yourTheme /root/.themes

  • Delete the gtk-2.0 and metacity-1 folders in /root/.themes/yourTheme :

sudo rm -R /root/.themes/yourTheme/gtk-2.0 /root/.themes/yourTheme/metacity-1

  • Copy the gtk-2.0 and metacity-1 folders of the new root theme to /root/.themes :

sudo cp -r /PathToRootTheme/gtk-2.0 /root/.themes/yourTheme/ ; sudo cp -r /PathToRootTheme/metacity-1 /root/.themes/yourTheme/

| improve this answer | |
  • 1
    What folder do you mean exactly by /PathToRootTheme/? You mean the one that was originally downloaded? – jat255 Jul 23 '12 at 16:06
  • this works on 20.04? they keep changing these folders.. – Aquarius Power Sep 14 at 22:32
2

I used a different approach. I use per-user themes and icons for the normal user. These are at ~/.themes and ~/.icons. My methods involve tricking the root apps into thinking that they're using current user's local theme,but in fact uses another global theme.

Method 1 : Using a systemwide/global theme and icons for Root Apps

Step 1 : Create symlinks in /root/.themes and /root/.icons to the global theme and icon you wish to use for root apps. Make /root/.themes and /root/.icons folders if they don't exist already:

sudo mkdir /root/.themes
sudo mkdir /root/.icons

I use the default Ubuntu Theme(Ambiance) and Icons(ubuntu-mono-dark).Replace Ambiance and ubuntu-mono-dark with the theme and icons you wish to use, and run the following commands:

sudo ln -s -t /root/.themes /usr/share/themes/Ambiance
sudo ln -s -t /root/.icons /usr/share/icons/ubuntu-mono-dark

But make sure that the theme and icon are available at /usr/share/themes and /usr/share/icons,or else Root Apps won't be able to access them and they'll look ugly.

Note: The previous answers involved copying the entire theme and icon folders to /root/.themes and /root/.icons. A similar approach is used in Method 2 of this answer. But,i prefer symlinks as they avoid data duplication and gets the job done.

Step 2 : Rename the theme and icon symlinks in /root/.themes and /root/.icons to exactly the same name as the one from ~/.themes and ~/.icons that you're currently using. As i'm using Delorean Dark theme and Faenza-Darkest icons,the commands in my case would be:

sudo mv /root/.themes/Ambiance '/root/.themes/Delorean Dark'
sudo mv /root/.icons/ubuntu-mono-dark '/root/.icons/Faenza-Darkest'

Replace Delorean Dark and Faenza-Darkest with the names of the themes you use.

Shortcut Command: You may perform Step 1 and 2 in 1 step

sudo ln -s /usr/share/themes/Ambiance '/root/.themes/Delorean Dark'
sudo ln -s /usr/share/icons/ubuntu-mono-dark '/root/.icons/Faenza-Darkest'

Method 2 : Theme and Icons exclusively for Root Apps

If you wish to make Root App themes and icons not accessible to normal users,don't place them in /usr/share/themes and /usr/share/icons. Instead, place them in /root/.themes and /root/.icons. Then rename them to the same name as your current theme and icons, similar to Step 2 of Method 1.

| improve this answer | |
0

Thanks for the "ln -s -t..." tip -- I had forgotten about that. That will be a big space-saver for sure.

In my case, I've always been a big fan of Shiki-Colors (and any subsequent themes based on them, including a few I've created) and GNOME-Colors. Being a user of LXDE/Openbox, I've always felt that PCManFM doesn't visually do enough to adequately remind users when they're using it with sudo privileges. Therefore, I've always thought that it and everything else should use the red (wine) GTK and icon themes when using it with sudo privileges.

| improve this answer | |
0

There is more simpler solution.

Go to one of the tty's (by clicking on Ctrl+Alt+F3 or Ctrl+Alt+F4 or Ctrl+Alt+F5 for example). Login as 'root'. type :

startx

Now you are logged as root into graphical mode, search the 'tweak' application and check the dark mode, logout. After you are back to the tty command line type:

exit.

To return to your session try clicking (Ctrl+Alt+F1 or Ctrl+Alt+F7)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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