# Save the current keyboard layout, since we want to configure Xephyr
# to use the same
LAYOUT=$(setxkbmap -query | grep layout | cut -d" " -f6)
Xephyr -screen $RESOLUTION -host-cursor -br :$X_DISPLAY &
# Sleep a second while Xephyr start.
# FIXME: There's probably a more elegant way to know when it has finished
# starting up.
sudo -u _skype setxkbmap -layout $LAYOUT
# Use some lightwight WM because we'll be unable to switch windows otherwise.
sudo -u _skype blackbox &
# Use a tray or we'll loose access to skype when we close the main window.
sudo -u _skype trayer --align right --width 5 &
# Launch Skype
sudo -u _skype /var/skype/skype
# After skype exits, clean everything else
# FIXME: Check which signal to use, because sometimes you kill Xephyr, but it
# doesn't release the DISPLAY
sudo -u _skype pkill -u _skype