Bug 373944 - theming still broken with partiton manager 3 under Neon
Summary: theming still broken with partiton manager 3 under Neon
Status: RESOLVED FIXED
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (show other bugs)
Version: 3.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-20 07:20 UTC by PK
Modified: 2017-01-05 17:20 UTC (History)
0 users

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


Attachments
partition manager showing wrong font and color (251.46 KB, image/jpeg)
2016-12-20 07:27 UTC, PK
Details
results from within live-usb (392.44 KB, image/png)
2016-12-20 16:56 UTC, PK
Details
partionmanager started up with sudo QT_QPA_PLATFORMTHEME=kde partitionmanager (263.93 KB, image/png)
2016-12-20 17:30 UTC, PK
Details
AMD .desktop file (99.82 KB, image/png)
2016-12-21 10:53 UTC, PK
Details
Intel desktop file (139.75 KB, image/png)
2016-12-21 10:56 UTC, PK
Details

Note You need to log in before you can comment on or make changes to this bug.
Description PK 2016-12-20 07:20:24 UTC
overview: 
partiton manager 3 still doesn't take over the system theme in Neon.

steps to reproduce:
1) choose a non-standard system theme in plasmashell (e.g. different colors or different system font), 
2) then start up partition manager

actual results:
partition manager 3 didn't take over the new system font and color

expected results:
patition manager adapts to the system theme.

I read here https://stikonas.eu/wordpress/2016/12/18/kde-partition-manager-3-0/ that with partition manager 3 the theming (in Neon and Kubuntu) "is no longer broken". 
I regret to say that I don't see this. 
Partition manager still doesn't use the system font and doesn't use the system colors.
Comment 1 PK 2016-12-20 07:27:32 UTC
Created attachment 102891 [details]
partition manager showing wrong font and color

