Created
September 27, 2018 16:28
-
-
Save ek-nath/4ee5bfb04f99816eb4e4221d153a0bca to your computer and use it in GitHub Desktop.
Ubuntu monitor/display switcher
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
#!/usr/bin/env python3 | |
import sys | |
import os | |
# 1. Run `xrandr -q | grep connected` to identify what the correct display IDs are | |
# 2. set keyboard shortcuts like <ctrl>+<super>+<alt>+1 to call /home/username/set_display.py desktop | |
if len(sys.argv) <= 1: | |
sys.argv.append("all") | |
if sys.argv[1].strip() == "laptop": | |
COMMAND = "xrandr --output eDP1 --auto --output DP1-2 --off" | |
elif sys.argv[1].strip() == "desktop": | |
COMMAND = "xrandr --output eDP1 --off --output DP1-2 --auto" | |
else: | |
COMMAND = "xrandr --output eDP1 --auto --output DP1-2 --auto" | |
os.system(COMMAND) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment