Bug 483417 - Leave power button to KDE's power-management applet
Summary: Leave power button to KDE's power-management applet
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: acpid
Version: 10
Hardware: i686
OS: Linux
low
low
Target Milestone: ---
Assignee: Zdenek Prikryl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-02-01 01:24 UTC by l ciani
Modified: 2009-02-18 04:08 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2009-02-05 02:17:36 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description l ciani 2009-02-01 01:24:10 UTC
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-02-01 01:25:10 UTC
By the way, this is similar to bug 169476

Comment 2 Rex Dieter 2009-02-01 03:07:12 UTC
Also consider guidance-power-manager, which is the F-10/kde default.

Comment 3 Jaroslav Reznik 2009-02-03 10:52:34 UTC
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 11:07:06 UTC
I vote for kded4 check only. This test should be enough these days.

Comment 5 Rex Dieter 2009-02-03 13:05:35 UTC
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 13:19:56 UTC
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 13:38:13 UTC
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 15:53:11 UTC
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 16:03:49 UTC
You're right, nevermind.  dbus queries may be the way to go.

Comment 10 Rex Dieter 2009-02-03 19:43:15 UTC
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 06:46:16 UTC
I agree with rdieter.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-05 02:17:34 UTC
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 11:29:04 UTC
All swell now. Thanks a million!!!

Comment 14 Lukáš Tinkl 2009-02-11 14:11:15 UTC
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 16:28:53 UTC
But that only works within a session, as it needs to connect to the D-Bus session bus.

Comment 16 Sergio Basto 2009-02-18 03:18:09 UTC
(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-18 03:33:36 UTC
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 Basto 2009-02-18 04:06:35 UTC
Are you talking about Battery Monitor v1.0 ? 
Doesn't have nothing but batt status

Comment 19 Kevin Kofler 2009-02-18 04:08:33 UTC
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.