Results 1 to 10 of 15

Thread: Howto: Using Compton for tear-free compositing on XFCE or LXDE

Threaded View

  1. #1
    Join Date
    May 2007
    Location
    Vermont
    Beans
    869
    Distro
    Ubuntu

    Howto: Using Compton for tear-free compositing on XFCE or LXDE

    I've always grappled with one major issues when using lightweight DE's like XFCE or LXDE: Video tearing. For me there is nothing more annoying then seeing tearing when watching video in my local video player or in flash player, and seeing ugly tearing when scrolling in firefox. XFCE's built-in xrender based compositor does nothing but exacerbate the issue, and the intel driver's "TearFree" option performs rather poorly.

    The obvious solution to this is using an opengl compositor. In the past I had been using compiz in XFCE, which worked but left a lot to be desired when it came to integrating with XFCE and general bugginess; and the last straw is that in 13.04 it seems rather unusable when used outside of unity (severe bugs such as unclickable window decorations), so I searched for another solution. I then found compton: https://github.com/chjj/compton. Compton is a very lightweight compositor that is based on xcompmgr (its a fork of xcompmgr-dana). Compton features a stable opengl backend and working vsync (It also has an xrender backend, but for the purpose of getting tear-free output the opengl backend is recommended). Compton is an excellent fit for XFCE or LXDE because it is very lightweight and it does not need to replace your window manager like compiz does, it purely provides compositing.

    The first thing you will want to do is install compton. The compton maintainer has a ppa for compton here: https://launchpad.net/~richardgv/+archive/compton. To add the ppa to your system and install compton, open the terminal and enter the following commands: sudo apt-add-repository ppa:richardgv/compton and sudo apt-get update && sudo apt-get install compton

    Next you will want to create your compton config file. Save the file as "~/.compton.conf". Here is the config file I use, I've added a few detailed comments explaining the most important things:

    Code:
    backend = "glx";
    paint-on-overlay = true;
    glx-no-stencil = true;
    glx-no-rebind-pixmap = true;
    vsync = "opengl-swc"; 
    
    # These are important. The first one enables the opengl backend. The last one is the vsync method. Depending on the driver you might need to use a different method.
    # The other options are smaller performance tweaks that work well in most cases. 
    # You can find the rest of the options here: https://github.com/chjj/compton/wiki/perf-guide, and here: https://github.com/chjj/compton/wiki/vsync-guide
    
    
    # Shadow
    shadow = true;			# Enabled client-side shadows on windows.
    no-dock-shadow = true;		# Avoid drawing shadows on dock/panel windows.
    no-dnd-shadow = true;		# Don't draw shadows on DND windows.
    clear-shadow = true;		# Zero the part of the shadow's mask behind the window (experimental).
    shadow-radius = 7;		# The blur radius for shadows. (default 12)
    shadow-offset-x = -7;		# The left offset for shadows. (default -15)
    shadow-offset-y = -7;		# The top offset for shadows. (default -15)
    shadow-exclude = [
     "! 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'"
    ];
    
    # The shadow exclude options are helpful if you have shadows enabled. Due to the way compton draws its shadows, certain applications will have visual glitches 
    # (most applications are fine, only apps that do weird things with xshapes or argb are affected). 
    # This list includes all the affected apps I found in my testing. The "! name~=''" part excludes shadows on any "Unknown" windows, this prevents a visual glitch with the XFWM alt tab switcher.
    
    # Fading
    fading = true; # Fade windows during opacity changes.
    fade-delta = 4; # The time between steps in a fade in milliseconds. (default 10).
    fade-in-step = 0.03; # Opacity change between steps while fading in. (default 0.028).
    fade-out-step = 0.03; # Opacity change between steps while fading out. (default 0.03).
    #no-fading-openclose = true; # Fade windows in/out when opening/closing
    
    detect-client-opacity = true; # This prevents opacity being ignored for some apps. For example without this enabled my xfce4-notifyd is 100% opacity no matter what.
    
    # Window type settings
    wintypes:
    {
      tooltip = { fade = true; shadow = false; };
    };
    Now you are ready to set compton to start automatically upon login.

    For XFCE/xubuntu:

    Open the XFCE settings manager: settings manager > session and startup > application autostart > add and add compton -b. Now compton will start automatically when you login.

    For LXDE/lubuntu:

    edit this file: ~/.config/lxsession/Lubuntu/autostart. You can just create the file if it does not exist:
    Code:
    mkdir -p ~/.config/lxsession/Lubuntu/
    touch ~/.config/lxsession/Lubuntu/autostart
    If you want to enable compton globally (for every user on the system), you can edit: /etc/xdg/lxsession/Lubuntu/autostart. Once the file is open in your text editor just add your startup command to it with an @ symbol in front of it, for example: @compton -b &

    (I don't use lubuntu/lxde so I haven't tested this myself, I've put this together from these sources: http://lubuntublog.blogspot.com/p/compton.html, https://help.ubuntu.com/community/Lu...g_into_Desktop)

    EDIT: Based on feedback I have moved all switches into the config file and simplified the guide.
    Last edited by screaminj3sus; August 14th, 2013 at 12:30 AM.
    Desktop: Windows 8 x64 | Intel Core i5-2500 | 16 GB DDR3 1333 | ATI 6950 2gb | 64gb Vertex 2/320gb/750gb/1tb hdd
    Laptop: System76 Lemur Ultra | Xubuntu 13.04 x64 | 2.5Ghz Intel Core i5-3210m | 8GB DDR31600 | Intel HD4000 | 500GB 7200rpm hybrid hdd

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •