diff --git a/acpid.changes b/acpid.changes index 036c056..f877102 100644 --- a/acpid.changes +++ b/acpid.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Aug 13 06:44:10 UTC 2013 - mchang@suse.com + +- power_button: iterate systemd-logind sessions and do nothing if a + active X session found (bnc#810125) + ------------------------------------------------------------------- Fri Aug 2 11:56:14 UTC 2013 - werner@suse.de diff --git a/power_button b/power_button index 46823b2..ebdf2f9 100644 --- a/power_button +++ b/power_button @@ -54,5 +54,28 @@ while read A; do fi done < <(ck-list-sessions) +# iterate over all sessions. If a active X session is found, do nothing +# bnc#810125 - 12.3 power button always halts system instead suspend +# similar to consolekit checks, this time we check systemd-logind sessions +while read SESSION DUMMY ; do + + # check if this is a X session, if not, go on + DISP=`loginctl --property=Display show-session $SESSION` + DISP=`echo $DISP | sed -e 's/^Display=//'` + [ -n "$DISP" ] || continue + + STATE=`loginctl --property=State show-session $SESSION` + STATE=`echo $STATE | sed -e 's/^State=//'` + + if [ "$STATE" = "active" -a -n "$DISP" ]; then + # additional check, if none of these two apps are running, go on + if [ -n "`pidof kpowersave`" -o -n "`pidof gnome-power-manager`" -o -n "`pidof kded4`" -o -n "`pidof dalston-power-applet`" -o -n "`pidof gnome-settings-daemon`" ]; then + echo doing nothing... + exit 0 + fi + fi + +done < <(loginctl list-sessions) + logger -s -t pm-profiler "Power Button pressed, executing $EXEC" $EXEC