--- /dev/null
+configure_displays should be ran here:
+
+* On resume from suspend
+* On key press from window manager (shortcut) -- currently $mod+p in ~/.i3/config
+* On login startup -- currently ~/.i3/startup
+
+The simple /etc/pm/sleep.d/50_configure-displays script:
+----
+#!/bin/sh
+
+# Configure displays on resume and thaw
+
+case "$1" in
+ resume|thaw)
+ configure_displays
+ ;;
+esac
+----
#!/usr/bin/python
"""
-Parse xrandr current information
+Configure displays by looking at xrandr information
-TODO:
-* Cannot seem to undock notebook then recover displays without causing a logout
- event. Could it be that i3 is finding there are no displays?
+Select the best 1 or 2 xrandr outputs to use as displays, based on xrandr
+information, then reconfigure outputs via xrandr.
"""
import sys
return None
+def print_outputs(header, outputs):
+ print '%s:' % header
+ for output in outputs:
+ print_output(output)
+ print
+
+
+def all_done(outputs):
+ for output in outputs:
+ if not output['done']:
+ return False
+ return True
+
+
+def disable_an_entry(outputs):
+ for output in outputs:
+ if not output['done'] and not output['use'] and output['enabled']:
+ xrandr_off(output)
+ output['done'] = True
+ return 1
+ return 0
+
+
+def enable_an_entry(outputs):
+ enables = 0
+ for output in reversed(outputs):
+ if not output['done'] and output['use']:
+ xrandr_on(output)
+ output['done'] = True
+ return 1
+ return 0
+
+
if __name__ == '__main__':
def print_output(output):
print 'name:%s connected:%r enabled:%r width:%d height:%d pos:%dx%d' % (
output['width'], output['height'], output['posx'],
output['posy'])
- def print_outputs(header, outputs):
- print '%s:' % header
- for output in outputs:
- print_output(output)
- print
-
- def all_done(outputs):
- for output in outputs:
- if not output['done']:
- return False
- return True
-
- def disable_an_entry(outputs):
- for output in outputs:
- if not output['done'] and not output['use'] and output['enabled']:
- xrandr_off(output)
- output['done'] = True
- return 1
- return 0
-
- def enable_an_entry(outputs):
- enables = 0
- for output in reversed(outputs):
- if not output['done'] and output['use']:
- xrandr_on(output)
- output['done'] = True
- return 1
- return 0
-
def main(argv):
global dry_run
if len(argv) >= 2 and argv[1] == '--dry-run':