2011-11-04 14:52:05 -04:00
# Compton
__Compton__ is a compositor for X, and a fork of __xcompmgr-dana__ .
I was frustrated by the low amount of standalone lightweight compositors.
Compton was forked from Dana Jansens' fork of xcompmgr and refactored. I fixed
whatever bug I found, and added features I wanted. Things seem stable, but don't
quote me on it. I will most likely be actively working on this until I get the
features I want. This is also a learning experience for me. That is, I'm
partially doing this out of a desire to learn Xlib.
## Changes from xcompmgr:
* __inactive window transparency__ (specified with `-i` )
2011-11-05 23:33:50 -04:00
* __titlebar/frame transparency__ (specified with `-e` )
2011-11-06 20:29:23 -05:00
* menu transparency (thanks to Dana)
2011-11-04 14:52:05 -04:00
* shadows are now enabled for argb windows, e.g. terminals with transparency
* removed serverside shadows (and simple compositing) to clean the code,
the only option that remains is clientside shadows
2012-10-22 08:41:24 -04:00
* configuration files (specified with `--config` )
* colored shadows (with `--shadow-[red/green/blue] value` )
* a new fade system
* vsync (still under development)
* several more options
2011-11-05 23:33:50 -04:00
2011-11-04 14:52:05 -04:00
## Fixes from the original xcompmgr:
* fixed a segfault when opening certain window types
* fixed a memory leak caused by not freeing up shadows (from the freedesktop
repo)
2012-10-22 08:41:24 -04:00
* fixed the conflict with chromium and similar windows
* [many more ](https://github.com/chjj/compton/issues )
2011-11-04 14:52:05 -04:00
## Building
### Dependencies:
2012-03-17 21:17:08 -04:00
__B__ for build-time
__R__ for runtime
* libx11 (B,R)
* libxcomposite (B,R)
* libxdamage (B,R)
* libxfixes (B,R)
2012-09-11 09:33:03 -04:00
* libXext (B,R)
2012-03-17 21:17:08 -04:00
* libxrender (B,R)
Feature: #7: VSync
- Add VSync feature. 3 possible VSync methods available: "sw" (software,
not too reliable, but at least you have something to fallback to),
"drm" (using DRM_IOCTL_WAIT_VBLANK, should work only on DRI drivers),
"opengl" (using SGI_swap_control extension OpenGL, might work on more
drivers than the DRM method). "sw" and "opengl" are briefly tested,
"drm" received utterly no test (because I use the nVidia binary blob).
They are enabled with "--vsync sw" / "--vsync drm" / "--vsync opengl".
- Add --refresh-rate to let user specify a refresh rate for software
VSync, in case the automatic refresh rate detection does not work
well.
- Seemingly the automatic refresh rate detection using X RandR in
software VSync detects refresh rate incorrectly. Need further investigation.
- Fix a few bugs in fading timing.
- Add a workaround for client window detection on Fluxbox, as Fluxbox
(incorrectly?) sets the override-redirect flag upon all frame
windows.
- Software VSync adds dependency on librt (a part of glibc) for
nanosecond-level timing functions, and libXrandr for automatic refresh
rate detection; DRM VSync adds dependency on libdrm to use its drm.h,
but does not link to libdrm; OpenGL VSync adds dependency on libGL.
- Print timing information on DEBUG_REPAINT.
2012-10-07 22:20:01 -04:00
* libXrandr (B,R)
2012-03-17 21:17:08 -04:00
* pkg-config (B)
* make (B)
* xproto / x11proto (B)
* bash (R)
* xprop,xwininfo / x11-utils (R)
Feature: Issue #29: Alternative shadow blacklist implementation
- Add shadow blacklist feature, but a different implementation from
nicklan's. 5 matching modes (exact, starts-with, contains, wildcard,
PCRE) and 3 matching targets (window name, window class instance,
window general class). Not extensively tested, bugs to be expected.
It's slower for exact matching than nicklan's as it uses linear search
instead of hash table. Also, PCRE's JIT optimization may cause issues
on PaX kernels.
- Add dependency to libpcre. Could be made optional if we have a
graceful way to handle that in Makefile.
- Some matching functions are GNU extensions of glibc. So this version
may have troubles running on platforms not using glibc.
- Fix a bug that access freed memory blocks in set_fade_callcack() and
check_fade_fin(). valgrind found it out.
- Use WM_CLASS to detect client windows instead of WM_STATE. Some client
windows (like notification windows) have WM_CLASS but not WM_STATE.
- Mark the extents as damaged if shadow state changed in
determine_shadow().
- Rewrite wid_get_name(). Code clean-up.
- Two debugging options: DEBUG_WINDATA and DEBUG_WINMATCH.
- As the matching system is ready, it should be rather easy to add other
kinds of blacklists, like fading blacklist.
2012-09-21 23:42:39 -04:00
* libpcre (B,R) (Will probably be made optional soon)
2012-09-24 22:19:20 -04:00
* libconfig (B,R) (Will probably be made optional soon)
Feature: #7: VSync
- Add VSync feature. 3 possible VSync methods available: "sw" (software,
not too reliable, but at least you have something to fallback to),
"drm" (using DRM_IOCTL_WAIT_VBLANK, should work only on DRI drivers),
"opengl" (using SGI_swap_control extension OpenGL, might work on more
drivers than the DRM method). "sw" and "opengl" are briefly tested,
"drm" received utterly no test (because I use the nVidia binary blob).
They are enabled with "--vsync sw" / "--vsync drm" / "--vsync opengl".
- Add --refresh-rate to let user specify a refresh rate for software
VSync, in case the automatic refresh rate detection does not work
well.
- Seemingly the automatic refresh rate detection using X RandR in
software VSync detects refresh rate incorrectly. Need further investigation.
- Fix a few bugs in fading timing.
- Add a workaround for client window detection on Fluxbox, as Fluxbox
(incorrectly?) sets the override-redirect flag upon all frame
windows.
- Software VSync adds dependency on librt (a part of glibc) for
nanosecond-level timing functions, and libXrandr for automatic refresh
rate detection; DRM VSync adds dependency on libdrm to use its drm.h,
but does not link to libdrm; OpenGL VSync adds dependency on libGL.
- Print timing information on DEBUG_REPAINT.
2012-10-07 22:20:01 -04:00
* libdrm (B) (Will probably be made optional soon)
* libGL (B,R) (Will probably be made optional soon)
2012-11-01 00:44:09 -04:00
* asciidoc (B) (if you wish to run `make docs` )
2011-11-04 14:52:05 -04:00
2012-11-14 05:42:09 -05:00
### How to build
To build, make sure you have the dependencies above:
2011-11-04 14:52:05 -04:00
``` bash
2012-11-14 05:42:09 -05:00
# Make the main program
2011-11-04 14:52:05 -04:00
$ make
2012-11-14 05:42:09 -05:00
# Make the newer man pages
$ make docs
# Install
2011-11-06 19:20:45 -05:00
$ make install
2011-11-04 14:52:05 -04:00
```
2012-11-14 05:42:09 -05:00
(Compton does include a `_CMakeLists.txt` in the tree, but we haven't decided whether we should switch to CMake yet. The `Makefile` is fully usable right now.)
2012-10-22 08:41:24 -04:00
## Example Usage
2011-11-04 14:52:05 -04:00
``` bash
2012-10-22 09:20:43 -04:00
$ compton -cC -i 0.6 -e 0.6 -f
2012-10-22 08:41:24 -04:00
$ compton --config ~/compton.conf
```
### Options and Configuration
```
compton [-d display] [-r radius] [-o opacity]
[-l left-offset] [-t top-offset]
[-i opacity] [-e opacity] [-cCfFSdG]
[--config path] [--shadow-red value]
2012-10-22 09:20:43 -04:00
[--shadow-green value] [--shadow-blue value]
2012-10-22 08:41:24 -04:00
[--inactive-opacity-override] [--inactive-dim value]
[--mark-wmwin-focused] [--shadow-exclude condition]
[--mark-ovredir-focused] [--no-fading-openclose]
[--shadow-ignore-shaped] [--detect-round-corners]
```
* `-d` __display__ :
Which display should be managed.
* `-r` __radius__ :
The blur radius for shadows. (default 12)
* `-o` __opacity__ :
The translucency for shadows. (default .75)
* `-l` __left-offset__ :
The left offset for shadows. (default -15)
* `-t` __top-offset__ :
The top offset for shadows. (default -15)
* `-I` __fade-in-step__ :
Opacity change between steps while fading in. (default 0.028)
* `-O` __fade-out-step__ :
Opacity change between steps while fading out. (default 0.03)
* `-D` __fade-delta-time__ :
The time between steps in a fade in milliseconds. (default 10)
* `-m` __opacity__ :
The opacity for menus. (default 1.0)
* `-c` :
Enabled client-side shadows on windows.
* `-C` :
Avoid drawing shadows on dock/panel windows.
* `-z` :
Zero the part of the shadow's mask behind the window (experimental).
* `-f` :
Fade windows in/out when opening/closing and when opacity
changes, unless --no-fading-openclose is used.
* `-F` :
Equals -f. Deprecated.
* `-i` __opacity__ :
Opacity of inactive windows. (0.1 - 1.0)
* `-e` __opacity__ :
Opacity of window titlebars and borders. (0.1 - 1.0)
* `-G` :
Don't draw shadows on DND windows
2012-10-22 09:20:43 -04:00
* `-b` :
Daemonize/background process.
2012-10-22 08:41:24 -04:00
* `-S` :
Enable synchronous operation (for debugging).
* `--config` __path__ :
Look for configuration file at the path.
* `--shadow-red` __value__ :
Red color value of shadow (0.0 - 1.0, defaults to 0).
* `--shadow-green` __value__ :
Green color value of shadow (0.0 - 1.0, defaults to 0).
* `--shadow-blue` __value__ :
Blue color value of shadow (0.0 - 1.0, defaults to 0).
* `--inactive-opacity-override` :
Inactive opacity set by -i overrides value of _NET_WM_OPACITY.
* `--inactive-dim` __value__ :
Dim inactive windows. (0.0 - 1.0, defaults to 0)
* `--mark-wmwin-focused` :
Try to detect WM windows and mark them as active.
* `--shadow-exclude` __condition__ :
Exclude conditions for shadows.
* `--mark-ovredir-focused` :
Mark over-redirect windows as active.
* `--no-fading-openclose` :
Do not fade on window open/close.
* `--shadow-ignore-shaped` :
Do not paint shadows on shaped windows.
* `--detect-rounded-corners` :
Try to detect windows with rounded corners and don't consider
them shaped windows.
### Format of a condition:
`condition = <target>:<type>[<flags>]:<pattern>`
`<target>` is one of `"n"` (window name), `"i"` (window class
instance), and `"g"` (window general class)
`<type>` is one of `"e"` (exact match), `"a"` (match anywhere),
`"s"` (match from start), `"w"` (wildcard), and `"p"` (PCRE
regular expressions, if compiled with the support).
`<flags>` could be a series of flags. Currently the only defined
flag is `"i"` (ignore case).
`<pattern>` is the actual pattern string.
### Configuration
A more robust
[sample configuration file ](https://raw.github.com/chjj/compton/master/compton.sample.conf )
is available in the repository.
#### Example
~/compton.conf:
```
# Shadows
shadow = true;
# Opacity
inactive-opacity = 0.8;
frame-opacity = 0.7;
# Fades
fading = true;
2011-11-04 14:52:05 -04:00
```
2011-11-06 23:03:18 -05:00
2012-10-22 08:41:24 -04:00
Run with:
``` bash
$ compton --config ~/compton.conf
```
2011-11-16 01:04:38 -05:00
2011-11-06 23:03:18 -05:00
## License
2012-10-22 08:41:24 -04:00
Although compton has kind of taken on a life of its own, it was originally
an xcompmgr fork. xcompmgr has gotten around. As far as I can tell, the lineage
for this particular tree is something like:
2011-11-06 23:03:18 -05:00
* Keith Packard (original author)
* Matthew Hawn
* ...
* Dana Jansens
2012-10-22 08:41:24 -04:00
* chjj and richardgv
2011-11-06 23:03:18 -05:00
Not counting the tens of people who forked it in between.
See LICENSE for more info.