Created
October 13, 2015 14:14
-
-
Save yorickpeterse/842aeec7bc30cfa2e27b to your computer and use it in GitHub Desktop.
This file contains 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
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