Accepting request 186826 from home:michael-chang:bnc810125

- power_button: iterate systemd-logind sessions and do nothing if a
  active X session found (bnc#810125)

OBS-URL: https://build.opensuse.org/request/show/186826
OBS-URL: https://build.opensuse.org/package/show/Base:System/acpid?expand=0&rev=63
This commit is contained in:
Marcus Meissner 2013-08-14 09:33:11 +00:00 committed by Git OBS Bridge
parent c739c44295
commit 93c7c8c0e3
2 changed files with 29 additions and 0 deletions

View File

@ -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

View File

@ -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