PICOM(1) | User Commands | PICOM(1) |
NAME¶
picom - a compositor for X11
SYNOPSIS¶
picom [OPTIONS]
DESCRIPTION¶
picom is a compositor based on Dana Jansens' version of xcompmgr (which itself was written by Keith Packard). It includes some improvements over the original xcompmgr, like window frame opacity and inactive window transparency.
OPTIONS¶
-h, --help
-r, --shadow-radius=RADIUS
-o, --shadow-opacity=OPACITY
-l, --shadow-offset-x=OFFSET
-t, --shadow-offset-y=OFFSET
-I, --fade-in-step=OPACITY_STEP
-O, --fade-out-step=OPACITY_STEP
-D, --fade-delta=MILLISECONDS
-c, --shadow
-f, --fading
-i, --inactive-opacity=OPACITY
-e, --frame-opacity=OPACITY
-b, --daemon
--log-level
--log-file
--legacy-backends
--show-all-xerrors
--config PATH
--write-pid-path PATH
--plugins PATH
--shadow-color STRING
--shadow-red VALUE
--shadow-green VALUE
--shadow-blue VALUE
--inactive-opacity-override
--active-opacity OPACITY
--inactive-dim VALUE
--corner-radius VALUE
--corner-radius-rules RADIUS:CONDITION
--rounded-corners-exclude CONDITION
--no-frame-pacing
--mark-wmwin-focused
--mark-ovredir-focused
--no-fading-openclose
--no-fading-destroyed-argb
--shadow-ignore-shaped
--detect-rounded-corners
--detect-client-opacity
--vsync, --no-vsync
--use-ewmh-active-win
--unredir-if-possible
--unredir-if-possible-delay MILLISECONDS
--unredir-if-possible-exclude CONDITION
--shadow-exclude CONDITION
--clip-shadow-above CONDITION
--fade-exclude CONDITION
--focus-exclude CONDITION
--inactive-dim-fixed
--detect-transient
--detect-client-leader
--blur-method, --blur-size, --blur-deviation, --blur-strength
--blur-background
--blur-background-frame
--blur-background-fixed
--blur-kern MATRIX
WIDTH,HEIGHT,ELE1,ELE2,ELE3,ELE4,ELE5...
In other words, the matrix is formatted as a list of comma separated numbers. The first two numbers must be integers, which specify the width and height of the matrix. They must be odd numbers. Then, the following width * height - 1 numbers specifies the numbers in the matrix, row by row, excluding the center element.
The elements are finite floating point numbers. The decimal pointer has to be . (a period), scientific notation is not supported.
The element in the center will either be 1.0 or varying based on opacity, depending on whether you have --blur-background-fixed. Yet the automatic adjustment of blur factor may not work well with a custom blur kernel.
A 7x7 Gaussian blur kernel (sigma = 0.84089642) looks like:
--blur-kern '7,7,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.001723,0.059106,0.493069,0.493069,0.059106,0.001723,0.000849,0.029143,0.243117,0.493069,0.243117,0.029143,0.000849,0.000102,0.003494,0.029143,0.059106,0.029143,0.003494,0.000102,0.000003,0.000102,0.000849,0.001723,0.000849,0.000102,0.000003'
May also be one of the predefined kernels: 3x3box (default), 5x5box, 7x7box, 3x3gaussian, 5x5gaussian, 7x7gaussian, 9x9gaussian, 11x11gaussian. All Gaussian kernels are generated with sigma = 0.84089642 . If you find yourself needing to generate custom blur kernels, you might want to try the new blur configuration (See BLUR).
--blur-background-exclude CONDITION
--resize-damage INTEGER
--invert-color-include CONDITION
--opacity-rule OPACITY:CONDITION
--crop-shadow-to-monitor
--backend BACKEND
--glx-no-stencil
--glx-no-rebind-pixmap
--no-use-damage
--xrender-sync-fence
--glx-fshader-win SHADER
--force-win-blend
--dbus
--benchmark CYCLES
--benchmark-wid WINDOW_ID
--no-ewmh-fullscreen
--max-brightness
--transparent-clipping
--transparent-clipping-exclude CONDITION
--window-shader-fg SHADER
--window-shader-fg-rule SHADER:CONDITION
--dithered-present
WINDOW RULES¶
Window rules allow you to set window-specific options which can be used to change appearance of windows based on certain conditions. Note there are other options that also cover some of the functionality of window rules, but window rules are more flexible and powerful. If you are creating a fresh configuration file, it is recommended to use window rules instead of the other options.
Following is a list of all the options that are superseded by window rules:
--shadow-ignore-shaped, -i, --inactive-opacity=OPACITY, --active-opacity OPACITY, --inactive-opacity-override, --inactive-dim VALUE, --mark-wmwin-focused, --mark-ovredir-focused, --invert-color-include CONDITION, --shadow-exclude CONDITION, --fade-exclude CONDITION, --focus-exclude CONDITION, --rounded-corners-exclude CONDITION, --blur-background-exclude CONDITION, --opacity-rule OPACITY:CONDITION, --corner-radius-rules RADIUS:CONDITION, --window-shader-fg-rule SHADER:CONDITION, --clip-shadow-above CONDITION. As well as the wintypes configuration file option.
If window rules option is used, none of the above options will have any effect. And warning messages will be issued. When the window rules option is used, the compositor will also behave somewhat differently in certain cases. One such case is that fullscreen windows will no longer have their rounded corners disabled by default.
If you are currently using some of these options and want to switch to window rules, or if you want to keep the existing behavior, see the Migrating old rules section for how to convert them.
Syntax¶
Window rules are only available in the configuration file. To set window rules, set the rules option in the configuration file to something like this:
rules = (
{ match = "focused"; opacity = 1; },
{ match = "name = 'firefox'"; shadow = true; },
# ... and so on )
rules = ( ... ) sets the option to a list, which can contain multiple sub-items. For rules, each sub-item must be a group (i.e. { key = value; ... }), representing a condition and a set of options to apply when the condition is met. These sub-items are matched in the order they appear in the configuration file, options are applied as the conditions are matched. If the same option is set multiple times, the last one will take effect.
Within each sub-item, these keys are available:
match
shadow
full-shadow
fade
opacity
dim
corner-radius
blur-background
invert-color
clip-shadow-above
unredir
transparent-clipping
shader
animations
Migrating old rules¶
Most of the rule options should 1:1 map to the new window rules. Here is a list of the non-trivial ones and how to achieve the same effect with window rules.
Inactive dimming and opacity
Note
Setting opacity explicitly with a rule will override the opacity value from the window properties (i.e. _NET_WM_WINDOW_OPACITY), which is used by tools like picom-trans for setting the opacity of window. If you would like to keep using tools like picom-trans, you can choose to set the opacity only for windows without the opacity property by matching ! _NET_WM_WINDOW_OPACITY.
Active window
Rounded corners and fullscreen windows
rules = (
{ match = "fullscreen"; corner-radius = 0; }, )
FORMAT OF CONDITIONS¶
Some options accept a condition string to match certain windows. A condition string is formed by one or more conditions, joined by logical operators.
Formal grammar for a condition looks like this:
Condition <- Term ('||' Term)* Term <- Item ('&&' Item)* Item <- '!'? Target '@'? ('[' Index ']')? (Operator Pattern)? | '(' Condition ')'
Concretely speaking, a condition is a sequence of one or more simple pattern matching Items, joined by logical operators && (and) and || (or). && has higher precedence than ||. Both operators are left-associative. Parentheses can be used to raise precedence. If an Item has a leading negation operator (!), the result of the item is negated.
Inside an Item:
Target
Supported predefined targets are:
x, y, x2, y2
width, height
widthb, heightb
border_width
fullscreen
override_redirect
argb
focused
group_focused
wmwin
bounding_shaped
rounded_corners
window_type
name
class_i, class_g
role
Target can be followed by an optional @ if the window attribute should be be looked up on client window. Otherwise the frame window will be used.
Index
Operator and Pattern
Available operators change depends on the type of Target being matched. If the target is a number, the operators are =, >, <, >=, <=, as well as their negation, obtained by prefixing the operator with ! (e.g. !=, !>, etc.). If the target is a string, the operators are = (strict equal), *= (substring match), ^= (starts with), %= (match with glob), ~= (match with regex), as well as their case insensitive variants ?=, *?=, ^?=, %?=, ~?=. String operators can be negated by prefixing the operator with ! as well (e.g. !=, !*=, etc.).
Pattern is either an integer or a string enclosed by single or double quotes. Python-3-style escape sequences are supported for strings. Boolean values are interpreted as integers, i.e. writing true is equivalent to 1, and false 0.
Examples:
# If the window is focused focused focused = 1 # If the window is not override-redirected !override_redirect override_redirect = false override_redirect != true override_redirect != 1 # If the window is a menu window_type *= "menu" _NET_WM_WINDOW_TYPE@ *= "MENU" # If the window is marked hidden: _NET_WM_STATE contains _NET_WM_STATE_HIDDEN _NET_WM_STATE@[*] = "_NET_WM_STATE_HIDDEN" # If the window is marked sticky: _NET_WM_STATE contains an atom that contains # "sticky", ignore case _NET_WM_STATE@[*] *?= "sticky" # If the window name contains "Firefox", ignore case name *?= "Firefox" _NET_WM_NAME@ *?= "Firefox" # If the window name ends with "Firefox" name %= "*Firefox" name ~= "Firefox$" # If the window has a property _COMPTON_SHADOW with value 0, type CARDINAL, # format 32, value 0, on its frame window _COMPTON_SHADOW = 0 # If the third value of _NET_FRAME_EXTENTS is less than 20, or there's no # _NET_FRAME_EXTENTS property on client window _NET_FRAME_EXTENTS@[2] < 20 || !_NET_FRAME_EXTENTS@ # The pattern here will be parsed as "dd4" name = "\x64\x64\o64" # These two are equivalent name = 'Firefox' || name = 'Chromium' && class_i = 'Navigator' name = 'Firefox' || (name = 'Chromium' && class_i = 'Navigator')
ANIMATIONS¶
picom supports fading animation when you open or close a window. In addition to that, picom also has a very powerful animation script system, which can be used to animate many aspects of a window based on certain triggers. Animation scripts can be defined in your configuration file by setting the option animations. It is also possible to define animations per-window using the WINDOW RULES system, by setting the animations option in a rule. (Read the rest of this section first before you go there.)
The basic syntax of the animations option is as follows:
animations = ({
triggers = [ ... ];
suppressions = [ ... ];
# more options follow
... }, {
# another animation script }, ...)
animations = ( ... ) sets animations to a list, which can contain multiple sub-items, each item is an animation script. An animation script is a group containing multiple entries (i.e. { key = value; ... }). All animation scripts share some common options, like triggers and suppressions, they also contain more options that either defines the actual animation, or selects an animation preset.
Common options¶
triggers
Valid triggers are:
open
close
show
hide
increase-opacity
decrease-opacity
geometry
Warning
The geometry trigger is experimental. Using this means you accept the caveat that geometry animations will also trigger when you manually resize or move a window, like when you drag the window around with your mouse.
suppressions
Presets¶
Defining an animation is a bit involved. To make animations more approachable, without you having to learn the nitty-gritty details of the script system, picom provides a number of presets that you can use by just specifying a handful of options.
To choose a preset, add a preset option to an animation script group, like this:
animations = ({
triggers = [ "close", "hide" ];
preset = "slide-out";
direction = "down";
... }, ...)
Some presets have additional options that you can set to customize the animation. In this example, the slide-out preset has a direction option specifying the direction of the sliding animation.
Note
Describing animations with only words is difficult. We have short
video clips showing off each preset, but sadly they cannot be included in
this manpage. The web version of this document hosted on our website at
<https://picom.app> on the other hand, does have those
clips.
The following presets are available:
slide-in, slide-out
Show/hide the window with a sliding animation.
Options
direction
duration
fly-in, fly-out
Show/hide the window with a flying animation.
Options
direction
duration
appear, disappear
Show/hide the window with a combination of scaling and fading.
Options
scale
duration
geometry-change
Animate the geometry (i.e. size and position) change of the window.
Warning
This makes use of both the geometry trigger, and the saved-image-blend output variable. Both of these features are experimental and may not work as expected.
Options
duration
Advanced¶
If the existing presets don’t meet your needs, it is always possible to define your own animations. To put it simply, an animation script is just a collection of variables, and how their values should be computed. Animation scripts, when running, are evaluated once per frame, and the values of some of the variables are then used to animate the window.
Basic syntax
To concretely illustrate what the above means, here is an example:
# this animation script does nothing to your windows by the way. animations = ({
# common options, these are not part of the collection of variables
triggers = [ "open" ];
# variables
a = 10;
b = "a * 10";
c = "a + b";
d = {
curve = "cubic-bezier(0.25, 0.1, 0.25, 1.0)";
duration = 0.5;
delay = 0;
start = 0;
end = 1;
};
# more options follow
# ... }, ...)
A variable can be defined as a number, an expression, or a timing function. In the example above, a is defined to be a number (10), b is defined to be the result of the expression a * 10, and c similarly. Expression used to define one variable can refer to other variables in the same script. This is how you can create complex animations. Where the variables are defined in the script does not matter, as long as no circular references exist.
Note
Because variable names can contain dashes (-), minus signs in expressions must be surrounded by spaces. For example, a - 10 means a minus 10, whereas a-10 is a variable named a-10.
d is a timing function, which is a group with several options specifying its behavior. Timing functions are what drives an animation. If no timing function is defined in an animation script, nothing will be animated and the animation will end instantly.
These options are valid for a timing function:
curve
delay
duration
start
end
All options except curve can be set to expressions. Timing function options are not variables themselves.
Note
If any of delay, duration, start, or end is defined with an expression, the expression will be evaluated only once when the animation starts. The values of delay, duration, start, and end will then be fixed for the duration of the animation.
The total duration of an animation is determined by the duration of the timing function with the longest duration. The animation will end when the longest timing function ends. Once an animation ends, its effects on the window will be removed.
There isn’t any restriction on what you can name the variables. Obviously they cannot conflict with the names of common options (triggers, suppressions, and preset), but other than that, you can name them whatever you want as long as libconfig allows it. Some variable names have special meanings as we will see below.
Output variables
Now you know how to write an animation script. But what we just wrote doesn’t actually do anything to the window. To animate a window, we define a set of special variable names which we will call "output variables". If you define variables with these names, their values will be used to animate the window.
For example, if you define an animation script like this:
animations = ({
triggers = [ "open" ];
offset-x = {
duration = 2;
start = 0;
end = 100;
}; }, ...)
Then when a window opens, it will move 100 pixels to the right over the course of 2 seconds.
Warning
Although we did say you can name your variables whatever you want, if some of them become output variables in the future, your animation script will behave unexpectedly. To avoid this kind of problems, we reserve several classes of variable names which we will never use for special variables. These are: 1) any names that start with a single letter followed by a dash (e.g. a-, b-, etc.); 2) any names that start with var-, tmp-, or user-. If you need to define a non-output variable, use one of these names.
Currently, these output variables are supported:
offset-x, offset-y
shadow-offset-x, shadow-offset-y
opacity
blur-opacity
shadow-opacity
scale-x, scale-y, shadow-scale-x, shadow-scale-y
crop-x, crop-y, crop-width, crop-height
saved-image-blend
Warning
The saved-image-blend variable is experimental. It might work incorrectly, cause visual artifacts, or slow down your system. You are welcome to open an issue on GitHub if you encounter any problems to help us improve it, though resolution is not guaranteed.
All coordinates are in pixels, and are in the coordinate system of the screen. Sizes are also in pixels.
Important
If an output variable name is not defined in your animation script, it will take the default value for whichever state the window is in. Specifically, if you don’t define an opacity variable in the animation script for the "close" or "hide" trigger, a closed window will, by default, have 0 opacity. So you will just see it disappear instantly. Oftentimes, you will want to set opacity to 1 to make the window visible for the duration of the animation.
Context variables
Now you know how to animate a window. But this is still not powerful enough to support most animations you might want to define. For example, if you want your window to fly out the right side of your screen, the amount of pixels it has to move depends on where it is on the screen, and its width. For the last piece of the puzzle, we have context variables.
A context variable is a variable picom defines for you, and you can use them in expressions like any other variables. Their values reflect certain attributes of the window you are animating.
Warning
If you define a variable with the same name as a context variable, your variable will shadow the context variable. Since more context variables can be added in the future, this can be difficult to avoid. Thus, the same rule for output variables applies here as well: if you need to define a temporary variable, use one of the reserved names.
Currently, these context variables are defined:
window-x, window-y
window-width, window-height
window-x-before, window-y-before, window-width-before, window-height-before
window-monitor-x, window-monitor-y, window-monitor-width, window-monitor-height
window-raw-opacity-before, window-raw-opacity
Important
All of the window-*-before variables are updated every frame, and reflects the state of the window in the previous frame. Which means they will only be meaningful for a single frame, when an animation has just been triggered. Which means you should only use them to define the start, end, duration, or delay values of a timing function, since these values are only evaluated once when the animation starts.
Share your animations¶
If you have created an animation script that you think is particularly cool, you are encouraged to share it with the community. You can submit an issue or a pull request to picom on GitHub, and get a chance to have your animation included as one of the presets, so it can be used by everyone.
SHADER INTERFACE¶
This secion describes the interface of a custom shader, how it is used by picom, and what parameters are passed by picom to the shader. This does not apply to the legacy backends.
A custom shader is a GLSL fragment shader program, which can be used to override the default way of how a window is rendered. If a custom shader is used, the default picom effects (e.g. dimming, color inversion, etc.) will no longer be automatically applied. It would be the custom shader’s responsibility to apply these effects.
The interface between picom and a custom shader is dependent on which backend is being used. The xrender backend doesn’t support shader at all. Here we descibe the interface provided by the glx backend.
The shader must define a function, vec4 window_shader(), which would be the entry point of the shader. The returned vec4 will be used to set gl_FragColor. A function, vec4 default_post_processing(vec4 c), is provided for applying the default picom effects to input color 'c'.
The following uniform/input variables are made available to the shader:
in vec2 texcoord; // texture coordinate of the fragment uniform float opacity; // opacity of the window (0.0 - 1.0) uniform float dim; // dimming factor of the window (0.0 - 1.0, higher means more dim) uniform float corner_radius; // corner radius of the window (pixels) uniform float border_width; // estimated border width of the window (pixels) uniform bool invert_color; // whether to invert the color of the window uniform sampler2D tex; // texture of the window uniform vec2 effective_size; // effective dimensions of the texture (repeats pixels if larger than tex) uniform sampler2D brightness; // estimated brightness of the window, 1x1 texture uniform float max_brightness; // configured maximum brightness of the window (0.0 - 1.0) uniform float time; // time in milliseconds, counting from an unspecified starting point
The default behavior of picom window rendering can be replicated by the following shader:
#version 330 in vec2 texcoord; // texture coordinate of the fragment uniform sampler2D tex; // texture of the window // Default window post-processing: // 1) invert color // 2) opacity / transparency // 3) max-brightness clamping // 4) rounded corners vec4 default_post_processing(vec4 c); // Default window shader: // 1) fetch the specified pixel // 2) apply default post-processing vec4 window_shader() {
vec2 texsize = textureSize(tex, 0);
vec4 c = texture2D(tex, texcoord / texsize, 0);
return default_post_processing(c); }
The interface is expected to be mostly stable.
CONFIGURATION FILES¶
picom could read from a configuration file if libconfig support is compiled in. If --config is not used, picom will seek for a configuration file in $XDG_CONFIG_HOME/picom.conf (~/.config/picom.conf, usually), then $XDG_CONFIG_HOME/picom/picom.conf, then $XDG_CONFIG_DIRS/picom.conf (often /etc/xdg/picom.conf), then $XDG_CONFIG_DIRS/picom/picom.conf.
When @include directive is used in the config file, picom will first search for the included file in the parent directory of picom.conf, then in $XDG_CONFIG_HOME/picom/include/, then in $XDG_CONFIG_DIRS/picom/include.
picom uses general libconfig configuration file format. A sample configuration file is available as picom.sample.conf in the source tree. Most of command line switches can be used as options in configuration file as well. For example, --vsync option documented above can be set in the configuration file using `vsync = `. Command line options will always overwrite the settings in the configuration file.
Some options can only be set in the configuration file. Such options include rules (see WINDOW RULES), animations (see ANIMATIONS), wintypes (see below).
Window-type-specific settings allow you to set window-specific options based on the window type. These settings are exposed only in configuration file. The format of this option is as follows:
wintypes: {
WINDOW_TYPE = { fade = BOOL; shadow = BOOL; opacity = FLOAT; focus = BOOL; blur-background = BOOL; full-shadow = BOOL; clip-shadow-above = BOOL; redir-ignore = BOOL; }; };
Warning
Using this is highly discouraged, see the WINDOW RULES section for the recommended way to set window-specific options.
Important
According to the window manager specification, a window can have multiple types. But due to the limitation of how wintypes was implemented, if a window has multiple types, then for the purpose of applying wintypes options, one of the window types will be chosen at random. Again, you are recommended to use WINDOW RULES instead.
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
opacity
focus
blur-background
full-shadow
clip-shadow-above
redir-ignore
BLUR¶
You can configure how the window background is blurred using a 'blur' section in your configuration file. Here is an example:
blur: {
method = "gaussian";
size = 10;
deviation = 5.0; };
Available options of the blur section are:
method
size
deviation
strength
kernel
SIGNALS¶
D-BUS API¶
It’s possible to control picom via D-Bus messages, by running picom with --dbus and send messages to com.github.chjj.compton.<DISPLAY>. <DISPLAY> is the display used by picom, with all non-alphanumeric characters transformed to underscores. For DISPLAY=:0.0 you should use com.github.chjj.compton._0_0, for example.
The D-Bus methods and signals are not yet stable, thus undocumented right now.
EXAMPLES¶
$ picom --config /dev/null
$ picom -cf
$ picom -bcf -i 0.8 -e 0.8 --no-fading-openclose
$ picom -c --shadow-red 1 --shadow-green 1 --shadow-blue 1
$ picom -c --shadow-exclude 'class_g = "wbar"'
$ picom --backend glx --vsync
BUGS¶
Please submit bug reports to <https://github.com/yshui/picom>.
Out dated information in this man page is considered a bug.
RESOURCES¶
Homepage: <https://github.com/yshui/picom>
SEE ALSO¶
AUTHOR¶
Yuxuan Shui
2024-11-15 | picom |