Portál AbcLinuxu, 16. července 2025 15:25
Řešení dotazu:
#!/bin/sh
test -f /usr/share/acpi-support/state-funcs || exit 0
. /usr/share/acpi-support/power-funcs
. /usr/share/acpi-support/policy-funcs
. /etc/default/acpi-support
[ -x /etc/acpi/local/lid.sh.pre ] && /etc/acpi/local/lid.sh.pre
if CheckPolicy; then exit; fi
grep -q closed /proc/acpi/button/lid/*/state
if [ $? = 0 ]
then
# toto je zmeneno, okopirovano z /etc/acpi/hibernatebtn.sh
. /usr/share/acpi-support/key-constants
acpi_fakekey $KEY_SUSPEND
else
d=/tmp/.X11-unix
for x in $d/*; do
displaynum=${x#$d/X}
getXuser;
if [ x"$XAUTHORITY" != x"" ]; then
export DISPLAY=":$displaynum"
if [ x$RADEON_LIGHT = xtrue ]; then
[ -x /usr/sbin/radeontool ] && radeontool light on
fi
case "$DISPLAY_DPMS" in
xset)
su $XUSER -s /bin/sh -c "xset dpms force on"
;;
xrandr)
su $XUSER -s /bin/sh -c "xrandr --output LVDS --auto"
;;
vbetool)
/usr/sbin/vbetool dpms on
;;
esac
if pidof xscreensaver > /dev/null; then
if on_ac_power; then
su $XUSER -s /bin/sh -c "xscreensaver-command -unthrottle"
fi
su $XUSER -s /bin/sh -c "xscreensaver-command -deactivate"
fi
else
[ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms on
fi
done
fi
[ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post
Nicméně i tak děkuji za všechny rady.
#!/bin/sh test -f /usr/share/acpi-support/state-funcs || exit 0 . /usr/share/acpi-support/power-funcs . /usr/share/acpi-support/policy-funcs . /etc/default/acpi-support [ -x /etc/acpi/local/lid.sh.pre ] && /etc/acpi/local/lid.sh.pre if CheckPolicy; then exit; fi grep -q closed /proc/acpi/button/lid/*/state if [ $? = 0 ] then . /usr/share/acpi-support/key-constants acpi_fakekey $KEY_SUSPEND else d=/tmp/.X11-unix for x in $d/*; do displaynum=${x#$d/X} getXuser; if [ x"$XAUTHORITY" != x"" ]; then export DISPLAY=":$displaynum" if [ x$RADEON_LIGHT = xtrue ]; then [ -x /usr/sbin/radeontool ] && radeontool light on fi case "$DISPLAY_DPMS" in xset) su $XUSER -s /bin/sh -c "xset dpms force on" ;; xrandr) su $XUSER -s /bin/sh -c "xrandr --output LVDS --auto" ;; vbetool) /usr/sbin/vbetool dpms on ;; esac if pidof xscreensaver > /dev/null; then if on_ac_power; then su $XUSER -s /bin/sh -c "xscreensaver-command -unthrottle" fi su $XUSER -s /bin/sh -c "xscreensaver-command -deactivate" fi else [ -x /usr/sbin/vbetool ] && /usr/sbin/vbetool dpms on fi done fi [ -x /etc/acpi/local/lid.sh.post ] && /etc/acpi/local/lid.sh.post
Tiskni
Sdílej:
ISSN 1214-1267, (c) 1999-2007 Stickfish s.r.o.