Howto: Change color profile on wake/resume in Linux Mint/Ubuntu

I’m trying out Linix Mint 14 on my Macbook Pro at the moment and while it is a huge step from my previous visits to the Linux world a few years ago there a still some issues. One was that the color-profile was set to default every time resumed the computer from sleep. But I’ve found a way around that:

First, install xcalib, a nice little program that can load color-profiles via xcalib PATH or /usr/bin/xcalib PATH in the terminal (xcalib -c resets the profile) and do a lot of other stuff.

Now place a script in /etc/pm/sleep.d/ that runs this line on wake/resume (see here for details). The problem is that the skript doesn’t get executed as it is because you have to specify the display and sudo the whole thing.

So the script in /etc/pm/sleep.d/ should look like this:

#!/bin/bash
case "$1" in
    thaw|resume)
        export DISPLAY=:0
        su -c - YOUR_USERNAME
        /usr/bin/xcalib "PATH_TO_PROFILE"
        ;;
    *)
        ;;
esac
exit $?

Anyway, that’s working for me.