BMX Bicycle freestyle
BMX Bicycle freestyle

Tuesday, January 25, 2011

Kiosk mode with Ubuntu (xubuntu)

This script is useful for public presentation of your website. It uses Midori webrowser and keeps user on certain website. If user trys to surf other websites script automacialy give warnings and restarts webbrowser. Webbrowsers (Midori) menues and addressbar are removed manualy.


#!/bin/bash
##################
#Limiting internet on single webpage on public computers
#
#
#This script limits access to single webpage and restarts browser after 3 warnings to return on #allowed webpage.
#requred and tested:midori/firefox 3.6.3 with R-kiosk(haven't tried), wmctrl installed into bash shell.
#
#Our platform had: xubuntu9, midori 0.2.6, xfce, wmctrl
#
#note1:about:config #
#browser.sessionstore.resume_from_crash user_set boolean false
#note2:set homepage to desired page and set firefox to open homepage on startup
###################

#0x03600079 0 debi http://www.michkhoo.blogspot.com/ - Slovenian Audio - Video Center - Mozilla Firefox
#navodila
#zagnati na praznem namizju (linux xfce+wmctrl)
#
#already done:midori homepage set to http://www.michkhoo.blogspot.com/, removed all toolbars and menu, #disabled tabs, open new tab in backgroud, hide tabs


while true
do
killall xfce4-panel
#killall xfce4-desktop

  (ps ax | grep midori)
  if [ "$?" -eq 0 ]; then echo "it FOUND Midori"
   else
   midori&
   sleep 4
  fi
sleep 2

#check for most commonly accesesed disalowed websites
browsertitle=$(wmctrl -l | grep -m 1 "Midori" | grep Google)
if [ -z $browsertitle ];
   then echo "ok website"
   else
  echo "it FOUND disabled website"
   /usr/bin/notify-send -u normal \
   'Sorry restoring browser'
  killall midori
  #midori&
  echo
  sleep 4
fi

browsertitle=$(wmctrl -l | grep -m 1 "Midori" | grep Facebook)
if [ -z $browsertitle ];
  then echo "ok website"
  else
  echo "it FOUND disabled website"
  /usr/bin/notify-send -u normal \
  'Sorry restoring browser'
  killall midori
  #midori&
  echo
  sleep 4
fi

browsertitle=$(wmctrl -l | grep -m 1 "Midori" | grep Gmail)
if [ -z $browsertitle ];
  then echo "ok website"
  else
  echo "it FOUND disabled website"
  /usr/bin/notify-send -u normal \
  'Sorry restoring browser'
  killall midori
  #midori&
  echo
  sleep 4
fi

sleep 2

#check if computer is idle and than quickly resore webbrowser after 5 min
idleTime=$(xprintidle)
if [ "$idleTime" -gt "300000" ]
  #if [ "$filesize1" -eq "$filesize2" ]
  then
  /usr/bin/notify-send -u normal \
  'Restoring browser'
  killall midori
fi

0 comments:

Post a Comment