Reply to topic

sudo applications and breeze theme

User avatar timorei
Registered Member
Posts
19
Karma
0
OS
That package doesn't exist in kubuntu - just "kde-cli-tools" - that is installed, but no kdesu available.
wolfi323
Registered Member
Posts
1128
Karma
11
OS
timorei wrote:That package doesn't exist in kubuntu - just "kde-cli-tools" - that is installed, but no kdesu available.

According to http://packages.ubuntu.com/vivid/amd64/ ... s/filelist it is available as /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu.

So either run:
Code: Select all
/usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu kwrite


Or create a symlink in /usr/bin/ (or similar):
Code: Select all
sudo ln -s /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu /usr/bin

Then you should be able to run "kdesu kwrite"... ;) (no idea if it will work though)

(if you are on a 32bit system, you'd have to replace /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu with /usr/lib/i386-linux-gnu/libexec/kf5/kdesu)
User avatar Hunter Nightblood
Registered Member
Posts
9
Karma
0
OS
I've been having this same issue. However, I have found out that it is not limited to Kate. In fact, it affects all apps ported to Frameworks 5. This includes Gwenview and Konsole. Strangly enough, all apps running on Plasma 4 (such as Dolphin) retain their theme when run using sudo. I think it has something to do with QT 5 vs 4, but I'm not entirely sure.

For the record, I am running Manjaro KDE 0.9.0-pre3.
michaell
Registered Member
Posts
2
Karma
0
Thank you to the people in this thread I finally solved the Breeze styling issue for root programs, like KDE Partition Manager, and Kate.

When I'd run KDE Partition Manager, the style would be so bare, it wouldn't even display icons, which is a problem because when going to View -> File System Support, the table would appear empty, which is a bug. And since this program needs to run as root, the issue is unavoidable.

So let me share how I solved this and ask how to report this as a bug.

First, I'm running Kubuntu 16.04, Plasma 5.6.5, Frameworks 5.23.0, Qt 5.5.1, Kernel 4.4.0-34, using Breeze Dark as the system theme. I have to launch Konsole and type:

Code: Select all
$ sudo -E partitionmanager
$ sudo -E <some-kde5-program>

In contrast, KDE4 programs display properly themed with this pattern:

Code: Select all
$ sudo kdf          # "KDiskFree"
$ sudo <some-kde4-program>      # note: no -E argument

If -E is passed to sudo for a KDE4 program, then it won't run at all. The output is this:

Code: Select all
$ sudo -E kdf
Error: "/var/tmp/kdecache-michael" is owned by uid 1000 instead of uid 0.
kdf(11163)/kdeui (kdelibs): Session bus not found
To circumvent this problem try the following command (with Linux and bash)
export $(dbus-launch)
KCrash: Application 'kdf' crashing...
KCrash: Attempting to start /usr/lib/kde4/libexec/drkonqi from kdeinit
KCrash: Connect sock_file=/home/michael/.kde/socket-samsung/kdeinit4__0
Unable to start Dr. Konqi
Not forwarding the crash to Apport.

I want to report this as a bug, but which category does this fall under? Plasma shell? Kickoff? Qt?
wolfi323
Registered Member
Posts
1128
Karma
11
OS
As I already wrote, don't use sudo for running graphical applications, that's dangerous and may even break your user account (the applications could change the ownership of files in your user's home directory to root).
And depending on the sudo setup on your system/in your distribution, it won't work anyway.

Use kdesu or xdg-su instead.

In the case of partitionmanager that's not even necessary though. It should switch to root by itself if you run it as user.
jsalatas
Registered Member
Posts
64
Karma
2
OS
You can add the following line to /etc/environment
XDG_CURRENT_DESKTOP="KDE"
michaell
Registered Member
Posts
2
Karma
0
Thank you for your response. I tested everything you mentioned, and this is what I found...

Use kdesu or xdg-su instead.


Kubuntu doesn't have kdesu, but it does have kdesudo, but that still results in the same non-theming issue as I began with (essentially no change).

Kubuntu doesn't have xdg-su either, even though I have the xdg-utils package installed.

In the case of partitionmanager that's not even necessary though. It should switch to root by itself if you run it as user.


If I run partitionmanager from the terminal, it asks for a password via kdesudo. Same happens when running it from the system menu. And again, partitionmanager is unthemed, so I can't see the light icons against an unthemed white background.

You can add the following line to /etc/environment
XDG_CURRENT_DESKTOP="KDE"


I checked and both bash and fish shells have this already declared.

So I'm back where I started and even though I hear what you're saying about the danger of running it as "sudo -E partitionmanager", that's the only way that works for me so far.

Would this be a distro bug then to report to Kubuntu?
wolfi323
Registered Member
Posts
1128
Karma
11
OS
michaell wrote:Kubuntu doesn't have kdesu, but it does have kdesudo, but that still results in the same non-theming issue as I began with (essentially no change).

As I wrote in my last reply before you joined in, Kubuntu does have kdesu, it is part of kde-cli-tools.

But in Kubuntu it isn't installed anywhere in the path.

See:
wolfi323 wrote:
timorei wrote:That package doesn't exist in kubuntu - just "kde-cli-tools" - that is installed, but no kdesu available.

According to http://packages.ubuntu.com/vivid/amd64/ ... s/filelist it is available as /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu.

So either run:
Code: Select all
/usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu kwrite


Or create a symlink in /usr/bin/ (or similar):
Code: Select all
sudo ln -s /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu /usr/bin

Then you should be able to run "kdesu kwrite"... ;) (no idea if it will work though)

(if you are on a 32bit system, you'd have to replace /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu with /usr/lib/i386-linux-gnu/libexec/kf5/kdesu)


You should also be able to create a menu entry or desktop shortcut and enable "Run as different user" in the properties.

kdesudo is not officially part of KDE (and never was), AFAIK it is just a frontend to sudo, so I would expect it to have the same problems...

And as I already mentioned, using "su -" should also work, e.g.:
Code: Select all
su - -c partitionmanager


Kubuntu doesn't have xdg-su either, even though I have the xdg-utils package installed.


Now that's strange, and I would consider that a (Kubuntu) bug.

If I run partitionmanager from the terminal, it asks for a password via kdesudo. Same happens when running it from the system menu. And again, partitionmanager is unthemed, so I can't see the light icons against an unthemed white background.

Of course it asks for a password, it cannot just switch to root by itself (that would be a huge security issue).

It doesn't use kdesudo here on openSUSE (I don't even have it installed), but kdesu.
And this works fine.

Maybe the code falls back to kdesudo when it doesn't find kdesu, creating a symlink should fix that then.

You can add the following line to /etc/environment
XDG_CURRENT_DESKTOP="KDE"


I checked and both bash and fish shells have this already declared.[/quote]
Yeah, because it is set in the user's environment when you login to a KDE session.
But apparently the apps run via sudo don't see it.

If you explicitly set it in /etc/bashrc, /etc/profile or similar, it should work for root as well, but that's not really advisable either, as *all* applications then *always* think they are running in KDE even if they are not.
wolfi323
Registered Member
Posts
1128
Karma
11
OS
wolfi323 wrote:It doesn't use kdesudo here on openSUSE (I don't even have it installed), but kdesu.
And this works fine.

