(Gnome) Some applications launched as root do not follow dark theme

Hi,
I tried to make all applications follow the dark theme, including applications run as root. For example, Timeshift needs to be run as root and it used the light theme.

After some digging I found that after creating a link to the dark theme (Adwaita-dark – from /usr/share/themes) in /root/.themes and /root/.local/share/themes along with linking the settings ini files (from the respective user directory) in /root/.config/gtk-3.0 and /root/.config/gtk-4.0 with gtk-application-prefer-dark-theme=1 did help TImeshift to adopt the dark theme. However, by default, running nautilus or gnome-text-editor as root, they still use the light theme.

What am I doing wrong?
EDIT: I attached a screenshot for reference.

1 Like

Some Gnome-based applications have not yet been updated to Gnome 42, from what I’ve read. For the “legacy” applications, I think you’ll find a solution by a web search for “fedora gnome legacy apps”

2 Likes

I saw an extension that should do that but it doesn’t really help. Besides, the new GNOME text editor should be updated to GNOME 42, however it too follows a light theme when opened as root. I mean, it can be changed manually by using the three dot menu but I am looking for a more universal solution.

Welcome to ask.fedora @zerovector

Stop using root. Use Sudo. The theming is saved in the users home. As you probably not logged in as root, just open apps as root, you have two different users with two different themes.

When you use sudo, you keep beeing active with your username but you are a member of the group wheel. Wheel has root rights, you can do what you need to do with root but you are still using the theming of your user.

You probably mix it up with the GTK themes. For this themes you can use the gnome-tweaksextension to change to the dark theme. >>Appearance > Legacy Applications

1 Like

No matter how one escalates privileges, it is generally unwise to run a graphical environment as root like this as is both unnecessary and potentially highly insecure. Polkit should ask for a password from a regular user if it needs one to do something administrative like this (or setting up a new printer, etc.), so running Gnome as root is definitely not needed, necessary, or helpful here, and oddly enough, could cause problems since this is very likely not a tested method by application devs.

Ok this just works in gnome, I just saw it right now. In Mate or other DE’s I do get an error that I can’t access so simple the /root folder.
Then opening caja with sudo helped.

In the last 5 years I have never needed access to the /root folder. I wonder what you are doing that you feel it necessary to access that folder.

I also have never needed to use anything other than sudo for admin tasks, although I do set a root password just in case there is need to enter the root password if the system happens to boot to emergency mode. (have seen that once in the same 5 years)

I probably need to clear some things up. First of all, yes, I prefer to use the terminal in most situations when a command needs to be run with elevated privileges and try not to use GUI based tools but it just bothers me when I don’t understand something so I was hoping for a “solution” to this “mystery”. Besides, I know about the security (or sometimes privacy) risks when you run a complex application as root (even more so, one that wasn’t meant to be run as such), yet I still want to find out how to do it with a dark theme and hopefully learn something along the way.

It was one of the first things I did when I set up my system so I don’t think that’s a problem. And as mentioned, all applications that run without elevated privileges (legacy or not), do respect the dark theme – so far.

With all due respect, as stated above, I am aware of the implications but I would at least want to understand how to make all applications run as root dark (or what gives them the theme they are currently running), despite me maybe not ever using them.

It’s not really necessary but I would like to understand how something is done and I didn’t think that looking at the source code would be the easiest option and such I thought that posting here is worth a shot.

For your regular user, yes.

Do the same with the root user …log in change to dark theme and also use tweaks as root, then everything should be as you like.

Logging in as a root user did change it to dark theme, however I am still in the dark (no pun intended) about what it actually changed. I mean the settings.ini files in gtk 3 and 4 folders are no longer symlinks but they are set to 0 and setting them to 1 doesn’t change a thing. The theme folders also contain the symlinks I created before. I’m just as clueless but thanks for the workaround.

I can understand this. A lot of how I initially learned Linux was from trying stuff just like this, breaking it, and figuring out how to fix it. That said, you can’t fault us for trying to be responsible in advising that you avoid doing something that might leave your system insecure or less functional. That said, I respect that it is your system and hope you get some fun out of your experimentation without learning the hard-way about why the insecurity concerns are real.

1 Like

Thank you for your time and concern! I very much appreciate it. :smile:

2 Likes