Difference between revisions of "Compton"

From ArchWiki
Jump to: navigation, search
m
(one more formatting fix)
 
(91 intermediate revisions by 25 users not shown)
Line 1: Line 1:
[[Category:X Server]]
+
[[Category:X server]]
 
[[Category:Eye candy]]
 
[[Category:Eye candy]]
{{Article summary start}}
+
[[ja:Compton]]
{{Article summary text|Introduces chjj's fork of xcompmgr (fork of fork indeed).}}
+
[[ru:Compton]]
{{Article summary end}}
+
Compton is a standalone composite manager, suitable for use with [[window managers]] that do not natively provide compositing functionality. Compton is a fork of [http://oliwer.net/xcompmgr-dana/ xcompmgr-dana], which in turn is a fork of [[xcompmgr]]. See the [https://github.com/chjj/compton compton github page] for more information.
  
[https://github.com/chjj/compton Compton] is a fork of xcompmgr-dana by chjj, where xcompmgr-dana is a fork of xcompmgr by Dana.  It is therefore, like xcompmgr, a standalone composite manager and can be used as a companion to lightweight [[Window Manager|window managers]] which don't do composition on themselves.
+
== Installation ==
  
This fork fixed many bugs, and is very usable by this time of writing.
+
Install {{Pkg|compton}} or its [[git]] version, {{AUR|compton-git}}.
  
== Installation ==
+
== Use ==
Install the {{AUR|compton-git}} package, available in the [[AUR]].
+
 
 +
Compton may be manually enabled or disabled at any time during a session, or autostarted as a background ([[Daemon]]) process for sessions. There are also several optional arguments that may be used to tweak the compositing effects provided. These include:
 +
 
 +
* {{ic|-b}}: Run as a background ([[Daemon]]) process for a session (e.g. when autostarting for a [[window manager]] such as [[Openbox]])
 +
* {{ic|-c}}: Enable shadow effects
 +
* {{ic|-C}}: Disable shadow effects on panels and docks
 +
* {{ic|-G}}: Disable shadow effects for application windows and drag-and-drop objects
 +
* {{ic|--config}}: Use a specified configuration file
 +
 
 +
Many more options are available, including to set timing, displays to be managed, and the opacity of menus, window borders, and inactive application menus. See the [https://github.com/chjj/compton/blob/master/man/compton.1.asciidoc Compton Man Page] for further information.
 +
 
 +
=== Autostarting ===
 +
How compton would be autostarted as a [[Daemon]] process will depend on the [[desktop environment]] or [[window manager]] used. For example, for [[Openbox]] the {{ic|~/.config/openbox/autostart}} file must be edited, while for [[i3]] it would be the {{ic|~/.i3/config}} file. Where necessary, compton may also be autostarted from [[xprofile]] or [[Xinitrc]]. Read the [[startup files]] article for further information.
 +
 
 +
=== Command only ===
 +
To manually enable default compositing effects during a session, use the following command:
  
== Usage ==
 
To start manually, just run:
 
 
  $ compton
 
  $ compton
  
To use fancy shadows, you can run
+
Alternatively, to disable all shadowing effects during a session, the {{ic|-C}} and {{ic|-G}} arguments must be added:
$ compton -c
+
Additionally, -C can be used to avoid shadows on panels and docks, and -G can be used to avoid shadows on drag-and-drop objects (you probably want this).
+
  
If you want it started automatically, put this in [[xprofile]]:
+
$ compton -CG
  
compton -cGb
+
To autostart compton as a background ([[Daemon]]) process for a session, the {{ic|-b}} argument must be used:
  
where -b means to daemonize after composite manager registered.
+
compton -b
  
You can also put your configuration in a file {{ic|~/.config/compton.conf}} or {{ic|~/.compton.conf}}.
+
To disable all shadowing effects from the [[Daemon]] process, the {{ic|-C}} and {{ic|-G}} arguments must again be added:
  
A sample configuration file.
+
compton -CGb
  
{{hc|~/.compton.conf|2=
+
Finally, this is an example where additional arguments that require values to be set have been used:
# Shadow
+
shadow = true; # Enabled client-side shadows on windows.
+
no-dock-shadow = true; # Avoid drawing shadows on dock/panel windows.
+
no-dnd-shadow = true; # Don't draw shadows on DND windows.
+
clear-shadow = true; # Zero the part of the shadow's mask behind the window (experimental).
+
shadow-radius = 7; # The blur radius for shadows. (default 12)
+
shadow-offset-x = -7; # The left offset for shadows. (default -15)
+
shadow-offset-y = -7; # The top offset for shadows. (default -15)
+
# shadow-opacity = 0.7; # The translucency for shadows. (default .75)
+
# shadow-red = 0.0; # Red color value of shadow. (0.0 - 1.0, defaults to 0)
+
# shadow-green = 0.0; # Green color value of shadow. (0.0 - 1.0, defaults to 0)
+
# shadow-blue = 0.0; # Blue color value of shadow. (0.0 - 1.0, defaults to 0)
+
shadow-exclude = [ "n:e:Notification" ]; # Exclude conditions for shadows.
+
# shadow-exclude = "n:e:Notification";
+
shadow-ignore-shaped = true;
+
  
# Opacity
+
compton -cCGfF -o 0.38 -O 200 -I 200 -t 0 -l 0 -r 3 -D2 -m 0.88
menu-opacity = 0.9; # The opacity for menus. (default 1.0)
+
inactive-opacity = 0.9; # Opacity of inactive windows. (0.1 - 1.0)
+
#frame-opacity = 0.8; # Opacity of window titlebars and borders. (0.1 - 1.0)
+
inactive-opacity-override = true; # Inactive opacity set by 'inactive-opacity' overrides value of _NET_WM_OPACITY.
+
  
# Fading
+
=== Using a configuration file ===
fading = true; # Fade windows during opacity changes.
+
# fade-delta = 30; # The time between steps in a fade in milliseconds. (default 10).
+
fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
+
fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
+
# no-fading-openclose = true; # Fade windows in/out when opening/closing.
+
  
# Other
+
To use a custom configuration file with compton during a session, use the following command:
#inactive-dim = 0.5; # Dim inactive windows. (0.0 - 1.0, defaults to 0).
+
mark-wmwin-focused = true; # Try to detect WM windows and mark them as active.
+
mark-ovredir-focused = true;
+
detect-rounded-corners = true;
+
  
# Window type settings
+
compton --config <path/to/compton.conf>
wintypes:
+
{
+
  tooltip = { fade = true; shadow = false; opacity = 0.75; };
+
};
+
}}
+
  
To run compton with config file:
+
To auto-start compton as a background ([[Daemon]]) process for a session, the {{ic|-b}} argument must again be used:
  
  $ compton --config ~/.compton.conf
+
  compton --config <path/to/compton.conf> -b
  
To automatically start compton put following in any of your [[Startup files]]:
+
It is recommended to either create the configuration file in the hidden {{ic|~/.config}} directory ({{ic|~/.config/compton.conf}}) or as a hidden file in the {{ic|Home}} directory ({{ic|~/.compton.conf}}). A sample config file can be found here: [https://github.com/chjj/compton/blob/master/compton.sample.conf Compton Sample Config]
  
compton --config ~/.compton.conf -b
+
==== Disable shadowing of some windows ====
  
== Transparency ==
+
Due to the way compton draws its shadows, certain applications will have visual glitches when you have shadows enabled. The {{ic|shadow-exclude}} options could disable compton shadows.
Besides what is provided in xcompmgr, compton introduces two new auto-transparency options:
+
  
      -i opacity
+
For example, to disable Compton shadows on all GTK +3 windows, add below setting to {{ic|shadow-exclude}} in {{ic|compton.conf}}:
              Specifies inactive window transparency. (0.1 - 1.0)
+
"_GTK_FRAME_EXTENTS@:c"
      -e opacity
+
              Specifies window frame transparency. (0.1 - 1.0)
+
  
Try them out on your own.
+
To disable shadows around [[conky]] windows - where used - first amend the conky configuration file {{ic|~/.conkyrc}} as follows:
  
=== Problem with slock ===
+
own_window_class conky
  
Note that inactive window transparency (-i option) will make all inactive window became transparent, and if you use {{Pkg|slock}} it may not be a good result. Try this in config file instead:
+
Then amend the compton configuration file as follows:
  
  inactive-dim = 0.2;
+
  shadow-exclude = "class_g = 'conky'";
  
This will work with slock better.
+
For currently disabled windows, please see [https://projects.archlinux.org/svntogit/community.git/tree/trunk/compton.conf?h=packages/compton#n80 here].
  
 
== Multihead ==
 
== Multihead ==
 
+
If a [[multihead]] configuration is used without xinerama - meaning that X server is started with more than one screen - then compton will start on only one screen by default. It can be started on all screens by using the {{ic|-d}} argument. For example, compton can be executed for 4 monitors with the following command:
If you use a [[multihead]] configuration without Xinerama, which means you start a X server with more than one screen, then compton will start on only one screen by default. You can start on all screen by starting multiple compton on all screens with -d. For example, if you have 4 monitors then you can start compton by:
+
  
 
  seq 0 3 | xargs -l1 -I@ compton -b -d :0.@
 
  seq 0 3 | xargs -l1 -I@ compton -b -d :0.@
 +
 +
== Troubleshooting ==
 +
The use of compositing effects may on occasion cause issues such as visual glitches when not configured correctly for use with other applications and programs.
 +
 +
=== slock ===
 +
 +
Where inactive window transparency has been enabled (the {{ic|-i}}
 +
argument when running as a command), this may provide troublesome
 +
results when also using [[slock]]. One solution is to amend the
 +
transparency to {{ic|0.2}}. For example, where running compton arguments
 +
as a command:
 +
 +
$ compton <any other arguments> -i 0.2
 +
 +
Otherwise, where using a configuration file:
 +
 +
inactive-dim = 0.2;
 +
 +
Alternatively, you may try to exclude slock by its window id, or by
 +
excluding all windows with no name.
 +
{{note|Some programs change their id for every new instance, but slock's appears to be static. Someone more knowledgeable will have to confirm that slock's id is in fact static- until then, use at your own risk.}}
 +
Exclude all windows with no name from compton using the following
 +
options:
 +
$ compton <other arguments> --focus-exclude "! name~=''"
 +
Find your slock's window id by running the command:
 +
$ xwininfo & slock
 +
Quickly click anywhere on the screen (before slock exits), then type
 +
your password to unlock. You should see the window id in the output:
 +
xwininfo: Window id: 0x1800001 (has no name)
 +
Take the window id and exclude it from compton with:
 +
$ compton <any other arguments> --focus-exclude 'id = 0x1800001'
 +
Otherwise, where using a configuration file:
 +
focus-exclude = "id = 0x1800001";
 +
 +
=== dwm & dmenu===
 +
dwm's statusbar is not detected by any of compton's functions to automatically exclude window manager elements. Neither dwm statusbar nor dmenu have a static window id. If you want to exclude it from inactive window transparency (or other), you'll have to either patch a window class into the source code of each, or exclude by less precise attributes. I have dmenu and dwm's status on top, which allows me to write a resolution independent location exclusion.
 +
$ compton <any other arguments> --focus-exclude "x = 0 && y = 0 && override_redirect = true"
 +
Otherwise, where using a configuration file:
 +
focus-exclude = "x = 0 && y = 0 && override_redirect = true";
 +
The override redirect property seems to be false for most windows- having this in the exclusion rule prevents other windows drawn in the upper left corner from being excluded (for example, when dwm statusbar is hidden, x0 y0 will match whatever is in dwm's master stack).
 +
 +
=== Unable to change the background color with xsetroot ===
 +
Currently, compton is incompatible with {{ic|xsetroot}}'s {{ic|-solid}} option, a workaround is to use {{aur|hsetroot}} to set the background color:
 +
 +
$ hsetroot -solid '#000000'
 +
 +
For a detailed explaination, please see https://github.com/chjj/compton/issues/162.
 +
 +
=== Screen artifacts/screenshot issues when using AMD's Catalyst driver ===
 +
Try running compton with
 +
 +
--backend xrender
 +
 +
or adding
 +
 +
backend = "xrender";
 +
 +
to your compton.conf file.
 +
 +
For more info, please see https://github.com/chjj/compton/issues/208
 +
 +
=== High CPU use with nvidia drivers ===
 +
 +
When facing high CPU use with {{ic|--backend glx}} or tearing with {{ic|--vsync}} enabled, [[install]] {{Pkg|nvidia-libgl}} as described in [[NVIDIA]].
 +
 +
== See also ==
 +
 +
*[http://ubuntuforums.org/showthread.php?t=2144468&p=12644745#post12644745 Howto: Using Compton for tear-free compositing on XFCE or LXDE]

Latest revision as of 01:29, 29 March 2016

Compton is a standalone composite manager, suitable for use with window managers that do not natively provide compositing functionality. Compton is a fork of xcompmgr-dana, which in turn is a fork of xcompmgr. See the compton github page for more information.

Installation

Install compton or its git version, compton-gitAUR.

Use

Compton may be manually enabled or disabled at any time during a session, or autostarted as a background (Daemon) process for sessions. There are also several optional arguments that may be used to tweak the compositing effects provided. These include:

  • -b: Run as a background (Daemon) process for a session (e.g. when autostarting for a window manager such as Openbox)
  • -c: Enable shadow effects
  • -C: Disable shadow effects on panels and docks
  • -G: Disable shadow effects for application windows and drag-and-drop objects
  • --config: Use a specified configuration file

Many more options are available, including to set timing, displays to be managed, and the opacity of menus, window borders, and inactive application menus. See the Compton Man Page for further information.

Autostarting

How compton would be autostarted as a Daemon process will depend on the desktop environment or window manager used. For example, for Openbox the ~/.config/openbox/autostart file must be edited, while for i3 it would be the ~/.i3/config file. Where necessary, compton may also be autostarted from xprofile or Xinitrc. Read the startup files article for further information.

Command only

To manually enable default compositing effects during a session, use the following command:

$ compton

Alternatively, to disable all shadowing effects during a session, the -C and -G arguments must be added:

$ compton -CG

To autostart compton as a background (Daemon) process for a session, the -b argument must be used:

compton -b

To disable all shadowing effects from the Daemon process, the -C and -G arguments must again be added:

compton -CGb

Finally, this is an example where additional arguments that require values to be set have been used:

compton -cCGfF -o 0.38 -O 200 -I 200 -t 0 -l 0 -r 3 -D2 -m 0.88

Using a configuration file

To use a custom configuration file with compton during a session, use the following command:

compton --config <path/to/compton.conf>

To auto-start compton as a background (Daemon) process for a session, the -b argument must again be used:

compton --config <path/to/compton.conf> -b

It is recommended to either create the configuration file in the hidden ~/.config directory (~/.config/compton.conf) or as a hidden file in the Home directory (~/.compton.conf). A sample config file can be found here: Compton Sample Config

Disable shadowing of some windows

Due to the way compton draws its shadows, certain applications will have visual glitches when you have shadows enabled. The shadow-exclude options could disable compton shadows.

For example, to disable Compton shadows on all GTK +3 windows, add below setting to shadow-exclude in compton.conf:

"_GTK_FRAME_EXTENTS@:c"

To disable shadows around conky windows - where used - first amend the conky configuration file ~/.conkyrc as follows:

own_window_class conky

Then amend the compton configuration file as follows:

shadow-exclude = "class_g = 'conky'";

For currently disabled windows, please see here.

Multihead

If a multihead configuration is used without xinerama - meaning that X server is started with more than one screen - then compton will start on only one screen by default. It can be started on all screens by using the -d argument. For example, compton can be executed for 4 monitors with the following command:

seq 0 3 | xargs -l1 -I@ compton -b -d :0.@

Troubleshooting

The use of compositing effects may on occasion cause issues such as visual glitches when not configured correctly for use with other applications and programs.

slock

Where inactive window transparency has been enabled (the -i argument when running as a command), this may provide troublesome results when also using slock. One solution is to amend the transparency to 0.2. For example, where running compton arguments as a command:

$ compton <any other arguments> -i 0.2

Otherwise, where using a configuration file:

inactive-dim = 0.2;

Alternatively, you may try to exclude slock by its window id, or by excluding all windows with no name.

Note: Some programs change their id for every new instance, but slock's appears to be static. Someone more knowledgeable will have to confirm that slock's id is in fact static- until then, use at your own risk.

Exclude all windows with no name from compton using the following options:

$ compton <other arguments> --focus-exclude "! name~="

Find your slock's window id by running the command:

$ xwininfo & slock

Quickly click anywhere on the screen (before slock exits), then type your password to unlock. You should see the window id in the output:

xwininfo: Window id: 0x1800001 (has no name)

Take the window id and exclude it from compton with:

$ compton <any other arguments> --focus-exclude 'id = 0x1800001'

Otherwise, where using a configuration file:

focus-exclude = "id = 0x1800001";

dwm & dmenu

dwm's statusbar is not detected by any of compton's functions to automatically exclude window manager elements. Neither dwm statusbar nor dmenu have a static window id. If you want to exclude it from inactive window transparency (or other), you'll have to either patch a window class into the source code of each, or exclude by less precise attributes. I have dmenu and dwm's status on top, which allows me to write a resolution independent location exclusion.

$ compton <any other arguments> --focus-exclude "x = 0 && y = 0 && override_redirect = true"

Otherwise, where using a configuration file:

focus-exclude = "x = 0 && y = 0 && override_redirect = true";

The override redirect property seems to be false for most windows- having this in the exclusion rule prevents other windows drawn in the upper left corner from being excluded (for example, when dwm statusbar is hidden, x0 y0 will match whatever is in dwm's master stack).

Unable to change the background color with xsetroot

Currently, compton is incompatible with xsetroot's -solid option, a workaround is to use hsetrootAUR to set the background color:

$ hsetroot -solid '#000000'

For a detailed explaination, please see https://github.com/chjj/compton/issues/162.

Screen artifacts/screenshot issues when using AMD's Catalyst driver

Try running compton with

--backend xrender

or adding

backend = "xrender";

to your compton.conf file.

For more info, please see https://github.com/chjj/compton/issues/208

High CPU use with nvidia drivers

When facing high CPU use with --backend glx or tearing with --vsync enabled, install nvidia-libgl as described in NVIDIA.

See also