Invert colours on Dual-Screen / Dual-Monitor setup?

5,246

Solution 1

I've found that advice :

http://ubuntuforums.org/showthread.php?t=1482995

of using "Desktop Effects" (I have such in KDE), there is one that allows of inverting colours of all screens or just selective windows.

Since on my current hardware Compiz or similar stuff works fine, I can take advantage of such "Desktop Effects". However I wonder, how to use such on other window managers (like fluxbox)... but that's topic for separate question :). (P.S. after taking some look into sources of that effect: kwin/.../invert.cpp it looks like it's just adding hooks for processing windows rendered in separate buffers at it's done in compositing window managers, so maybe only KWin is required, with ability to run with other things than KDE - to be experimented ;) )

Solution 2

Here is a small utility program that does what you want:

https://github.com/zoltanp/xrandr-invert-colors

Solution 3

One could try fiddling with negative gamma-values and brightness-values < 1 to generate a negative gamma-ramp on a specific output.

xrandr --output [output] --gamma -0.5:-0.5:-0.5 --brightness 0.1 

this suffices at least to me and works out of the box, but does not take into account any existing gamma-curves for an output. might be worth a shot. Greetings konrad

Solution 4

Try xcalib -d :0 -invert -alter

The -d option refers to the device, and it worked for me when -s didn't

Solution 5

I was experiencing the same issue as the OP. I did a

git clone https://github.com/zoltanp/xrandr-invert-colors.git

Then I installed the one dependency noted in the README, built and installed it, and it works great. Problem solved.

I took a look at the source code. The bulk of the work is done with a call into the xcb library to set the gamma ramp. The code essentially loops over the number of attached screens, creates a gamma ramp, inverts it, and sets it on that screen. Very simple, and there's no other X program that does this, to my knowledge.

Share:
5,246

Related videos on Youtube

Grzegorz Wierzowiecki
Author by

Grzegorz Wierzowiecki

Updated on September 18, 2022

Comments

  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 1 year

    In order to invert colours on monitor, I invoke:

    xcalib -invert -alter
    

    The problem is, that on Dual-Monitor setup it inverts colors only on first screen.

    I can not use Compitz gadgets for color inverting, cause my setup is

    • Two rotated (pivot) Monitors

    Dual-Screen when both are Piovot is not working with composing on my card.

    Xorg seems only solution.

    xcalib is great cause I can switch depending on app, immediately.

    Cany suggestions, solutions how to invert colors on both screens with xcalib ?

    P.S.

    -screen parameter does not work:

    X Error of failed request:  BadValue (integer parameter out of range for operation)
      Major opcode of failed request:  130 (XFree86-VidModeExtension)
      Minor opcode of failed request:  19 (XF86VidModeGetGammaRampSize)
      Value in failed request:  0x17
      Serial number of failed request:  10
      Current serial number in output stream:  10
    

    Here is my xrandr screen configuration:

    ~$ xrandr                                                                                                                                                              
    Screen 0: minimum 320 x 200, current 2400 x 1920, maximum 3840 x 3840                                                                                                  
    DFP1 connected 1200x1920+1200+0 left (normal left inverted right x axis y axis) 518mm x 324mm                                                                          
       1920x1200      60.0*+                                                                                                                                               
       1680x1050      60.0 +                                                                                                                                               
       1440x900       59.9 +                                                                                                                                               
       1280x800       60.0 +                                                                                                                                               
       1920x1080      60.0     50.0     30.0     25.0     24.0                                                                                                             
    (...)                                                                                                                   
    DFP2 connected 1200x1920+0+0 left (normal left inverted right x axis y axis) 518mm x 324mm                                                                             
       1920x1200      60.0*+                                                                                                                                               
       1920x1080      60.0 +                                                                                                                                               
       1776x1000      60.0 +                                                                                                                                               
       1680x1050      60.0 +                                                                                                                                               
       1440x900       59.9 +                                                                                                                                               
       1280x800       60.0 +   75.0                                                                                                                                        
       1152x648       60.0 +                                                                                                                                               
       1600x1200      60.0                                                                                                                                                 
       1400x1050      60.0                                                                                                                                                 
       1280x1024      75.0     60.0                                                                                                                                        
    (...)                                                                        
    CRT1 disconnected (normal left inverted right x axis y axis)                                                                                                           
    CRT2 disconnected (normal left inverted right x axis y axis)   
    

    As you can see, they are rotated - 1200x1920 setup on one virtual screen with maximum 3840 x 3840. I think, that's reason why it's like "one" screen with 2400x1920, splitted on both (so, xcalib applies only to primary one). But, it's only my hypothesis, maybe reason is different.

  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    I know this. It does not work. Good you've mentioned about it, I've forgotten. I will update my problem statement.
  • rozcietrzewiacz
    rozcietrzewiacz over 12 years
    Your xrandr output says you have the Xorg configured as one screen (only Screen 0 at the top). xcalib interfaces directly with Xorg server, so it can't see more screens. I believe you need to configure multiple Screen sections in your /etc/X11/xorg.conf for this to work properly.
  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    Unfortunately , when I do this, pivot on both screens does not work :(. Thank you for hint, now I know where to look for improvement.
  • rozcietrzewiacz
    rozcietrzewiacz over 12 years
    Did you try Option "Rotate" in your xorg.conf? Or do you need to rotate the screens after X is started?
  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    I need to rotate after X started with xrandr. However I've diggeged deeply into topic, it was in on beginning of 2011, now it might work with different conf. Thanks for help, I will try setting up "option rotate" in mean time. :).
  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 12 years
    Just to let you know, I just check-ed out my setup. I have RV710 [Radeon HD 4350] connected to Two Dell U2410f thought DVI and HDMI outputs. Opensource drivers (xf86-video-ati) can not do Rotation ("Crc 0" error). New Catalyst as well. So I have to use Old Catalyst drivers: 11.8-1 with one virtual-screen, on which I can place my monitors with xrandr. (Btw. catalyst drivers gives me amdstrem gpgpu computation possibilities). I hope, some day, opensource ATI drivers will support multihead with rotation.
  • lkraav
    lkraav over 12 years
    I'm also looking for a solution, -s 1 doesn't work when dynamically adding screens with --output VGA1 --auto.
  • Grzegorz Wierzowiecki
    Grzegorz Wierzowiecki over 11 years
    In my case it does not help... -d :1 -> Can't open display :1 etc.
  • Cyker
    Cyker over 11 years
    -d refers to the display, not the device. BTW, I encountered the same problem and would like to know the solution.
  • jasonwryan
    jasonwryan over 10 years
    Please don't just post a link (and useless filler text); include some relevant detail so that there is sufficient context around the answer.
  • lkraav
    lkraav about 9 years
    While @jasonwryan is right about the answer quality, I can confirm xrandr-invert-colors works. It's time to throw the unmaintained xcalib out ot the window and herald the new champion.
  • VasyaNovikov
    VasyaNovikov about 9 years
    @jasonwryan "relevant detail": it works.:) This utility does exactly what OP was asking for.
  • Sam Watkins
    Sam Watkins almost 9 years
    Why did you accept this answer, when as you said it does not work? The "xrandr-invert-colors" answer from Campbell is the best one.
  • Sam Watkins
    Sam Watkins almost 9 years
    In my opinion short and sweet beats unnecessarily long-winded every day of the week.