#!/bin/bash
# Use vga_switcheroo to switch between discrete and internal card.
# author : nah
# licence : WTFPL

case "$1" in

radeon)
        #radeon is known as discrete (external) card
        echo DDIS > /sys/kernel/debug/vgaswitcheroo/switch
        echo "You must restart Xorg for applying changes"
;;
intel)
        #intel is known as integrated (internal) card
        echo DIGD > /sys/kernel/debug/vgaswitcheroo/switch
        echo "You must restart Xorg for applying changes"
;;

*)
        echo "switch between video cards"
        echo "use : $0 command"
        echo "where command is :"
        echo "  radeon"
        echo "  intel"
esac

if [ $TERM = 'xterm' ]
then
	echo "Press any key"
	read
fi
