You are not logged in.

#1 2020-07-22 13:16:22

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,687

[Solved]Unable to override .desktop file KDE

I am trying to override KDE konsole's .desktop file. I copied org.kde.dolphin.desktop from /usr/share/applications to ~/.local/share/applications. I changed:

 Exec=konsole

to

Exec=env QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole

However the behaviour is unchanged. But if I issue the command QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole, then konsole behaves accordingly.

Question is why am I not able to override this setting? What am I missing? I have a vague feeling it has to do with xdg but not sure what to set.

Last edited by d_fajardo (2020-07-22 21:52:46)

Offline

#2 2020-07-22 16:56:52

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved]Unable to override .desktop file KDE

Maybe the way you start konsole, the system isn't going through the desktop file to start it? Your change will then not be seen.

You could try to do things differently and create a script file "/usr/local/bin/konsole", like this:

#!/bin/bash
export QT_AUTO_SCREEN_SCALE_FACTOR=1
exec /usr/bin/konsole

The /usr/local/bin location is in front of /usr/bin in $PATH. As long as "konsole" is called without full path, the /usr/local/bin file should then override the one in /usr/bin.

Offline

#3 2020-07-22 17:26:04

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,304

Re: [Solved]Unable to override .desktop file KDE

Have you run kbuildsycoca5 after modifying the desktop file?

Offline

#4 2020-07-22 18:27:45

ondoho
Member
Registered: 2013-04-30
Posts: 692
Website

Re: [Solved]Unable to override .desktop file KDE

d_fajardo wrote:
Exec=env QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole

However the behaviour is unchanged. But if I issue the command QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole, then konsole behaves accordingly.

These are two different commands.
Have you tried putting

Exec=QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole

in your .desktop file? Or possibly

Exec=sh -c 'QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole'

Offline

#5 2020-07-22 18:34:31

Ropid
Member
Registered: 2015-03-09
Posts: 1,069

Re: [Solved]Unable to override .desktop file KDE

ondoho wrote:
d_fajardo wrote:
Exec=env QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole

However the behaviour is unchanged. But if I issue the command QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole, then konsole behaves accordingly.

These are two different commands.
Have you tried putting

Exec=QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole

in your .desktop file? Or possibly

Exec=sh -c 'QT_AUTO_SCREEN_SCALE_FACTOR=1 konsole'

That "variable=value program" you suggested is something special about bash. It does not work inside a desktop file. That command line using "env" was correct. The "env" command does the same as what you suggested with the "sh -c '...'" command line.

Offline

#6 2020-07-22 21:52:11

d_fajardo
Member
Registered: 2017-07-28
Posts: 1,687

Re: [Solved]Unable to override .desktop file KDE

@Ropid Thanks for the tip.
I created a bash script as you suggested called konsole_exec in my 'own' bin directory which is in my path. Then I just edited the .desktop file to point to it:

Exec=/path/to/my/own/bin/konsole_exec

Offline

Board footer

Powered by FluxBB