this post was submitted on 28 Jan 2025
23 points (100.0% liked)

Linux

49366 readers
958 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Hi.

I'm using Fedora KDE spin since last year, and have a need for the commands / a script to change power management and lock screen settings via the console (instead of manually going through the GUI).

I tried googling the commands, but feel like I didn't even get into the right direction.

If anyone could point me into the correct direction, that'd be greatly appreciated. A ready solution is nice, but I'd also like to know how to find such things by myself in the future.

Sorry if I use the wrong terminology, I used Windows until I switched last year.

(I posted this weeks ago in the /c/Fedora, but unfortunately didn't get any replies.)

top 6 comments
sorted by: hot top controversial new old
[–] BananaTrifleViolin@lemmy.world 3 points 1 day ago* (last edited 1 day ago) (2 children)

KDE config files can be changed on the command line using:

kwriteconfig

And viewed using

kreadconfig

Power management is in:

~/.config/powermanagementprofilesrc

And

~/.config/powerdevilrc

You can feed changes to the file via kwriteconfig via the command line OR create a duplicate file with different settings and use rename commands in a script file to switch back and forth.

E.g. rename the file to "powermanagementprofilesrc.backup" and create and rename a custom file with the settings you want like "powermanagmentprofilesrc.one" to "powermanagementprofilesrc". Rename them back and forth via a bash script to switch "profiles"

To apply changes you'd need to then run qdbus:

qdbus org.freedesktop.powermanagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.reparseConfiguration

And then to load the new config in your current session:

qdbus org.freedesktop.powermanagement /org/kde/Solid/PowerManagement org.kde.Solid.PowerManagement.refreshStatus

So either use kwriteconfig and qdbus in a script OR make duplicate config files and a bash script to copy or rename the configs as needed plus qdbus to apply the changes to the current session.

There may be a much simpler way of switching profiles already actually defined within the exisiting config files (e.g. battery saver vs performance) using qdbus but I'm not sure how to do that myself. Possibly using:

org/kde/Solid/PowerManagement/Actions/PowerProfile

EDIT2: Sorry this is a very long post! Just to say if you're new to linux and want to understand a bit: qdbus is a tool for QT based applications (including almost all of KDE which is build in QT) to interact with DBUS which is basically the messaging system in linux between processes.

So when you run qdbus on it's own you'll see a tree of processes that are interacting with QT processes. Then if you run qdbus & the name of a process like "org.freedesktop.powermanagement" you'll see what QT processes are running with/under it. Then if you run dqbus and add that connected process like "/org/kde/Solid/PowerManagement" you can see what strings and options are available. Then you can run qdbus to see more detail or change a setting/string.

Hope that make sense!

[–] AAA@feddit.org 1 points 21 hours ago

Thank you so much for the comprehensive explanation,includong the edit.

Coincidentally I discovered kwriteconfig by myself yesterday - but not the interaction with qdbus.

[–] ikidd@lemmy.world 1 points 1 day ago

Nice comment, that's exactly the way to do it.

[–] j4k3@lemmy.world 3 points 1 day ago

You can use the fedora direct sources to search their discourse forum. Google and Microsoft are likely warping your search results intentionally to drive you back onto Windows. Search is not deterministic any more. It is individually targeted.

I have never used KDE much, so I have no idea. You are probably looking for KDE settings. These would likely be part of gsettings in GNOME. That is not really a fedora thing. You need to look in the KDE documentation. This is the kind of thing that gets easier with time but can be frustrating at first.

Sorry I'm not more helpful than this. It is 2am in California and I didn't want to leave you with no replies at all.

[–] Tlaloc_Temporal@lemmy.ca 1 points 1 day ago (1 children)

I found this bug report thread for KDE, and Chris posted a couple possible solution in there. Seems like a good starting point.

[–] AAA@feddit.org 2 points 1 day ago

Thanks. I'll have a look later, and will try to understand.