ramp-io

I wrote a simple program ramp-io, based on the redshift code, to read and write the xrandr gamma ramps for Linux / X11.  This enables me to define my own gamma ramps, and switch ramps quickly from the command line.  My preferred ramp is red-inv, dim inverse video with a low colour temperature (more red, less blue), and I set the LCD hardware brightness to maximum to reduce LED PWM flicker.  I find this is relatively easy on the eyes for work, compared to the normal glaring white backgrounds.

This entry was posted in Uncategorized. Bookmark the permalink.

1 Response to ramp-io

  1. Earl says:

    Thanks Sam. This helped me make a simple utility to set the colour temperature. It’s not as flexible as yours, but simple enough for my needs. Here’s the basic function:

    #include
    #include
    #include “gamma-randr.h”

    /**
    * Set colour temperature (1000-25000) and brightness (0.0-1.0) on all screens.
    */
    void set_colour_temperature(const int temperature_K, const float brightness)
    {
    randr_state_t _state;
    memset(&_state, 0, sizeof(_state));
    randr_state_t *state = &_state;

    printf(“Setting temp=%dK, brightness=%1.1f\n”, temperature_K, brightness);

    color_setting_t setting;
    setting.gamma[0]=1.0;
    setting.gamma[1]=1.0;
    setting.gamma[2]=1.0;
    setting.brightness=brightness;
    setting.temperature=temperature_K;

    if (randr_init(state) != 0)
    die(“failed: randr_init”);
    if (randr_start(state) != 0)
    die(“failed: randr_start”);
    state->crtc_num=-1; // set all screens
    randr_set_temperature(state, &setting);
    randr_free(state);
    }

Leave a Reply to Earl Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s