Instantly share code, notes, and snippets.

What would you like to do?
optirun and wine (on Ubuntu precise 12.04 64-bit)
# This is a short script to load applications using bumblebee and wine
# on systems such as Ubuntu precise 12.04 64 bit using the discrete card.
# Usage example (the -opengl would be a parameter of the program "Frozen Throne.exe"):
# "Frozen Throne.exe" -opengl
# Extra information:
# If you want to load programs with the integrated intel card instead, you may run them this way:
# LD_LIBRARY_PATH="/usr/lib/i386-linux-gnu/mesa/" wine "Frozen Throne.exe" -opengl
function msg {
# Description:
# This function echoes-with-colors the arguments passed in
# Usage:
# msg 'whatever you want to print :)'
echo -e '\033[33m\033[44m'$@'\033[0m'
if [ "$1" == "RECALLED_WITH_OPTIRUN" ]; then
#we are being run with optirun :)
msg "$0 starting"
LD_LIBRARY_PATH="/usr/lib32/nvidia-current/" wine "$@"
#wait while all wine programs are running, until they terminate
wineserver -w
msg "wineserver has terminated"
msg "$0 terminating"
exit 0
#This scripts needs to be called through optirun.
#In order to garantee it, we re-execute using optirun
exec optirun $0 RECALLED_WITH_OPTIRUN "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment