Bug 494734 - Neochat Flatpak doesn't respect system accent color
Summary: Neochat Flatpak doesn't respect system accent color
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kcolorscheme
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 6.8.0
Platform: Flatpak Linux
: NOR normal
Target Milestone: ---
Assignee: Nicolas Fella
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-10-14 10:59 UTC by Gregorplanet
Modified: 2024-12-06 12:25 UTC (History)
5 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.9
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Gregorplanet 2024-10-14 10:59:54 UTC
OBSERVED RESULT
Neochat Flatpak respects color mode (dark/light mode), but not the accent color

EXPECTED RESULT
Accent color working in Neochat

SOFTWARE/OS VERSIONS
Operating System: Fedora Linux 40
KDE Plasma Version: 6.2.0
KDE Frameworks Version: 6.7.0
Qt Version: 6.7.2
Comment 1 Jan Rathmann 2024-10-15 09:03:48 UTC
Can confirm.
Seems to be a regression since applying accent colours worked until recently.
If I go to "Settings -> Appearance", I get the proper accent colour back, but it lasts only until quitting NeoChat.
Comment 2 John Kizer 2024-11-13 05:07:48 UTC
tl;dr I think this bug maybe needs either moved to a core component, or replicated across multiple products?

This same behavior seems to replicate itself in the Dolphin Flatpak as well - and both apps print the following message to the console after being launched:

kf.config.core: Watching absolute paths is not supported "/usr/share/color-schemes/BreezeLight.colors"

Dolphin doesn't have a way to manually change the color scheme like NeoChat does, but I noticed when closing the Dolphin Flatpak that once I click the close button, during the closing animation the accent color does show up (I use Breeze Classic so active window title bars have the accent color)

Should this be in frameworks-kconfig?
Comment 3 Anael 2024-12-04 01:32:08 UTC
This happened ever since https://invent.kde.org/frameworks/kcolorscheme/-/merge_requests/25 was merged.

Now, the default KColorScheme (which is the one with the user accent color of choice) is only applied if the Qt Platform Theme name is “kde”.

I created a basic Qt app that made use of the Qt Gui Private API and queried the name of the platform theme used inside the sandbox: 

QGuiApplicationPrivate::platformTheme()->name() => "xdgdesktopportal"

Which seems sensible enough, since the KDE Platform package is used in more desktop environments other than KDE. The problem for KDE Plasma users is that now, since "xdgdesktopportal" isn't equal to "kde", the default Breeze color scheme is used (which doesn't follow user accent color preferences).


WORKAROUND
As a workaround, the use of the default KColorScheme can be forced for all Flatpak apps:  

```bash
flatpak override --user --env=QT_QPA_PLATFORMTHEME=kde
```

After running this command all KDE Flatpaks I have installed (NeoChat, Kate, Tokodon, Elisa, Haruna, etc.) follow my accent color.

Definitively not a problem specific to NeoChat, so assigning this to frameworks-kcolorscheme.
Comment 4 Nicolas Fella 2024-12-06 10:43:36 UTC
Thanks for the investigation, good find
Comment 5 Jan Rathmann 2024-12-06 10:54:12 UTC
(In reply to Anael from comment #3) 
> WORKAROUND
> As a workaround, the use of the default KColorScheme can be forced for all
> Flatpak apps:  
> 
> ```bash
> flatpak override --user --env=QT_QPA_PLATFORMTHEME=kde
> ```

Beware, while this fixes accent colours, this override breaks file dialogs at least in NeoChat for me: They show an empty home dir, making it impossible to pick a file.
Comment 6 Bug Janitor Service 2024-12-06 11:03:37 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kcolorscheme/-/merge_requests/32
Comment 7 Nicolas Fella 2024-12-06 11:29:59 UTC
Git commit 7ca3d70303138ce35a201d7689e80a5cbf961b7d by Nicolas Fella.
Committed on 06/12/2024 at 11:03.
Pushed by nicolasfella into branch 'master'.

Fix isKdePlatformTheme for Flatpaks

When running Flatpaks on Plasma the platformtheme is 'xdgdesktopportal'

Internally it still proxies the real KDE platformtheme and we want to read the colors from it instead of just switching between Breeze Light and Dark

M  +15   -2    src/kcolorschememanager.cpp

https://invent.kde.org/frameworks/kcolorscheme/-/commit/7ca3d70303138ce35a201d7689e80a5cbf961b7d
Comment 8 Anael 2024-12-06 11:37:46 UTC
(In reply to Jan Rathmann from comment #5)
> (In reply to Anael from comment #3) 
> > WORKAROUND
> > As a workaround, the use of the default KColorScheme can be forced for all
> > Flatpak apps:  
> > 
> > ```bash
> > flatpak override --user --env=QT_QPA_PLATFORMTHEME=kde
> > ```
> 
> Beware, while this fixes accent colours, this override breaks file dialogs
> at least in NeoChat for me: They show an empty home dir, making it
> impossible to pick a file.

Sorry, I hadn't tried this with file dialogs and it seems that yes, it does indeed break them.
Now that this bug is fixed, it's best to remove the override anyway:

```bash
flatpak override --user --unset-env=QT_QPA_PLATFORMTHEME
```
And many thanks for the bugfix!
Comment 9 pranavtaysheti 2024-12-06 12:19:33 UTC
Having same issue on flatpak version of Konsole, Okular, Haruna on UBlue Aurora.
Comment 10 pranavtaysheti 2024-12-06 12:25:36 UTC
I am sorry, for changing the status of this bug report. I got confused when I say the option "status" below comment box - I thought it only represented my comment.