I use andika as system font and mainly orange colors. Both are ignored by partition manager
Comment 2 PK 2016-12-20 11:12:20 UTC
could this behaviour be the result of a missing dependency in my Neon system?
Comment 3 Andrius Štikonas 2016-12-20 12:40:46 UTC
(In reply to PK from comment #2)
> could this behaviour be the result of a missing dependency in my Neon system?

I'll download Neon CD and try it but most likely you need to change theme for root user.
Comment 4 Andrius Štikonas 2016-12-20 13:41:05 UTC
Yeah, you indeed need to change root theme too. Simplest way is to copy (or link) ~/.config/kdeglobals to /root/.config/kdeglobals.

This can't be fixed from within KDE Partition Manager.
Comment 5 Andrius Štikonas 2016-12-20 13:42:44 UTC
Although, strangely you don't even get Breeze style in your screenshot. Breeze works fine here in neon.

Make sure you are not running "sudo partitionmanager". KDE Partition Manager will properly restart itself with kdesu.
Comment 6 PK 2016-12-20 15:00:44 UTC
I copied ~/.config/kdeglobals to /root/.config/kdeglobals and things didn't get better. Then I tried linking (that would be a very elegant solution!) but it also had no effect.
Comment 7 PK 2016-12-20 15:02:25 UTC
While doing this I used Krusader in root-modus. I noticed that Krusader suffers from exactly the same issue.
Comment 8 Andrius Štikonas 2016-12-20 15:09:04 UTC
(In reply to PK from comment #7)
> While doing this I used Krusader in root-modus. I noticed that Krusader
> suffers from exactly the same issue.

Can you try the same thing in Neon Live CD?
Comment 9 PK 2016-12-20 15:23:03 UTC
Yes I can. But it will take some time. btw. my system is completely up to date. It would be very interesting if doing this on a live-cd would make it different.
Comment 10 PK 2016-12-20 15:47:15 UTC
I did the same in a live-cd from Neon. I just downloaded it. It makes no difference.
Comment 11 Andrius Štikonas 2016-12-20 15:53:46 UTC
How exactly are you launching partition manager, I now talked to guys on IRC on #kde-neon and they report the same results as me, it works for them.
Comment 12 PK 2016-12-20 16:04:02 UTC
just by clicking on the launcher icon in the menu. Immediate after I do so I have to enter my password.
Comment 13 Andrius Štikonas 2016-12-20 16:38:48 UTC
(In reply to PK from comment #12)
> just by clicking on the launcher icon in the menu. Immediate after I do so I
> have to enter my password.

strange, how can this happen :(. It works for me and those kde-neon developers I talked to. Live CD environment should be the same for everybody.

So when you enter your password command should be something like:
KDE_FULL_SESSION=true QT_QPA_PLATFORM=xcb partitionmanager --dontsu 

Well, neon developers also suggested me to add QT_QPA_PLATFORMTHEME=kde when theme is not defined, but this will have to wait till the next version.

E.g. even if you run "sudo QT_QPA_PLATFORMTHEME=kde partitionmanager" the theme should be breeze by default and not that ugly unthemed version like in screenshot
Comment 14 PK 2016-12-20 16:56:07 UTC
I was doubting myself now. So I tried again with the live-usb I just downloaded and made. I altered nothing but the workspace theme. I chose plasma dark.
Then I installed partition editor and you see the result in my second screenshot
Comment 15 PK 2016-12-20 16:56:47 UTC
Created attachment 102902 [details]
results from within live-usb
Comment 16 PK 2016-12-20 17:30:09 UTC
Created attachment 102903 [details]
partionmanager started up with sudo QT_QPA_PLATFORMTHEME=kde partitionmanager
Comment 17 PK 2016-12-20 18:48:28 UTC
I have a script that I run when I install Neon (or kubuntu). Thanks to our brainstorm on this place I added the lines:

sudo sed -i 's/#Exec=partitionmanager/sudo QT_QPA_PLATFORMTHEME=kde partitionmanager/' /usr/share/applications/org.kde.PartitionManager
    sudo sed -i 's/#Exec=krusader -qwindowtitle %c %u/sudo QT_QPA_PLATFORMTHEME=kde krusader/' /usr/share/applications/org.kde.krusader.root-mode

to that script. Now it is ok. Thank you.
Comment 18 PK 2016-12-20 19:09:01 UTC
Excusez moi... 
I made a mistake. The sed commands must be:

sudo sed -i 's/#Exec=partitionmanager/Exec=sudo QT_QPA_PLATFORMTHEME=kde partitionmanager/' /usr/share/applications/org.kde.PartitionManager
    sudo sed -i 's/#Exec=krusader -qwindowtitle %c %u/Exec=sudo QT_QPA_PLATFORMTHEME=kde krusader/' /usr/share/applications/org.kde.krusader.root-mode
Comment 19 Andrius Štikonas 2016-12-20 19:45:36 UTC
Ok, so you have temporary workaround and I'll try to improve the situation even more in later releases with that QT_QPA_PLATFORMTHEME variable. Although, I still don't understand why nobody else sees this... So strange.
Comment 20 PK 2016-12-21 06:18:47 UTC
I will bother you one more time. I hope you won't mind.
I started up the live-usb in an old desktop (amd athlon 4400+ cpu, old nvidia graphic card). The laptop I was talking about yesterday is a seven years old Dell (intel centrino mobile processor, intel intgrated graphic card). So you can say these machines are totally different.

I installed partitionmanager in the live-usb on the amd/nvidia desktop and partitionmanager appeared "ugly and unthemed" as you so accurately put it.
Comment 21 PK 2016-12-21 10:53:57 UTC
Created attachment 102919 [details]
AMD .desktop file
Comment 22 PK 2016-12-21 10:56:32 UTC
When I execute exactly the same .desktop file from the same location on my intel based laptop I get this (see attachment "intel desktop file"
Comment 23 PK 2016-12-21 10:56:58 UTC
Created attachment 102920 [details]
Intel desktop file
Comment 24 PK 2016-12-21 14:09:11 UTC
On the German Neon forum I saw a workaround for the problem that seems to work excellent http://www.kde-neon.de/topic/keine-icons-und-theme-als-root/. They suggest you make a file called "workaround_kde5" with only one line in it namely:
Defaults env_keep += "KDE_SESSION_VERSION KDE_FULL_SESSION"
and sudo cp it to the folder /etc/sudoers.d/

That could do the trick.
Comment 25 PK 2016-12-21 16:05:33 UTC
100% remedy:
In the files /usr/share/applications/org.kde.PartitionManager.desktop and /usr/share/applications/org.kde.krusader.root-mode.desktop (for Krusader-root, same issue) one or two things have to be changed. In my opinion kdesudo is to blame for the whole thing. That is IN NEON.

- replace X-KDE-SubstituteUID=true by X-KDE-SubstituteUID=false
that gives you the chance to change the behaviour of kdesudo yourself. And then

- in /usr/share/applications/org.kde.PartitionManager.desktop replace Exec=partitionmanager by Exec=kdesudo -c "HOME=$HOME partitionmanager
and in
- /usr/share/applications/org.kde.krusader.root-mode.desktop replace Exec=krusader" -qwindowtitle %c %u by Exec=kdesudo -c "HOME=$HOME krusader" -qwindowtitle %c %u

Easiest is to use sed:
 sudo sed -i 's/X-KDE-SubstituteUID=true/X-KDE-SubstituteUID=false/' /usr/share/applications/org.kde.PartitionManager.desktop
    sudo sed -i 's/Exec=partitionmanager/Exec=kdesudo -c "HOME=$HOME partitionmanager"/' /usr/share/applications/org.kde.PartitionManager.desktop
    sudo sed -i 's/X-KDE-SubstituteUID=true/X-KDE-SubstituteUID=false/' /usr/share/applications/org.kde.krusader.root-mode.desktop
    sudo sed -i 's/Exec=krusader" -qwindowtitle %c %u/Exec=kdesudo -c "HOME=$HOME krusader" -qwindowtitle %c %u/' /usr/share/applications/org.kde.krusader.root-mode.desktop
Comment 26 Christoph Feck 2016-12-21 18:39:55 UTC
Note that 'kdesudo' is provided by Kubuntu base, while 'kdesu' is what KDE developers provide.

Could you please check if 'kdesu' has the same issue? If yes, bugs for 'kdesu' are tracked in this bug tracker.
Comment 27 PK 2016-12-22 07:03:41 UTC
thank you for your suggestion. I keep testing on my two computers (one intel based and one amd based) and I keep getting unexpected (and different) results. I hope I get so far that I can make a bug out of it.
Comment 28 PK 2016-12-24 14:38:38 UTC
I still do not understand what is wrong. But I now believe it has very much to do with this bug https://bugs.launchpad.net/ubuntu/+source/dolphin/+bug/1509562
Comment 29 Andrius Štikonas 2017-01-05 17:20:21 UTC
For version 3.1 I think I'll also pass $HOME environmental variable to keep user home dir and theming.