Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Updated Compton name change to Picom.

...

You can make this stick after reboot by editing /etc/xprofile or ~/.xprofile (user specific setting) and adding the above command to either file.  If either file does not exist just create one.

Fixing Screen tearing (with

...

Picom)

Info

On Arch the Compton composite manager was recently renamed to Picom.  This article has been updated to reflect this. 


Info

This requires the comptonpicom package to be installed (and active).  If you don't have this installed, do:

Code Block
languagebash
sudo pacman -S comptonpicom

To activate it from i3wm, add this line to your i3 config:

Code Block
exec --no-startup-id comptonpicom -b


On one my laptops (Thinkpad e480) there was noticable screen tearing with compton picom enabled.  To eliminate the screen tearing found there were several tweaks needed to the ~/.config/comptonpicom.conf configuration file.  Below are the changes needed (note you'll need to replace the original settings below with these ones):

...

Note you don't have to be using manjaro-i3 to use this config.  If you're using stock Manjaro (or Arch) please ensure you have at least the following packages installed: i3-wm (or i3-gaps if you want dem' gaps), i3exit, i3status, py3status, and comptonpicom.  You can install all these packages with:

Code Block
languagebash
sudo pacman -S i3-wm i3exit i3status py3status comptonpicom

My config file:

Note that this config file contains other modifications that I prefer in my i3 setup, such as:

...

I also like to add a bit of transparency to my alttab.  You can do this by adding a rule for alttab to the opacity-rule array definition as seen in my comptonmy picom.conf:

View Git file
pathcomptonpicom/comptonpicom.conf
repository-id3
branchrefs/remotes/origin/master
linenumberstrue
collapsetrue

...

The following approach replaces the default inactive window transparency with compton picom dim rules.  We'll also cover how modify dimming on a per window basis via a keyboard shortcuts (occasionally want to disable the default dimming on a window by window basis).

First, let's disable comptonpicom's inactive-opacity setting.  Your opacity settings in comptonpicom.conf should might look something like this:

Code Block
# opacity settings
menuinactive-opacity = 0.951;
#inactiveactive-opacity = 0.931;
activeframe-opacity = 1;
alphainactive-opacity-stepoverride = 0.01false;
opacity-rule = [
"90:name = 'alttab    "80:class_g = 'copyq'",
    "8090:class_gname = 'copyqalttab'",
    # no opacity on sticky windows
    "99:_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'"
];

We want to make sure that inactive-opacity is set to 1 (or disabled) and active-opacity is also set You'll note that we've disabled inactive-opacity  and set active-opacity  to 1WeI've also kept a few opacity=rule rules that I want to still apply to several window types.  Note the last rule above - it simply disables transparency for sticky windows (another i3 concept which allows to keep a window showing/pinned on all workspaces).

Now, let's setup default dim settings.  We'll do so by adding the following settings:

Code Block
# dim settings Dim inactive windows. (0.0 - 1.0)
inactive-dim = 0.2;
# exclude treats as always focused (doesn't dim)...
focus-exclude = [
  "ANTIDIM_FLAG@:8c",
  "_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'",
  "class_g = 'Cairo-clock'"
];

Note the focus-exclude rule array.  This defines rules for NOT applying dim on window types. 

...

We can apply arbitrary window properties on selected windows.  Compton will Picom will respect these rules (by property).  The ANTIDIM_FLAG@:8c rules above (in the focus-exclude array is an example of this).  To apply/remove this window property on a selected window add the following bindsyms to your i3.conf:

Code Block
# window dimming enable or disable (uses xdotool and xprop to set a anti-dim flag, which comptonpicom recognises in focus-exclude array) 
bindsym $mod+Mod1+a exec xprop -id $(xdotool getactivewindow) -f ANTIDIM_FLAG 8c -set ANTIDIM_FLAG 1; exec notify-send 'anti-dim set on window'
bindsym $mod+Mod1+d exec xprop -id $(xdotool getactivewindow) -remove ANTIDIM_FLAG; exec notify-send 'dim set on window'

...

For reference here is my ~/.config/comptonpicom.conf

View Git file
pathcomptonpicom/comptonpicom.conf
repository-id3
title~/.config/comptonpicom.conf
branchrefs/remotes/origin/master
linenumberstrue
collapsetrue

...

Although you can modify transparencies etc. by editing ~/.config/comptonpicom.conf, there's no functionality to increase or decrease transparencies 'on the fly' and for specific windows only.

...

Code Block
languagebash
# window transparency adjustment (and alias to restart comptonpicom)
bindsym $mod+Mod1+z exec transset-df -a --min 0.25 --dec 0.25
bindsym $mod+Mod1+x exec transset-df -a --inc 0.25
bindsym $mod+Mod1+c exec --no-startup-id comptonpicom -b

These shortcuts will increase or decrease transparency of the currently selected window by +/-25%.  You might notice I also have a shortcut (mod+alt+c) for comptonpicom, which will reset start/reset comptonpicom.  You'll see why next.

I prefer my sticky windows to be opaque by default, and using the above I can then change them to suit. To change the default window transparency used for sticky windows you'll need to modify your compton picom config (~/.config/comptonpicom.conf) and make sure it contains 

...

This works to my liking.  However, I've found that when I want to change my sticky window back to opaque, my default inactive-opacity setting for compton kicks picom kicks in (in other words, when I select something else my sticky window is not quite opaque).  Resetting compton picom with mod+alt+c fixes this and reapplies my default transparency setting for sticky windows.

For reference here is my ~/.config/comptonpicom.conf

View Git file
pathcomptonpicom/comptonpicom.conf
repository-id3
title~/.config/comptonpicom.conf
branchrefs/remotes/origin/master
linenumberstrue
collapsetrue

...