Compton Configuration Options for Ubuntu
Compton is a lightweight window compositor for X11 that enhances desktop visuals with effects like transparency, shadows, and fading. Below is a structured guide to its key configuration options, setup steps, and optimization tips for Ubuntu.
Before configuring, install Compton using Ubuntu’s package manager:
sudo apt update && sudo apt install compton
Compton’s primary user-specific config file is located at ~/.config/compton.conf
. If it doesn’t exist, create it with a text editor (e.g., nano ~/.config/compton.conf
). System-wide configs can be found at /etc/xdg/compton.conf
(for all users) or ~/.compton.conf
(legacy path).
Below are essential options to customize Compton’s behavior, grouped by category:
backend
: Defines the rendering backend. Choose between:
xrender
(default, better compatibility but slower)glx
(faster performance, recommended for modern GPUs).backend = "glx"
.vsync
: Enables vertical synchronization to reduce screen tearing. Set to true
(recommended) or false
. For better performance, use vsync = "opengl-swc"
(OpenGL swapchain wait).shadow
: Toggles window shadows. Set to true
to enable (with customizable radius/offset) or false
to disable (improves performance). Example: shadow = true
.opacity
: Controls window transparency. Use inactive-opacity
(for inactive windows, e.g., 0.8
) and active-opacity
(for active windows, e.g., 1.0
). Set to 1.0
to disable transparency entirely.ignore_root
: Ignores transparency for the root window (prevents issues in some desktop environments like GNOME). Set to true
if you experience graphical glitches.shadow-radius
: Adjusts shadow blurriness (default: 12
). Lower values make shadows sharper; higher values create a softer effect.shadow-offset-x/y
: Sets shadow offset from the window edge (default: -15
for both). Negative values place shadows inside the window; positive values place them outside.shadow-opacity
: Controls shadow transparency (default: 0.75
). Lower values make shadows fainter; higher values make them more pronounced.fade-in/out
: Enables window fade effects when opening/closing. Set to true
for smooth transitions (recommended) or false
to disable.fade-delta
: Adjusts fade speed (default: 5
). Lower values make fades faster; higher values make them slower.glx-no-stencil
: Disables stencil buffer usage (reduces GPU memory load). Set to true
for better performance on older GPUs.glx-no-rebind-pixmap
: Prevents unnecessary pixmap rebinding (improves frame rate). Set to true
.xrender-sync-fence
: Enables X11 sync fences (reduces tearing with xrender
backend). Set to true
if using backend = "xrender"
.unredir-if-possible
: Disables composition for fullscreen windows (e.g., games) to improve performance. Set to true
and add exceptions (e.g., media players) to unredir-if-possible-exclude
.max-cpu-usage
: Caps CPU usage (default: 80%
). Set to a lower value (e.g., 60
) if Compton is consuming too many resources.shadow-exclude
: Excludes specific windows from shadows (e.g., notifications, docks). Use a list of conditions:shadow-exclude = [
"name = 'Notification'",
"class_g = 'Conky'",
"class_g = 'Cairo-clock'"
];
opacity-rule
: Sets transparency for specific applications. Use class names (find them with xprop | grep WM_CLASS
):opacity-rule = [
"90:class_g = 'Alacritty'", # Terminal at 90% opacity
"80:class_g = 'URxvt'" # Another terminal at 80%
];
After editing the config file, restart Compton to apply changes:
pkill compton && compton -b
For Systemd users (to auto-start Compton on boot), create a service file:
sudo nano /etc/systemd/system/compton.service
Add this content (replace with your config path if needed):
[Unit]
Description=Compton Window Composer
After=xorg.service
[Service]
ExecStart=/usr/bin/compton --config /home/yourusername/.config/compton.conf
Restart=on-failure
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton
vsync
is enabled (vsync = "opengl-swc"
) and try different backends (glx
vs. xrender
).shadow = false
, fade-in/out = false
) and optimize GPU usage with glx-no-stencil = true
.shadow-exclude
or opacity-rule
(e.g., Conky, notification daemons).This guide covers the most essential Compton options for Ubuntu users. For advanced customization, refer to the official documentation or run compton --help
to explore additional parameters.