Minimize difference between power_button and sleep_button script
OBS-URL: https://build.opensuse.org/package/show/Base:System/acpid?expand=0&rev=57
This commit is contained in:
parent
8d611ed792
commit
5c116f84d1
14
sleep_button
14
sleep_button
@ -17,8 +17,8 @@ while read A; do
|
|||||||
|
|
||||||
SESSION=`echo $A | sed 's/\(Session[0-9]*\):/\1/g'`
|
SESSION=`echo $A | sed 's/\(Session[0-9]*\):/\1/g'`
|
||||||
IS_X=`dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit \
|
IS_X=`dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit \
|
||||||
/org/freedesktop/ConsoleKit/$SESSION \
|
/org/freedesktop/ConsoleKit/$SESSION \
|
||||||
org.freedesktop.ConsoleKit.Session.GetX11Display`
|
org.freedesktop.ConsoleKit.Session.GetX11Display`
|
||||||
|
|
||||||
# check if this is a X session, if not, go on
|
# check if this is a X session, if not, go on
|
||||||
DISP=`echo $IS_X | sed -e 's/^.* string "\(.*\)"/\1/'`
|
DISP=`echo $IS_X | sed -e 's/^.* string "\(.*\)"/\1/'`
|
||||||
@ -30,11 +30,11 @@ while read A; do
|
|||||||
IS_ACTIVE=`echo $IS_ACTIVE | sed -e 's/^.* boolean \(.*\)$/\1/'`
|
IS_ACTIVE=`echo $IS_ACTIVE | sed -e 's/^.* boolean \(.*\)$/\1/'`
|
||||||
|
|
||||||
if [ "$IS_ACTIVE" = "true" -a -n "$DISP" ]; then
|
if [ "$IS_ACTIVE" = "true" -a -n "$DISP" ]; then
|
||||||
# additional check, if none of these two apps are running, go on
|
# 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`" ]; then
|
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...
|
echo doing nothing...
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
done < <(ck-list-sessions)
|
done < <(ck-list-sessions)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user