Skip to content

Instantly share code, notes, and snippets.

@klan
Last active August 14, 2018 20:13
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save klan/7482956 to your computer and use it in GitHub Desktop.
Save klan/7482956 to your computer and use it in GitHub Desktop.
Update and install requirements:
› sudo apt-get update
› sudo apt-get dist-upgrade
› sudo apt-get install matchbox chromium x11-xserver-utils ttf-mscorefonts-installer xwit sqlite3 libnss3
Curl to desktop, cat file and copy-paste into existing files:
› curl -L --output /home/pi/Desktop/config.txt --get https://gist.githubusercontent.com/klan/7482956/raw/ebe5b60527aad2bec93e23035cbc07ee5b6a3d9b/config.txt
› curl -L --output /home/pi/Desktop/rc.local --get https://gist.githubusercontent.com/klan/7482956/raw/33786a1c5c9448bf30cd037950169679a718fb79/rc.local
Curl new file to location:
› sudo curl -L --output /boot/xinitrc --get https://gist.githubusercontent.com/klan/7482956/raw/3e8db5dd5461dc26f9b5e5adfde841b505565fa3/xinitrc
Reboot and enjoy:
› sudo reboot
# (add this to the bottom of /boot/config.txt)
# My settings:
disable_overscan=1
framebuffer_width=1900
framebuffer_height=1200
framebuffer_depth=32
framebuffer_ignore_alpha=1
hdmi_pixel_encoding=1
hdmi_group=2
# (add this to the bottom of /etc/rc.local)
# Wait for TV to be turned on
while ! $(tvservice --dumpedid /tmp/edid | fgrep -qv 'Nothing written!' ); do
bHadToWaitForScreen=true;
printf "===> Screen is either off, not connected or in an unknown mode, waiting for it to become available...\n"
sleep 10;
done;
printf "===> Screen is on, extracting preferred mode..\n"
_DEPTH=32;
eval $( edidparser /tmp/edid | fgrep 'preferred mode' | tail -1 | sed -Ene 's/^.+(CEA|̣DMT) \(([0-9]+)\) ([0-9]+)x([0-9]+)[pi]? @.+/_GROUP=\1;_MODE=\2;_XRES=\3;_YRES=\4;/p' );
printf "===> Resetting screen to preferred mode: %s-%d (%dx%dx%d)...\n" $_GROUP $_MODE $_XRES $_YRES $_DEPTH
tvservice --explicit="$_GROUP $_MODE"
sleep 1;
printf "===> Resetting frame-buffer to %dx%dx%d...\n" $_XRES $_YRES $_DEPTH
fbset --all --geometry $_XRES $_YRES $_XRES $_YRES $_DEPTH -left 0 -right 0 -upper 0 -lower 0;
sleep 1;
# Using tailored xinitrc
if [ -f /boot/xinitrc ]; then
ln -fs /boot/xinitrc /home/pi/.xinitrc;
su - pi -c 'startx'
fi
exit 0
#!/bin/sh
while true; do
# Clean up previously running apps, gracefully at first then harshly
killall -TERM chromium 2>/dev/null;
killall -TERM matchbox-window-manager 2>/dev/null;
sleep 2;
killall -9 chromium 2>/dev/null;
killall -9 matchbox-window-manager 2>/dev/null;
# Clean out existing profile profile information
rm -rf /home/pi/.cache;
rm -rf /home/pi/.config;
rm -rf /home/pi/.pki;
# Generate the bare minimum to keep Chromium happy!
mkdir -p /home/pi/.config/chromium/Default
sqlite3 /home/pi/.config/chromium/Default/Web\ Data "CREATE TABLE meta(key LONGVARCHAR NOT NULL UNIQUE PRIMARY KEY, value LONGVARCHAR); INSERT INTO meta VALUES('version', '46'); CREATE TABLE keywords (foo INTEGER);";
# Disable DPMS / Screen blanking
xset -dpms
xset s off
# Reset the framebuffer's color-depth
fbset -depth $( cat /sys/module/*fb*/parameters/fbdepth );
# Hide the cursor (moving to bottom-right)
xwit -root -warp $( cat /sys/module/*fb*/parameters/fbwidth ) $( cat /sys/module/*fb*/parameters/fbheight )
# Start the window manager
matchbox-window-manager -use_titlebar no -use_cursor no &
# Start the browser
chromium --app=http://google.com
done;
@porjo
Copy link

porjo commented May 7, 2015

FYI, you're missing some text from the end of line 12 of rc.local - @.+/_GROUP=\1;_MODE=\2;_XRES=\3;_YRES=\4;/p' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment