Is it safe to use pkexec with systemsettings?

I see here that systemsettings shouldn’t be run with sudo. What about pkexec?

e.g.

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=6 KDE_FULL_SESSION=true dbus-launch systemsettings

proposed here?

or

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY KDE_SESSION_VERSION=5 KDE_FULL_SESSION=true dbus-launch systemsettings

for Plasma 5 as said here?

I have hesitated using it — in order to fix a problem with gtk apps with elevated privileges having broken theme when Breeze Dark Plasma theme and Breeze-gtk were selected: instead, I have added new/better gtk theme to /usr/share/themes and used that.

Pretty sure the original issue applies: the software is written expecting a normal user, but it writes to things using root permissions (and different paths), thus breaking things in odd ways that are completely untested and unsupported by KDE.

4 Likes

The issues with themes is rather frustrating though - with Gnome2 it was easily solved moving themes to /usr/share/themes folders.

The ability to set a distinct and separate, or mirror the user theme for Root, would be more ideal.

Would it be feasible to offer the option (when browsing kcmshell6 icons/colors etc) to apply as user, apply as root?

Right now, the best solution I found was this:

Copy your local config files to /root/ (this is the relevant user folder for root/sudo user):

$HOME/.gtkrc-2.0
$HOME/.config/gtk-3.0/settings.ini
$HOME/.config/gtk-4.0/settings.ini
$HOME/.config/plasmarc
$HOME/.config/qt5ct/qt5ct.conf
$HOME/.config/Kvantum/kvantum.kvconfig

Important!
Make sure the settings do not include locally installed themes, only system themes (at /usr/share).

A good practice would be to set a different root theme than normal user’s, so it is immediately realized it has elevated privileges.

How do we achieve that?

It seems to me that the solution is to give the same theme to the root applications.

My problem was that root GTK applications like gparted had white theme when the overall theme was dark, but that light theme was broken. Now they have the same dark theme as normal GTK applications (and close to the other/KDE applications).