# NOTE 1: This configuration when used as-is, requires --experimental-backends
# command line option to be used, in order to enable the usage of the
# dual-kawase blur method.

# NOTE 2: With the picom from standard repositories, currently using experimental
# backends will disable the support for rounded corners. If you want to use both
# the dual-kawase blur method and rounded corners, you will need to use a fork.
# However it is not mandantory. If you will use the standard version, you will just
# see a warning in picom's logs each time it's started, you can disable rounded
# corners completely to prevent this. If you do want to use a fork, I recommend this:
# <https://github.com/jonaburg/picom> (picom-jonaburg-git on AUR).

# NOTE 3: The shadows are currently disabled, the reason for this are the issues
# that occur with combining rounded corners and shadows, for more info, check:
# <https://github.com/jonaburg/picom/issues/62>


# General settings
###################

# Daemonize process. Fork to background after initialization.
# Causes issues with certain (badly-written) drivers.
daemon = false

# Specify the backend to use: `xrender`, `glx`, or `xr_glx_hybrid`.
# `xrender` is the default one.
# We use GLX since it's generally a lot faster than xrender.
# There usually aren't anny issues with this, but if you do experience some
# try falling back to xrender.
backend = "glx";

# To properly use the GLX backend, we need to enable experimental backends
experimental-backends = true;

# Enable/Disable VSync.
vsync = true;

# Enable remote control via D-Bus.
dbus = false;

# Try to detect WM windows (a non-override-redirect window with no
# child that has 'WM_STATE') and mark them as active.
mark-wmwin-focused = true;

# Mark override-redirect windows that doesn't have a child window
# with 'WM_STATE' focused.
mark-ovredir-focused = true;

# Try to detect windows with rounded corners and don't consider them
# shaped windows. The accuracy is not very high, unfortunately.
detect-rounded-corners = true;

# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_OPACITY' of client windows to frame windows.
detect-client-opacity = true;

# Specify refresh rate of the screen. If not specified or 0, picom will
# try detecting this with X RandR extension.
refresh-rate = 0;

# GLX backend: Avoid using stencil buffer, useful if you don't have a stencil buffer.
# Might cause incorrect opacity when rendering transparent content (but never
# practically happened) and may not work with blur-background.
# My tests show a 15% performance boost. Recommended.
glx-no-stencil = true;

# GLX backend: Avoid rebinding pixmap on window damage.
# Probably could improve performance on rapid window content changes,
# but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.).
# Recommended if it works.
glx-no-rebind-pixmap = true;

# Disable/Enable the use of damage information.
# Disabling cause the whole screen to be redrawn everytime, instead of the part
# of the screen has actually changed. Potentially degrades the performance,
# but might fix some artifacts. It is recommended to keep this enabled.
# The opposing option is no-use-damage
use-damage = true

# Window type settings
#
# 'WINDOW_TYPE' is one of the 15 window types defined in EWMH standard:
#     "unknown", "desktop", "dock", "toolbar", "menu", "utility",
#     "splash", "dialog", "normal", "dropdown_menu", "popup_menu",
#     "tooltip", "notification", "combo", and "dnd".
#
# Following per window-type options are available: ::
#
#   fade, shadow:::
#     Controls window-type-specific shadow and fade settings.
#
#   opacity:::
#     Controls default opacity of the window type.
#
#   focus:::
#     Controls whether the window of this type is to be always considered focused.
#     (By default, all window types except "normal" and "dialog" has this on.)
#
#   full-shadow:::
#     Controls whether shadow is drawn under the parts of the window that you
#     normally won't be able to see. Useful when the window has parts of it
#     transparent, and you want shadows in those areas.
#
#   redir-ignore:::
#     Controls whether this type of windows should cause screen to become
#     redirected again after been unredirected. If you have unredir-if-possible
#     set, and doesn't want certain window to cause unnecessary screen redirection,
#     you can set this to `true`.
#
wintypes:
{
    normal = { full-shadow = true; blur-background = true; };
    splash = { blur-background = false; };
    menu = { full-shadow = true; };
    tooltip = { fade = true; shadow = false; focus = true;};
    dock = { shadow = false; };
    dnd = { shadow = false; };
    popup_menu = { full-shadow = true; };
    utility = { full-shadow = true; };
    toolbar = { full-shadow = true; };
    notification = { opacity = 1; }
};


# Transparency / Opacity
#########################

# Specify a list of opacity rules.
# format: "[Opacity level]:[xprop info name] = '[xprop value]'"
#   - class_g reffers to class in position #0,
#   - class_i reffers to class in position #1
# Note we don't make any guarantee about possible conflicts with other
# programs that set '_NET_WM_WINDOW_OPACITY' on frame or client windows.

# Apply blur to terminals
opacity-rule = [
    "100:name = 'Dunst'",
    # Opacities with enabled shadows (shadows allow for higher alpha - lower number)
    #"70:class_g = 'Alacritty'",
    #"70:class_g = 'st-256color'",
    #"70:class_g = 'URxvt'",
    #"70:class_g = 'kitty'",
    #"82:class_g = 'Spotify'"
    # Opacities without shadows
    "80:class_g = 'Alacritty'",
    "80:class_g = 'st-256color'",
    "80:class_g = 'URxvt'",
    "80:class_g = 'kitty'",
    "92:class_g = 'Spotify'"
];

