# This is my compton configuration after a quick cleanup.  (It's still none too organized; sorry about that.)
#   With this file at ~/.config/compton.conf, I can run compton without any arguments (just plain `compton`).
#
# In the hopes that explaining my software and hardware environment might be helpful to you:
#
# I use this configuration  on Ubuntu 15.10 (and have used it on previous releases); I am currently using the 352.63 ("long-lived
#   branch") NVIDIA binary drivers, installed from the Ubuntu software repositories.  I use fluxbox as my window manager; most of
#   the other components of my desktop environment are borrowed from Xfce.
#
# My workstation at home has an i7-4930K and a GTX 970 in it, which are together more than enough to drive several 4K displays
#   without tearing or lagging.  Even with quite a few windows open at the moment, 'nvidia-smi' shows the X.org server using
#   about 600 MiB of video memory; both the CPU and the GPU are effectively idle.
#
# I use the version of compton packaged in my PPA (https://launchpad.net/~kelleyk/+archive/ubuntu/compton).  As of the time of this
#   writing, that is d7f95b5, which is the what's on the master branch of the upstream compton repository.
#
# My X11 configuration is very "normal".  On 15.04, I did have the following in a file in /etc/X11/xorg.conf.d/; I have not
#   investigated yet, but I haven't noticed any ill effects from *not* having it since installing 15.10 a few hours ago.
#   In some cases, UseEvents can make things unstable (though I haven't run into that in a long time); however, not enabling
#   it will cause the X server to spin (leading to high CPU usage) while waiting for certain resources.
# ---------------------------
#   Section "Device"
#      Identifier "Device0"
#      Option "UseEvents" "True"
#   EndSection
# ---------------------------
#
# Good luck!

# References:
# - https://github.com/chjj/compton/wiki
# - http://ubuntuforums.org/showthread.php?t=2144468

### Backend/performance options
backend = "glx";
paint-on-overlay = true;
glx-no-stencil = true;
glx-no-rebind-pixmap = true;

# (TODO: Clean up my notes about selecting a vsync implementation.)
xrender-sync-fence = true;
vsync = "opengl-swc";

# This option throttles refresh rates.  Not compatible with vsync=drm/opengl/opengl-oml.
# (Note: for me, enabling this just makes the choppy dragging more noticeable, like the update rate has gone down.)
sw-opti = true;

# # Per compton performance tips (from the GitHub wiki), only one of these three
# # (glx-use-copysubbuffermesa, glx-copy-from-front, glx-swap-method)
# # should be used.
# glx-use-copysubbuffermesa = true;
# glx-copy-from-front = false;
# glx-swap-method = "undefined";
glx-swap-method = "exchange";  # requires "allow fipping" in nvidia-settings

### Shadow
shadow = true;
no-dnd-shadow = true;
no-dock-shadow = true;
clear-shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
shadow-opacity = 0.5;
# shadow-red = 0.0;
# shadow-green = 0.0;
# shadow-blue = 0.0;
shadow-exclude = [
  # From the Ubuntu forums link ('screaminj3sus')
  "! name~=''",
  "n:e:Notification",
  "n:e:Plank",
  "n:e:Docky",
  "g:e:Synapse",
  "g:e:Kupfer",
  "g:e:Conky",
  "n:w:*Firefox*",
  "n:w:*Chrome*",
  "n:w:*Chromium*",
  "class_g ?= 'Notify-osd'",
  "class_g ?= 'Cairo-dock'",
  "class_g ?= 'Xfce4-notifyd'",
  "class_g ?= 'Xfce4-power-manager'"
];
shadow-ignore-shaped = false;
# shadow-exclude-reg = "x10+0+0";
# xinerama-shadow-crop = true;

### Opacity
menu-opacity = 0.90;
# inactive-opacity = 0.85;
# active-opacity = 0.8;
frame-opacity = 0.90;  # i.e. titlebars, borders
inactive-opacity-override = false;
alpha-step = 0.06;
# opacity-rule = [ "80:class_g = 'URxvt'" ];

# inactive-dim = 0.2;
# inactive-dim-fixed = true;

### Blur options
# blur-background = true;
# blur-background-frame = true;
# blur-kern = "3x3box"
# blur-kern = "5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
# blur-background-fixed = true;
blur-background-exclude = [ "window_type = 'dock'", "window_type = 'desktop'" ];

### Fading
fading = true;
fade-delta = 4;  # 30;
fade-in-step = 0.03;
fade-out-step = 0.03;
# no-fading-openclose = true;
fade-exclude = [ ];

### Other

mark-wmwin-focused = true;
mark-ovredir-focused = true;

# Use EWMH _NET_WM_ACTIVE_WINDOW to determine which window is focused instead of using FocusIn/Out events.
# Usually more reliable but depends on a EWMH-compliant WM.
use-ewmh-active-win = true;

# # Detect rounded corners and treat them as rectangular when --shadow-ignore-shaped is on.
# detect-rounded-corners = true;

detect-client-opacity = true;
refresh-rate = 0;
dbe = false;
unredir-if-possible = true;
# unredir-if-possible-delay = 5000;
# unredir-if-possible-exclude = [ ];
focus-exclude = [ "class_g = 'Cairo-clock'" ];
detect-transient = true;
detect-client-leader = true;
invert-color-include = [ ];
# resize-damage = 1;

# Window type settings
wintypes:
{
  tooltip = { fade = true; shadow = false; opacity = 0.75; focus = true; };
};

