summaryrefslogtreecommitdiffstats
path: root/examples/crtc-detection
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-02-25 13:38:07 +0100
committerMattias Andrée <maandree@operamail.com>2014-02-25 13:38:07 +0100
commitd9856fa55dabe6927922a8cca08d6b1313bdf628 (patch)
tree66e65425826f9da12b2ef668233b4a4ef685b4ef /examples/crtc-detection
parentdoc output search functions (diff)
downloadblueshift-d9856fa55dabe6927922a8cca08d6b1313bdf628.tar.gz
blueshift-d9856fa55dabe6927922a8cca08d6b1313bdf628.tar.bz2
blueshift-d9856fa55dabe6927922a8cca08d6b1313bdf628.tar.xz
m bug + add example with output listing
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'examples/crtc-detection')
-rw-r--r--examples/crtc-detection34
1 files changed, 34 insertions, 0 deletions
diff --git a/examples/crtc-detection b/examples/crtc-detection
new file mode 100644
index 0000000..5f60d6c
--- /dev/null
+++ b/examples/crtc-detection
@@ -0,0 +1,34 @@
+# -*- python -*-
+
+# This example identifies which monitors you have plugged
+# in to the computer, and applied their proper calibration.
+
+
+# The colour temperature to apply.
+temp = 6500
+
+# List all connected outputs.
+outputs = list_screens().find_by_connected(True)
+
+# Configure each monitor.
+for output in outputs:
+ # Data that identifies the monitor.
+ monitor = (output.name, output.widthmm, output.heightmm)
+
+ # Default gamma settings.
+ r_gamma, g_gamma, b_gamma = 1, 1, 1
+
+ # Get the correct gamma settings for the monitor.
+ if monitor == ('DVI-0', 364, 291): r_gamma, g_gamma, b_gamma = 1.16, 1.15, 1.11
+ elif monitor == ('VGA-0', 364, 291): r_gamma, g_gamma, b_gamma = 1.10, 1.16, 1.10
+ else:
+ print('Warning: unknown monitor at %s at size of %i mm by %i mm' % monitor)
+
+ # Perform adjustments.
+ start_over()
+ temperature(temp, lambda t : divide_by_maximum(cmf_10deg(t)))
+ gamma(r_gamma, g_gamma, b_gamma)
+
+ # Apply adjustments.
+ randr(output.crtc, screen = output.screen)
+