Add an 'ASAP' variant to the KOReader KUAL menu.

Does away with the added ~3s of sleep, in exchange of possible UI quirks
at startup.
pull/702/head
NiLuJe 10 years ago
parent 6e10b877ad
commit db4a30ff07

@ -26,6 +26,18 @@
"priority": 4,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--framework_stop"
},
{
"name": "Start the filemanager (ASAP)",
"priority": 5,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--asap /mnt/us/documents"
},
{
"name": "Open the last document (ASAP)",
"priority": 6,
"action": "/mnt/us/koreader/koreader.sh",
"params": "--asap"
}
]
}

@ -37,27 +37,36 @@ PILLOW_DISABLED="no"
# Keep track of if we were started through KUAL
FROM_KUAL="no"
# By default, don't stop the framework.
if [ "$1" == "--framework_stop" ] ; then
shift 1
STOP_FRAMEWORK="yes"
NO_SLEEP="no"
elif [ "$1" == "--asap" ] ; then
# Start as soon as possible, without sleeping to workaround UI quirks
shift 1
NO_SLEEP="yes"
STOP_FRAMEWORK="no"
else
STOP_FRAMEWORK="no"
NO_SLEEP="no"
fi
# Detect if we were started by KUAL by checking our nice value...
if [ "$(nice)" == "5" ] ; then
FROM_KUAL="yes"
# Yield a bit to let stuff stop properly...
logmsg "Hush now . . ."
# NOTE: This may or may not be terribly useful...
usleep 250000
if [ "${NO_SLEEP}" == "no" ] ; then
# Yield a bit to let stuff stop properly...
logmsg "Hush now . . ."
# NOTE: This may or may not be terribly useful...
usleep 250000
fi
# Kindlet threads spawn with a nice value of 5, we aim for the same -2 as the KF8 reader
logmsg "Be nice!"
renice -n -7 $$
fi
# By default, don't stop the framework.
if [ "$1" == "--framework_stop" ] ; then
shift 1
STOP_FRAMEWORK="yes"
else
STOP_FRAMEWORK="no"
fi
# we're always starting from our working directory
cd /mnt/us/koreader
@ -124,13 +133,15 @@ if [ "${STOP_FRAMEWORK}" == "no" -a "${INIT_TYPE}" == "upstart" ] ; then
# NOTE: One more great find from eureka (http://www.mobileread.com/forums/showpost.php?p=2454141&postcount=34)
lipc-set-prop com.lab126.pillow interrogatePillow '{"pillowId": "default_status_bar", "function": "nativeBridge.hideMe();"}'
PILLOW_DISABLED="yes"
# NOTE: Leave the framework time to refresh the screen, so we don't start before it has finished redrawing after collapsing the title bar
usleep 250000
# NOTE: If we were started from KUAL, we risk getting a list item to popup right over us, so, wait some more...
# The culprit appears to be a I WindowManager:flashTimeoutExpired:window=Root 0 0 600x30
if [ "${FROM_KUAL}" == "yes" ] ; then
logmsg "Playing possum to wait for the window manager . . ."
usleep 2500000
if [ "${NO_SLEEP}" == "no" ] ; then
# NOTE: Leave the framework time to refresh the screen, so we don't start before it has finished redrawing after collapsing the title bar
usleep 250000
# NOTE: If we were started from KUAL, we risk getting a list item to popup right over us, so, wait some more...
# The culprit appears to be a I WindowManager:flashTimeoutExpired:window=Root 0 0 600x30
if [ "${FROM_KUAL}" == "yes" ] ; then
logmsg "Playing possum to wait for the window manager . . ."
usleep 2500000
fi
fi
fi
fi

Loading…
Cancel
Save