Created
May 2, 2014 17:37
-
-
Save vain/00b3d09bd84f74f12cd5 to your computer and use it in GitHub Desktop.
vnc-box
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#launch_screen() | |
#{ | |
# # Xvfb + x11vnc | |
# | |
# ( | |
# screen=$1 | |
# | |
# Xvfb :$screen -screen 0 1024x768x24 & | |
# while ! netstat -tulpen | grep ":$((6000 + screen)).*LISTEN.*Xvfb" | |
# do | |
# sleep 1 | |
# done | |
# x11vnc -display :$screen -N -shared -forever | |
# ) & | |
#} | |
launch_screen() | |
{ | |
# Requires tightvnc or tigervnc but is a lot faster | |
( | |
screen=$1 | |
Xvnc :$screen \ | |
-geometry 1024x768 -depth 24 \ | |
-alwaysshared | |
) & | |
} | |
launch_program() | |
{ | |
# Run a command in the given screen and try to isolate it as much as | |
# possible by building a new temporary home directory. This is | |
# necessary for a lot of "modern" software that tries to detect if | |
# it's already running (yes, it may be, but on another screen!). | |
( | |
screen=$1 | |
cmd=$2 | |
new_home=$(mktemp -d) | |
shopt -s dotglob | |
cp -av ~/* "$new_home" | |
env -i HOME="$new_home" DISPLAY=":$screen" \ | |
XDG_DATA_HOME="$new_home/.local/share" \ | |
XDG_CONFIG_HOME="$new_home/.config" \ | |
XDG_CACHE_HOME="$new_home/.cache" \ | |
sh -c "openbox& openbox=\$!; cd; { $cmd; }; kill \$openbox" | |
rm -Rfv "$new_home" | |
) & | |
} | |
initial_session_and_stuff() | |
{ | |
for i in {1..20} | |
do | |
launch_screen $i | |
done | |
launch_program 1 "xterm" | |
launch_program 2 "chromium-browser --kiosk --disable-translate google.de" | |
launch_program 3 "chromium-browser --kiosk --disable-translate heise.de" | |
launch_program 4 "chromium-browser --disable-translate heise.de & xterm" | |
launch_program 5 "firefox http://github.com/vain" | |
wait | |
} | |
# Run this script with the following argument to get things running (I | |
# do this in /etc/rc.local). Afterwards, you can simply source it in | |
# your interactive shell and use launch_program() interactively. | |
if [[ $1 == initial ]] | |
then | |
initial_session_and_stuff | |
fi |
An interesting alternative to Xvfb: http://xpra.org/trac/wiki/Xdummy -- stock X with a dummy driver, RANDR works
Got tired of full-blown browsers. They're not made for this job.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
chromium-browser --kiosk
is fscked up in Ubuntu 14.04 because Chromium now uses its own "Aura" instead of Gtk. Aura throws errors in a VNC environment:Chromium runs, only kiosk mode is broken.
Might be an alternative:
dwb -x fullscreen -x bars www.some-url.com
(as long as you don't use it interactively... dwb has a keyboard-driven vi-style interface)