вторник, 12 декабря 2017 г.

Kiosk mode with Ubuntu and Chromium


sudo apt-get update && sudo apt-get upgrade

Create a second user named kiosk. This will become the auto-logged in user.

I chose to add the 2 users to the sudoers file so I wouldn’t get prompted for passwords all the time.

Run visudo and at the bottom add
kiosk ALL=(ALL) NOPASSWD: ALL
obrienlabs ALL=(ALL) NOPASSWD: ALL

sudo apt-get install -y chromium-browser unclutter xdotool


Setup Auto Login

sudo nano /etc/lightdm/lightdm.conf

and add:

[SeatDefaults]
autologin-user=kiosk
autologin-user-timeout=0
user-session=ubuntu
greeter-session=unity-greeter

sudo mkdir /etc/lightdm/lightdm.conf.d && sudo nano /etc/lightdm/lightdm.conf.d/50-myconfig.conf and add:

[SeatDefaults]
autologin-user=kiosk

Setup kiosk.sh Script
Now that we are auto logged in, let’s run our script.

Run sudo mkdir /home/kiosk/.config/autostart && sudo nano /home/kiosk/.config/autostart/kiosk.desktop

and add:
[Desktop Entry]
Type=Application
Name=Kiosk
Exec=/home/kiosk/kiosk.sh
X-GNOME-Autostart-enabled=true

/home/kiosk/kiosk.sh
add

#!/bin/bash

# Run this script in display 0 - the monitor
export DISPLAY=:0

# Hide the mouse from the display
unclutter &

# If Chromium crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/kiosk/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/kiosk/.config/chromium/Default/Preferences

# Run Chromium and open tabs
/usr/bin/chromium-browser --window-size=1920,1080 --kiosk --window-position=0,0 http://google.com http://bing.com &

# Start the kiosk loop. This keystroke changes the Chromium tab
# To have just anti-idle, use this line instead:
# xdotool keydown ctrl; xdotool keyup ctrl;
# Otherwise, the ctrl+Tab is designed to switch tabs in Chrome
# #
while (true)
  do
    xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
    sleep 15
done

chmod +x kiosk.sh

restart
sudo killall kiosk.sh && sudo service lightdm restart


How to exit Kiosk mode
sudo killall chromium-browser

sudo killall kiosk.sh



Отблагодарить можно через форму справа "Donate" ... )

To reward you via the form on the right "Donate" ... )

:)

Комментариев нет :

Отправить комментарий

друзья )

cridex cms новости со всего мира
парсинг центр