Created
July 11, 2013 20:29
-
-
Save WhyNotHugo/5978954 to your computer and use it in GitHub Desktop.
Script to run skype inside a restricted environment.
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 characters
| #!/bin/sh | |
| RESOLUTION=800x600 | |
| X_DISPLAY=7 | |
| # 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. | |
| sleep 1 | |
| export DISPLAY=:$X_DISPLAY | |
| xhost +SI:localuser:_skype | |
| 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 | |
| exit | |
| sudo -u _skype pkill -u _skype |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment