From c3481c703fbb84666f0617631a3d5b5da597008b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 9 Oct 2016 15:09:37 +0300 Subject: Remove obsolete scripts --- scripts/auto-disp | 63 ------------------------------------------------------- 1 file changed, 63 deletions(-) delete mode 100644 scripts/auto-disp (limited to 'scripts/auto-disp') diff --git a/scripts/auto-disp b/scripts/auto-disp deleted file mode 100644 index 6e43a6f..0000000 --- a/scripts/auto-disp +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/python - - -import re - -import cliapp - - -class AutoDisp(cliapp.Application): - - lid = 'LVDS1' - externals = ['VGA1', 'HDMI1', 'DVI1', 'DP1'] - - def process_args(self, args): - out = self.runcmd(['xrandr', '-q']) - outputs = self.parse_outputs(out) - - got_internal = self.got_output(self.lid, outputs) - got_externals = [x - for x in self.externals - if self.got_output(x, outputs)] - - argv = ['xrandr'] - if got_externals: - res, name = max((outputs[x], x) for x in got_externals) - argv += ['--output', name, '--mode', '%dx%d' % res] - if got_internal: - argv += ['--output', self.lid, '--off'] - elif got_internal: - argv += ['--output', self.lid, - '--mode', '%dx%d' % outputs[self.lid]] - else: - raise cliapp.AppException('Oops, don\'t know what to do') - - self.runcmd(argv) - - def got_output(self, name, outputs): - return name in outputs - - def parse_outputs(self, xrandr): - output = re.compile(r'^(?P[A-Z0-9]+) connected ') - mode = re.compile(r'^ (?P\d+)x(?P\d+) ') - - result = {} - current = None - - lines = xrandr.splitlines() - for line in lines: - words = line.split() - output_match = output.match(line) - mode_match = mode.match(line) - if output_match: - current = output_match.group('output') - elif mode_match: - assert current is not None - x = int(mode_match.group('x')) - y = int(mode_match.group('y')) - prev = result.get(current, (0,0)) - result[current] = max((x,y), prev) - - return result - -AutoDisp().run() -- cgit v1.2.1