Bug 466958

Summary: Allow user to choose whether to install downloaded assets in home folder or systemwide
Product: [Frameworks and Libraries] frameworks-knewstuff Reporter: David <david.cortes.rivera>
Component: generalAssignee: Dan Leinir Turthra Jensen <admin>
Status: CONFIRMED ---    
Severity: wishlist CC: alexander.lohnau, kdelibs-bugs, nate
Priority: NOR    
Version: 5.103.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description David 2023-03-06 18:14:30 UTC
SUMMARY
If I install a theme from the KDE store for GTK apps and configure plasma to use it, it will not apply it to GTK apps that ask for sudo credentials such as "synaptic.

STEPS TO REPRODUCE
1. Go to System Settings -> Appearance -> Global Theme -> Configure GNOME/GTK Application Style -> click "Get New GNOME/GTK Application Styles".
2. Install some new theme from the store, such as "Materia-breeze-gtk" (in its dark variant).
3. After it gets downloaded, apply said theme.
4. Launch synaptic.
5. Enter your sudo credentials for synaptic in the pop-up window that asks for them.

OBSERVED RESULT
Synaptic (a) uses the adwaita theme; (b) is missing icons; (c) has poor color contrasts.

EXPECTED RESULT
Synaptic should use the theme that I have configured. In contrast, if I set it to the "adwaita-dark" that comes by default, it will correctly apply the theme to synaptic.

SOFTWARE/OS VERSIONS
Operating System: Debian GNU/Linux 12
KDE Plasma Version: 5.27.2
KDE Frameworks Version: 5.103.0
Qt Version: 5.15.8
Kernel Version: 6.1.0-5-amd64 (64-bit)
Graphics Platform: X11
Processors: 20 × 12th Gen Intel® Core™ i7-12700H
Memory: 62.6 GiB of RAM
Graphics Processor: Mesa Intel® Graphics
Manufacturer: SLIMBOOK
Product Name: Executive

ADDITIONAL INFORMATION
Comment 1 Nate Graham 2023-03-07 20:03:05 UTC
Any settings you change are saved to your user account. But when you run apps using `sudo`, they get their settings from the root user account, because they're being run as the root user.

In general, GUI apps should not be run using `sudo`; they should be smart enough to request elevated privileges themselves when you launch them and use them normally. Any apps that don't do this should be fixed, and ideally not used at all until that happens.
Comment 2 David 2023-03-07 20:12:01 UTC
(In reply to Nate Graham from comment #1)
> Any settings you change are saved to your user account. But when you run
> apps using `sudo`, they get their settings from the root user account,
> because they're being run as the root user.
> 
> In general, GUI apps should not be run using `sudo`; they should be smart
> enough to request elevated privileges themselves when you launch them and
> use them normally. Any apps that don't do this should be fixed, and ideally
> not used at all until that happens.

It's not correct that it doesn't apply user settings to it: if I select built-in themes like "adwaita-dark", it does apply it to sudo-requesting apps like synaptic.

Synaptic is by the way run as a user but with sudo permissions through "synaptic-pkexec". If you don't use a debian-based distro, another alternative is to try "gparted" which also requests sudo permissions.

Also, I seem to recall you deliberately disabled running graphical apps like "systemsettings5" as sudo so those settings cannot be changed for the root user either.
Comment 3 Nate Graham 2023-03-07 20:37:34 UTC
(In reply to David from comment #2)
> It's not correct that it doesn't apply user settings to it: if I select
> built-in themes like "adwaita-dark", it does apply it to sudo-requesting
> apps like synaptic.
That's because those themes are installed in a systemwide location. When you download themes from the store using the "get new [thing]" downloader, it places them in your home directory. So they aren't accessible from the perspective of the root user, which you're running the app as.

> Also, I seem to recall you deliberately disabled running graphical apps like
> "systemsettings5" as sudo so those settings cannot be changed for the root
> user either.
I did no such thing (and neither did anyone else), but regardless, you shouldn't do that because it will cause a ton of other problems for you and you'll be fighting with weird issues until the heat death of the universe. Just Say No. :) 


What we can perhaps do is allow downloaded themes to optionally be installed systemwide. But note that even this will not work in the next-generation of immutable OSs (bug 454509).
Comment 4 Alexander Lohnau 2023-03-12 06:50:13 UTC
There was some (defunct) code that would have allowed this feature. However, I share Nate's concern about this breaking on immutable OSs.

THB I am not sure if this feature is even a good idea, because we are still talking about third-party content.  Also, the KPackage installation logic does not allow system-wide installations. This would be needed in order for KNewStuff to allow it.
Comment 5 David 2023-03-12 09:25:05 UTC
(In reply to Alexander Lohnau from comment #4)
> There was some (defunct) code that would have allowed this feature. However,
> I share Nate's concern about this breaking on immutable OSs.
> 
> THB I am not sure if this feature is even a good idea, because we are still
> talking about third-party content.  Also, the KPackage installation logic
> does not allow system-wide installations. This would be needed in order for
> KNewStuff to allow it.

But KDE in any event is not even able to start when key paths like /home are read-only, so I don't get why inmutable systems would be a concern if it doesn't run in them.
Comment 6 David 2023-03-12 09:48:59 UTC
Actually, reading the other bug report, it seems that now things are saved to a different folder. I recall back when the GTK settings had more available things to configure, it was possible to launch the settings as root, install themes there that were put under /home/root, configure visual style for the root user, and then when launching apps my user session but as sudo or root, they would use the theme that was configured for them.

Perhaps putting these kinds of things under /home/root could be an option?