Description
Problem
picom has many rules that allow the user to customize how each windows are rendered. The way it is implemented currently, we basically have one rule per point of customize. Such as blur-background-exclude
for background blurring, fade-exclude
for fading, etc. This does not scale well as we introduce more customization possibilities. Look at this:
Lines 955 to 973 in 05c764c
This list will keep getting longer if we don't find a better approach. Besides that, it is also:
- difficult to implement rules for non-trivial options such as animations
- difficult to not repeating yourself, if you want to set multiple options for the same group of windows
- confusing to have both inclusion and exclusion rules for the same option
- confusing to have both rules, and the
wintypes
option
Proposal
Introducing a new rules
option as the unified way to set per-window options. The design is simple:
rules = ({
# you write a rule
match = "class_i = 'firefox'";
# ... and you set options
blur-background = false;
},
{
# ... any number of rules can be created
}, )
Supported options
All options that make sense as a per-window option will be supported. Such as fading
, blur-background
, shadow
, shadow-color
, shadow-radius
, corner-radius
, opacity
, animations
, full-shadow
, redir-ignored
, etc.
Multiple matching rules
This style of rules naturally comes with the question of what should happen if multiple rules match. Simply stopping at the first match doesn't really work for us, because that forces user to write very specific rules so they don't overlap. This is difficult and can be confusing.
So instead, picom will always try all of the rules, and combine the options. If the same options is set multiple times in different rule blocks, then the one encountered first in the order of how they appear in the configuration file will be used.
Deprecation plan
No deprecation is planned. All the old rule options, as well as wintypes
, will continue to work. But users are encouraged to use the new rules
option instead of the old ones. When both styles of rules are present in the configuration, the new rules will be matched first, and only when none of the new rules matches, will picom try any of the old rules.