OSX Script for Kiosk Mode
make your own screen saver
- tags
- osx
- toys
- gaze
Contents
In the office, we run Jenkins on the same machine that we run Benevolent Gaze. During iOS builds, the iOS simulator will take over the screen for the build, and then leave the beautiful screen on the desktop, hiding our smiling faces. We want to return to Safari in this case, but we also want to make sure that if someone is actually in front of the machine it will let them do their thing.
Here’s a little script that check if the user hasn’t touched the keyboard or mouse in a while, and if so it will pull Safari to the front.
|
|
The first thing that this does is to call the ioreg
command to pull data from the IOHIDSystem
. This is what OSX uses to track inactivity, which is used to start powering things down to conserve battery life. The units of this measurement are small, so we divide by 1000000000
to get them into seconds. We round that number to the nearest integer by adding 0.5
and lopping off the right of the decimal place with int
. Then we get the shortest number in the list using sort | head
.
This script waits 30
seconds (if [ $IDLE -gt 30 ]
) and then will run osascript
to activate Safari. The here-doc between EOF
is AppleScript which will activate Safari and bring it to the front. Replace that with Google Chrome if that’s your preferred browser.
Previously
Next