Created
May 2, 2014 17:37
Revisions
-
vain renamed this gist
May 2, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
vain created this gist
May 2, 2014 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,80 @@ #!/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