Maybe the code falls back to kdesudo when it doesn't find kdesu, creating a symlink should fix that then.

I had a quick look at the code, and it does indeed try kdesudo if it cannot find kdesu.

But if you have kde-cli-tools installed, it should find kdesu, as it also looks in the "libexec" location.
If it doesn't find it, it's probably a packaging bug in Kubuntu.
User avatar wizard10000
Registered Member
Posts
5
Karma
0
wolfi323 wrote:Or create a symlink in /usr/bin/ (or similar):
Code: Select all
sudo ln -s /usr/lib/x86_64-linux-gnu/libexec/kf5/kdesu /usr/bin

Then you should be able to run "kdesu kwrite"... ;) (no idea if it will work though)


It works, that's how I resolved the issue in Debian Unstable.
jsalatas
Registered Member
Posts
64
Karma
2
OS
wolfi323 wrote:
You can add the following line to /etc/environment
XDG_CURRENT_DESKTOP="KDE"


I checked and both bash and fish shells have this already declared.

Yeah, because it is set in the user's environment when you login to a KDE session.
But apparently the apps run via sudo don't see it.

If you explicitly set it in /etc/bashrc, /etc/profile or similar, it should work for root as well, but that's not really advisable either, as *all* applications then *always* think they are running in KDE even if they are not.[/quote]

True! Apparently I'm using only KDE so I don't have any side effects in my case :)
User avatar timorei
Registered Member
Posts
19
Karma
0
OS
Long time since I asked this, but since this is still a little un-gorgeous spot on kubuntu-17.04 waaay before it's release I just wanted to let others who run kde-exclusively on their computer know that the change to /etc/environment did indeed do the trick. Thanks for that pointer.
jackdinn
Registered Member
Posts
77
Karma
0
ahh, great. spent a long time looking for this info.

You can add the following line to /etc/environment
XDG_CURRENT_DESKTOP="KDE"


This Is the only way i could get mint 16.1 KDE 5.28 plasma 5.8.5 to have a dark theme on root GUI's. sudo -E partitionmanager works but nothing else does and the advise was not to use sudo).

Thanks.
intika
Registered Member
Posts
5
Karma
0
An other solution is to add
Defaults env_keep += "DESKTOP_SESSION"
to
/etc/sudoers

 
Reply to topic

Bookmarks



Who is online

Registered users: Baidu [Spider], Bing [Bot], farid, Google [Bot], Sogou [Bot], Yahoo [Bot]