9

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.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255

6 Answers6

7

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

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

It works on xorg buy not Wayland.

Johan
  • 399
Campbell
  • 230
  • 1
    Please don't just post a link (and useless filler text); include some relevant detail so that there is sufficient context around the answer. – jasonwryan Nov 05 '13 at 22:13
  • 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. – lkraav Feb 07 '15 at 19:39
  • 1
    @jasonwryan "relevant detail": it works.:) This utility does exactly what OP was asking for. – VasyaNovikov Mar 19 '15 at 14:54
  • In my opinion short and sweet beats unnecessarily long-winded every day of the week. – Sam Watkins Jun 12 '15 at 01:49
  • @Campbell are you familiar with something similar working on Wayland rather than xorg? Feel free to join in. – Johan Apr 18 '23 at 07:53
4

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

konrad
  • 41
3

Try xcalib -d :0 -invert -alter

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

Lucian
  • 31
2

I was experiencing the same issue as the OP. I cloned the repo, installed the one dependency noted in the README, built and installed it, and it works great.

$ git clone https://github.com/zoltanp/xrandr-invert-colors.git
$ apt-get install libxcb-randr0-dev
$ make
$ sudo make install

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.

AdminBee
  • 22,803
  • Unfortunately, i realized a bit late it does not work with the Wayland windowing system that comes with Debian – Johan Apr 18 '23 at 11:19
1

The manpage indicates that there is a -screen (short -s) parameter. That should do it! Just use two xcalib commands with different -s parameters.

  • 2
    I know this. It does not work. Good you've mentioned about it, I've forgotten. I will update my problem statement. – Grzegorz Wierzowiecki Sep 13 '11 at 21:06
  • 2
    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. – rozcietrzewiacz Sep 13 '11 at 21:32
  • Unfortunately , when I do this, pivot on both screens does not work :(. Thank you for hint, now I know where to look for improvement. – Grzegorz Wierzowiecki Sep 13 '11 at 22:02
  • Did you try Option "Rotate" in your xorg.conf? Or do you need to rotate the screens after X is started? – rozcietrzewiacz Sep 16 '11 at 09:41
  • 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 Sep 18 '11 at 14:22
  • 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. – Grzegorz Wierzowiecki Sep 19 '11 at 19:40
  • 1
    I'm also looking for a solution, -s 1 doesn't work when dynamically adding screens with --output VGA1 --auto. – lkraav Jan 02 '12 at 22:11
  • 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 Jun 12 '15 at 01:46
0

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 ;) )