X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=autorandr.py;h=9c272a79f05b8b199ae43580fe212bd3a569b7fd;hb=refs%2Fheads%2Fwork;hp=a5206c496c41d131205774d0959afab90bbcad35;hpb=2b87fc4cb3e80f79f9d1b723fec1e83857961908;p=deb_pkgs%2Fautorandr.git diff --git a/autorandr.py b/autorandr.py index a5206c4..9c272a7 100755 --- a/autorandr.py +++ b/autorandr.py @@ -4,7 +4,7 @@ # autorandr.py # Copyright (c) 2015, Phillip Berndt # -# Experimental autorandr rewrite in Python +# Autorandr rewrite in Python # # This script aims to be fully compatible with the original autorandr. # @@ -21,26 +21,42 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . # -# TODO Add virtual profiles common, horizontal, vertical -# This also requires to load all resolutions into the XrandrOutputs from __future__ import print_function -import copy -import getopt import binascii +import copy +import getopt import hashlib import os +import posix +import pwd import re import subprocess import sys +import shutil +import time -from itertools import chain from collections import OrderedDict +from distutils.version import LooseVersion as Version +from functools import reduce +from itertools import chain + +if sys.version_info.major == 2: + import ConfigParser as configparser +else: + import configparser + +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), ] @@ -48,87 +64,183 @@ virtual_profiles = [ help_text = """ Usage: autorandr [options] --h, --help get this small help --c, --change reload current setup --s, --save save your current setup to profile --l, --load load profile +-h, --help get this small help +-c, --change reload current setup -d, --default make profile the default profile ---force force (re)loading of a profile ---fingerprint fingerprint your current hardware setup ---config dump your current xrandr setup +-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 +--config dump your current xrandr setup +--debug enable verbose output --dry-run don't change anything, only print the xrandr commands - - To prevent a profile from being loaded, place a script call "block" in its - directory. The script is evaluated before the screen setup is inspected, and - in case of it returning a value of 0 the profile is skipped. This can be used - to query the status of a docking station you are about to leave. +--fingerprint fingerprint your current hardware setup +--force force (re)loading of a profile +--skip-options