Bug 483417 - Leave power button to KDE's power-management applet
Leave power button to KDE's power-management applet
Status: CLOSED NEXTRELEASE
Product: Fedora
Classification: Fedora
Component: acpid (Show other bugs)
10
i686 Linux
low Severity low
: ---
: ---
Assigned To: Zdenek Prikryl
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-01-31 20:24 EST by l ciani
Modified: 2009-02-17 23:08 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-02-04 21:17:36 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description l ciani 2009-01-31 20:24:10 EST
Description of problem: the file /etc/acpi/actions/power.sh should be modified to check if KDE's power-management applet (plasmoid) is running.


Version-Release number of selected component (if applicable): acpid-1.0.6-9.fc10

Actual results: if the power-button is pressed while running KDE's power-management applet, the system shuts down


Expected results: instead of shutting down, the system should present the standard logout/poweroff/restart dialog


Additional info: I don't have the skills to fix this so I changed my /etc/acpi/actions/power.sh like so, starting at line 19:

# Check that there is a power manager, otherwise shut down.
[ "$uid_session" ] || shutdown -h now

#[ "$uid_session" ] &&
#ps axo uid,cmd | \
#awk '
#    $1 == '$uid_session' &&
#       ($2 ~ /gnome-power-manager/ || $2 ~ /kpowersave/) \
#               { found = 1; exit }
#    END { exit !found }
#' ||
#  shutdown -h now

In this way, if there's an X11 session running, pushing the power button does not shutdown the system and KDE's power-management plasmoid takes control.

I don't have kpowersave installed as this is not the default in KDE 4.2.0.
Comment 1 l ciani 2009-01-31 20:25:10 EST
By the way, this is similar to bug 169476
Comment 2 Rex Dieter 2009-01-31 22:07:12 EST
Also consider guidance-power-manager, which is the F-10/kde default.
Comment 3 Jaroslav Reznik 2009-02-03 05:52:34 EST
For guidance it's easy:
#       ($2 ~ /gnome-power-manager/ || $2 ~ /kpowersave/ || $3 ~ /guidance-power-manager/) \

Question is how to determine PowerDevil status? It's KDED module, so does not appear in list of processes. Some distributions only tests if kded4 process is running - it should be enough assume that some power manager is running but... Another approach is to use DBUS - org.kde.powerdevilsystem.
Comment 4 Zdenek Prikryl 2009-02-03 06:07:06 EST
I vote for kded4 check only. This test should be enough these days.
Comment 5 Rex Dieter 2009-02-03 08:05:35 EST
removing from kde42 blocker, it's not a regression or kde42 specific.

the dbus idea looks sounds interesting, but checking for a KDE session, ie, not processing
if "${KDE_FULL_SESSION}" == "true"
is agreeable too.
Comment 6 Jaroslav Reznik 2009-02-03 08:19:56 EST
I think it's KDE 4 regression - users expect dialog not direct shutdown and it's KDE 4.2 specific too - PowerDevil is new feature and we have to check if it's running. So for me it's blocker :)

This check sounds pretty easy but again we have to believe that some power management is running on top of KDE, haven't we? I hope it's 99.9% sure...
Comment 7 Rex Dieter 2009-02-03 08:38:13 EST
It's a regression since F-8 true... :0   but blocking the 4.2 update for this?  No.
Comment 8 Kevin Kofler 2009-02-03 10:53:11 EST
Will KDE_FULL_SESSION be set at that point? It's only set for processes started from within the session.
Comment 9 Rex Dieter 2009-02-03 11:03:49 EST
You're right, nevermind.  dbus queries may be the way to go.
Comment 10 Rex Dieter 2009-02-03 14:43:15 EST
The compromise idea from the kde-sig meeting earlier today was to simply add a check for a "kded4" process (which is what opensuse apparently does here too), so

#       ($2 ~ /gnome-power-manager/ || $2 ~ /kded4/) \

should do the trick.
Comment 11 Zdenek Prikryl 2009-02-04 01:46:16 EST
I agree with rdieter@math.unl.edu. I'm going to add two more checks. First one for guidance-power-manager and second one for kded4.
Comment 12 Fedora Update System 2009-02-04 21:17:34 EST
acpid-1.0.6-10.fc10 has been pushed to the Fedora 10 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 13 l ciani 2009-02-08 06:29:04 EST
All swell now. Thanks a million!!!
Comment 14 Lukáš Tinkl 2009-02-11 09:11:15 EST
As a followup, here's a quick method (Qt-way), to check for PowerDevil's presence:

QDBusInterface kdedInterface("org.kde.kded", "/kded", "org.kde.kded");
QDBusReply<QStringList> reply = kdedInterface.call("loadedModules");
if (reply.isValid() && reply.value().contains("powerdevil")) 
{
    // we are alive
}
Comment 15 Kevin Kofler 2009-02-11 11:28:53 EST
But that only works within a session, as it needs to connect to the D-Bus session bus.
Comment 16 Sergio Monteiro Basto 2009-02-17 22:18:09 EST
(In reply to comment #0)
> 
> In this way, if there's an X11 session running, pushing the power button does
> not shutdown the system and KDE's power-management plasmoid takes control.
> 
> I don't have kpowersave installed as this is not the default in KDE 4.2.0.

Hi, have you something else that substitute kpowersave , to change 
CPU Frequency Policy and active schema of power management ? 

thanks,

BTW: kpowersave seems not obey to power manager profiles on  system settings
Comment 17 Kevin Kofler 2009-02-17 22:33:36 EST
Add a battery plasmoid to the panel. That plasmoid integrates with PowerDevil, which is also what the settings in System Settings are for.
Comment 18 Sergio Monteiro Basto 2009-02-17 23:06:35 EST
Are you talking about Battery Monitor v1.0 ? 
Doesn't have nothing but batt status
Comment 19 Kevin Kofler 2009-02-17 23:08:33 EST
I'm talking about the applet/widget/plasmoid which comes with KDE 4.2.

Note You need to log in before you can comment on or make changes to this bug.