Use Google Chrome as a Screensaver

You can use Google Chrome‘s --kiosk mode to create a full-screen screensaver of sorts. This might be good if you have a webpage or intranet page you’d like to display. Here’s how I did it for a windows computer:

Create a file such as c:\screensaver.bat and add the following code. Replace with your location of chrome.exe

@echo off
taskkill /im chrome.exe
start /wait "" "C:\Documents and Settings\Google\Chrome\Application\chrome.exe" --kiosk http://www.mysite.com
rem ## run any command here you'd like after the "screensaver" finishes ##

Next, set that to run as a scheduled task after the computer has been idle for 5 minutes (or however long you choose).

You can then listen with jQuery / javascript to close the page when the mouse moves. Here is code that closes the page when the mouse moves more than 20 pixels. You could also bind it to a keyboard event.

<html>
<head>
<script type="text/javascript"
    src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>

<h1>hello</h1>

<div id="log"></div>

    <script type="text/javascript">

    var startx = '';
    var starty = '';



jQuery('html').bind('mousemove',function(event){


    if(startx == ''){
        startx = event.pageX;
        starty = event.pageY;
    }else
    {

        deltax = Math.abs(event.pageX - startx);
        deltay = Math.abs(event.pageY - starty);

        var msg = '';
        msg += "distance x ";
        msg += deltax;

        msg += "distance y ";
        msg += deltay;

        $("#log").html("<div>" + msg + "</div>");

        if(deltax > 20 || deltay > 20){
            closeWindow();
        }

    }


});


function closeWindow(){
    setTimeout(function(){

        window.open('', '_self', '');
        window.close();

    },1000);
}


    </script>

</body>
</html>

Related Posts:

This entry was posted in Software, Tech Tips, Web Development and tagged , , , , , , , , . Bookmark the permalink.

3 Responses to Use Google Chrome as a Screensaver

  1. Joey says:

    Thanks.

    Next, set that to run as a scheduled task after the computer has been idle for 5 minutes (or however long you choose).

    How do I program this?

  2. W says:

    Yes, in fact that is what the kiosk mode (mentioned above) does :)

    For scheduling it, go into control panel and there is a “Scheduled Tasks” section, or just google “windows add scheduled tasks” and pick your version of windows.

  3. Joey says:

    Is it also possible to set Chrome fullscreen on the ‘screensaver’ launch?

Leave a Reply

Your email address will not be published. Required fields are marked *