#!/usr/bin/env python3 # encoding: utf-8 # # autorandr.py # Copyright (c) 2015, Phillip Berndt # # Autorandr rewrite in Python # # This script aims to be fully compatible with the original autorandr. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # from __future__ import print_function import binascii import copy import getopt import hashlib import math import os import posix import pwd import re import shlex import subprocess import sys import shutil import time import glob from collections import OrderedDict from functools import reduce from itertools import chain if sys.version_info.major == 2: import ConfigParser as configparser else: import configparser __version__ = "1.15" try: input = raw_input except NameError: pass virtual_profiles = [ # (name, description, callback) ("off", "Disable all outputs", None), ("common", "Clone all connected outputs at the largest common resolution", None), ("clone-largest", "Clone all connected outputs with the largest resolution (scaled down if necessary)", None), ("horizontal", "Stack all connected outputs horizontally at their largest resolution", None), ("vertical", "Stack all connected outputs vertically at their largest resolution", None), ("horizontal-reverse", "Stack all connected outputs horizontally at their largest resolution in reverse order", None), ("vertical-reverse", "Stack all connected outputs vertically at their largest resolution in reverse order", None), ] properties = [ "Colorspace", "max bpc", "aspect ratio", "Broadcast RGB", "audio", "non-desktop", "TearFree", "underscan vborder", "underscan hborder", "underscan", "scaling mode", ] help_text = """ Usage: autorandr [options] -h, --help get this small help -c, --change automatically load the first detected profile -d, --default make profile the default profile -l, --load load profile -s, --save save your current setup to profile -r, --remove remove profile --batch run autorandr for all users with active X11 sessions --current only list current (active) configuration(s) --config dump your current xrandr setup --cycle automatically load the next detected profile --debug enable verbose output --detected only list detected (available) configuration(s) --dry-run don't change anything, only print the xrandr commands --fingerprint fingerprint your current hardware setup --ignore-lid treat outputs as connected even if their lids are closed --match-edid match displays based on edid instead of name --force force (re)loading of a profile / overwrite exiting files --list list configurations --skip-options