Fix monitor standby/suspend state in auto-stop script
This commit is contained in:
parent
b864f789f4
commit
fa9e969cf2
@ -1,5 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
timer_prog="timer"
|
||||||
|
xset_prog="xset"
|
||||||
|
|
||||||
timer_is_start()
|
timer_is_start()
|
||||||
{
|
{
|
||||||
if [ "$(timer current)" = "NO TASKS" ]; then
|
if [ "$(timer current)" = "NO TASKS" ]; then
|
||||||
@ -11,14 +14,12 @@ timer_is_start()
|
|||||||
|
|
||||||
screen_status()
|
screen_status()
|
||||||
{
|
{
|
||||||
local xset_status=$(xset q | grep "Monitor is")
|
local xset_status=$($xset_prog q | grep "Monitor is On")
|
||||||
|
|
||||||
if [ "$xset_status" = " Monitor is On" ]; then
|
if [ -z "$xset_status" ]; then
|
||||||
echo "on"
|
|
||||||
elif [ "$xset_status" = " Monitor is Off" ]; then
|
|
||||||
echo "off"
|
echo "off"
|
||||||
else
|
else
|
||||||
echo "unknown"
|
echo "on"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -33,13 +34,13 @@ do
|
|||||||
case $scr in
|
case $scr in
|
||||||
on)
|
on)
|
||||||
if [ $timer_on = "on" ]; then
|
if [ $timer_on = "on" ]; then
|
||||||
timer start
|
$timer_prog start
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
off)
|
off)
|
||||||
timer_on=$(timer_is_start)
|
timer_on=$(timer_is_start)
|
||||||
if [ $timer_on = "on" ]; then
|
if [ $timer_on = "on" ]; then
|
||||||
timer stop
|
$timer_prog stop
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user