Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@yorickpeterse
Created October 13, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yorickpeterse/842aeec7bc30cfa2e27b to your computer and use it in GitHub Desktop.
Save yorickpeterse/842aeec7bc30cfa2e27b to your computer and use it in GitHub Desktop.
function external-monitor -d 'Enable/disable external monitor'
if [ "$argv[1]" = "on" ]
echo 'Starting bumblebeed...'
sudo systemctl start bumblebeed
echo 'Enabling discrete GPU...'
echo ON | sudo tee /proc/acpi/bbswitch
optirun true
intel-virtual-output
# redshift doesn't detect the external screen
env DISPLAY=':8' redshift -o -c ~/.config/redshift.conf
xrandr --output VIRTUAL3 --primary --mode VIRTUAL3.639-1920x1080 \
--pos 0x0 --rotate normal --output LVDS1 --off --output VGA1 --off
else
echo 'Disabling optmius...'
xrandr --output VIRTUAL3 --off --output LVDS1 --primary \
--mode 1600x900 --pos 0x0 --rotate normal
set pid (ps aux | grep -iP 'xorg.+bumblebee' | grep -v grep | awk '{print $2}')
if [ "$pid" != "" ]
sudo kill -15 $pid
end
echo 'Stopping bumblebeed...'
sudo systemctl stop bumblebeed
echo 'Unloading drivers...'
sudo rmmod nvidia
echo 'Disabling discrete GPU...'
echo OFF | sudo tee /proc/acpi/bbswitch
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment