This forum has been archived. All content is frozen. Please use KDE Discuss instead.

How can I update a modify kde4 configuration file

Tags: None
(comma "," separated)
alphab
Registered Member
Posts
7
Karma
0
Hi,

What should I add to the following command in order for the change to be saved for the current session

Code: Select all
sed -i 's/lidAction=1/lidaction=2/g' ~/.kde/share/config/powermanagementprofilesrc


Thank you
User avatar
einar
Administrator
Posts
3402
Karma
7
OS
Out of curiosity, why are you needing this change manually? Perhaps there is a better way to achieve what you need.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
alphab
Registered Member
Posts
7
Karma
0
I developed a computer-based alarm clock and need to have the computer on if lid closed during the night and computer off if lid closed during the day.

Thank you
User avatar
einar
Administrator
Posts
3402
Karma
7
OS
The problem with changing configuration files on the fly is that unless the programs reading it are restarted or reparse them, they will happily ignore the setting and go off on their own.

You could however use "kwriteconfig" to handle such files, should you need that.
Code: Select all
kwriteconfig --file  ~/.kde/share/config/powermanagementprofilerc --group AC --group XXX --key LidAction 1

Take a look at the file and substitute XXX for the right key (they're in format [aaa][bbb], you'll want the "bbb" part) as I don't have a laptop at hand to check the right name.


"Violence is the last refuge of the incompetent."
Image
Plasma FAQ maintainer - Plasma programming with Python
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
You can run the following command to ask PowerDevil (KDE Power Management) to reload it's configuration:
Code: Select all
qdbus org.kde.kded /org/kde/Solid/PowerManagement reparseConfiguration


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
novazur
Registered Member
Posts
41
Karma
0
OS
bcooksley wrote:You can run the following command to ask PowerDevil (KDE Power Management) to reload it's configuration:
Code: Select all
qdbus org.kde.kded /org/kde/Solid/PowerManagement reparseConfiguration


Always with my same problem of disabling power suspend, I want to say that doesn't work to reload config.

Code: Select all
$ cat powermanagementprofilesrc
[AC]
icon=battery-charging

[AC][SuspendSession]
idleTime=900000
suspendType=1

$ kwriteconfig --file powermanagementprofilesrc --group AC --group SuspendSession --key idleTime 60000

$ cat powermanagementprofilesrc[AC]
icon=battery-charging

[AC][SuspendSession]
idleTime=60000
suspendType=1

$ qdbus org.kde.kded /org/kde/Solid/PowerManagement reparseConfiguration


Waiting more than one minute, nothing happen.


Tried "qdbus org.kde.kded /kded reconfigure" too


KDE 4.11.2 Gentoo
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please try making a similar change through the control panel. I have checked with the code - and the qdbus command is a functional equivalent to what it does to inform the Powerdevil daemon component of configuration changes.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
novazur
Registered Member
Posts
41
Karma
0
OS
bcooksley wrote:Please try making a similar change through the control panel. I have checked with the code - and the qdbus command is a functional equivalent to what it does to inform the Powerdevil daemon component of configuration changes.


In fact, as my script doesn't work, I have to use control panel to disable suspend during my gentoo updates (compilationq), so I can tell it works with it.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Please diff the configuration files produced by kwriteconfig and the the control panel, to see if any other changes are being introduced which may be necessary.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
novazur
Registered Member
Posts
41
Karma
0
OS
bcooksley wrote:Please diff the configuration files produced by kwriteconfig and the the control panel, to see if any other changes are being introduced which may be necessary.

You mean ~/.kde4/share/config/ ?

I tested, there is no difference at all in ~/.kde4/share/config/ between the case (1) not working with config file modifyed by kwriteconfig and (2) the control panel where I only uncheck/check session suspend.

In (1) what I did after kwriteconfig :
~/.kde4/share/config $ qdbus org.kde.kded /org/kde/Solid/PowerManagement reparseConfiguration
~/.kde4/share/config $ qdbus org.kde.kded /kded reconfigure
~/.kde4/share/config $ qdbus org.kde.kded /org/kde/Solid/PowerManagement reparseConfiguration

In (2) the suspend is effectively activated after one minute.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Okay, i'm mystified then. I'll contact the developers to see if they can offer any guidance as to why running the qdbus command would not work - as it should do.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
novazur
Registered Member
Posts
41
Karma
0
OS
bcooksley wrote:Okay, i'm mystified then. I'll contact the developers to see if they can offer any guidance as to why running the qdbus command would not work - as it should do.

Thank you very mutch for all your help.
User avatar
šumski
Registered Member
Posts
106
Karma
1
OS
Is not this the full path?
Code: Select all
qdbus org.kde.kded /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.reparseConfiguration
luebking
Karma
0
yes, but unless clashes, qdbus should autopick that - you'd get an error message otherwise ("no such function" or so)


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Sogou [Bot]