1

I'm using a script like this to set the gamma values of my laptop screen and external monitor:

#!/bin/bash

export DISPLAY=:0
export XAUTHORITY=/home/peat/.Xauthority

xrandr --output LVDS1 --gamma 0.7:0.7:0.4
xrandr --output DP1--gamma 0.8:0.8:0.8  

Running it on startup or manually from the terminal works perfectly. However, when removing or plugging in a display, the gamma gets reset for all screens. I try to solve it by creating this udev rule in /etc/udev/rules.d/999_setMonitorGamma.rules:

SUBSYSTEM=="drm", ACTION=="change", RUN+="/home/peat/scripts/setMonitorGamma.sh"

At what point it almost works. I can see the screen flash with the correct gamma for a brief instant, then the incorrect gamma gets applied again. It seems like there's some sort of autodetection run after the udev rules get processed, that resets the display settings. How can I work around this?

Running Linux Mint 16, based on Ubuntu 13.10

  • Update: tried making another script run the script with the xrandr commands in the background (putting an ampersand & at the end, and also tried using nohup), but I can't get it to work properly. Even if I add some sleep in front of the xrandr bits, it'll wait until the sleep is over and the xrandr commands run until it tries to auto-configure the new display setup. – peat Jan 21 '14 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.