# Default opacity for active windows. (0.0 - 1.0, defaults to 1.0)
active-opacity = 1;
# Opacity of inactive windows. (0.1 - 1.0, defaults to 1.0)
inactive-opacity = 1;
# Opacity of window titlebars and borders. (0.1 - 1.0, disabled by default)
frame-opacity = 1.0;
# Default opacity for dropdown menus and popup menus. (0.0 - 1.0, defaults to 1.0)
opacity = 1.0
# Let inactive opacity set by -i override the '_NET_WM_OPACITY' values of windows.
inactive-opacity-override = false
# Dim inactive windows. (0.0 - 1.0, defaults to 0.0)
inactive-dim = 0.0
# Use fixed inactive dim value, instead of adjusting according to window opacity.
inactive-dim-fixed = 1.0
# Specify a list of conditions of windows that should always be considered focused.
focus-exclude = []


# Background blurring
########################

blur:
{
    # dual_kawase blur method requires GLX as backend
    # If you can't get GLX to work, use 'kernel' blur instead.
    # dual_kawase allows for multi-threaded bluring that's
    # very fast.
    method = "dual_kawase";
    #method = "kernel";
    #kernel = "11x11gaussian";
    strength = 4;
    deviation = 1.0;
    # When true, blur background of semi-transparent / ARGB window.
    background = false;
    # When true, the background of windows when the window frame
    # is not opaque is blurred, implies background=true
    background-frame = false;
    # Whe true, use fixeed blur strength rather than adjusing
    # according to window opacity
    background-fixed = false;
    # Specify the blur convolution kernel
    kern = "3x3box"
}

# Exclude conditions for background blur
blur-background-exclude = [
    # Prevents picom from blurring the background
    # when taking selection screenshot with `maim`
    "class_g = 'slop'",
    "_GTK_FRAME_EXTENTS@:c"
];


# Shadows
################

# Enabled client-side shadows on windows. Note desktop windows
# (windows with '_NET_WM_WINDOW_TYPE_DESKTOP') never get shadow,
# unless explicitly requested using the wintypes option.
shadow = false;

# The blur radius for shadows, in pixels. (defaults to 12)
shadow-radius = 12;
# The opacity of shadows. (0.0 - 1.0, defaults to 0.75)
shadow-opacity = 0.75;
# The left offset for shadows, in pixels. (defaults to -15)
shadow-offset-x = -15;
# The top offset for shadows, in pixels. (defaults to -15)
shadow-offset-y = -15;
# Red color value of shadow (0.0 - 1.0, defaults to 0).
shadow-red = 0
# Green color value of shadow (0.0 - 1.0, defaults to 0).
shadow-green = 0
# Blue color value of shadow (0.0 - 1.0, defaults to 0).
shadow-blue = 0
# Crop shadow of a window fully on a particular Xinerama screen to the screen.
xinerama-shadow-crop = false

# Specify a list of conditions of windows that should have no shadow.
shadow-exclude = [
  "name = 'Notification'",
  "class_g = 'Conky'",
  "class_g ?= 'Notify-osd'",
  "class_g = 'Cairo-clock'",
  "class_g = 'slop'",
  "class_g = 'Polybar'",
  "_GTK_FRAME_EXTENTS@:c"
];


# Window Fading
################

# Fade windows in/out when opening/closing and when opacity changes,
# unless no-fading-openclose is used.
fading = false;

# Opacity change between steps while fading in. (0.01 - 1.0, defaults to 0.028)
fade-in-step = 0.07;
# Opacity change between steps while fading out. (0.01 - 1.0, defaults to 0.03)
fade-out-step = 0.1;
# The time between steps in fade step, in milliseconds. (> 0, defaults to 10)
fade-delta = 10
# Do not fade on window open/close.
no-fading-openclose = false
# Do not fade destroyed ARGB windows with WM frame. Workaround of bugs in Openbox,
# Fluxbox, etc.
no-fading-destroyed-argb = false

# Specify a list of conditions of windows that should not be faded.
# don't need this, we disable fading for all normal windows with wintypes: {}
fade-exclude = [
  "class_g = 'slop'"   # maim
]


# Corners
################

# Sets the radius of rounded window corners. When > 0, the compositor will
# round the corners of windows.
corner-radius = 12;
rounded-corners-exclude = [
    "class_g = 'Polybar'",
    "class_g = 'Bar'",
    "class_g = 'Rofi'",
    "class_g = 'dmenu'",
    "class_g = 'Polybar'",
    "name = 'Notification area'",
    "name = 'Dunst'"
]

# Rounded corners alone only changes the window, but the borders
# around it still remain rectangular, round-borders option allows
# the borders to also be round.
round-borders = 1;
# Specify a list of border width rules.
# format: "[pixels]:[xprop info name] = '[xprop value]'"
# Note this doesn't have any guarantee about not conflicting with the
# border width set by the window manager.
round-borders-rule = [];