Installing Compton on Ubuntu
To begin, install Compton using Ubuntu’s package manager. Open a terminal and run:
sudo apt update && sudo apt install compton
This command installs the latest version of Compton available in Ubuntu’s repositories.
Configuring Compton for GNOME
Compton’s behavior is controlled by a configuration file typically located at ~/.config/compton.conf. If this directory or file doesn’t exist, create it:
mkdir -p ~/.config && nano ~/.config/compton.conf
Add the following essential settings to balance performance and aesthetics. These settings enable OpenGL rendering (for smoother animations), exclude Firefox from shadows (to avoid visual glitches), and enable fading for window transitions:
backend = "glx";
shadow-exclude = ["class='.*Firefox'"];
fade = true;
fade-delta = 30;
Save the file (Ctrl+O, Enter) and exit the editor (Ctrl+X). For advanced customization, refer to Compton’s official documentation to tweak parameters like shadow opacity (shadow-opacity), refresh rate (force-frame-rate), or transparency thresholds (alpha-threshold).
Starting Compton Automatically in GNOME
To ensure Compton launches every time you log into GNOME, add it to your startup applications. You can do this via the terminal or GNOME’s graphical interface:
- Graphical Method:
- Open Settings > Startup Applications.
- Click Add, enter a name (e.g., “Compton”), and set the command to:
compton --config ~/.config/compton.conf - Click Add to save.
- Terminal Method:
Run the following command to create a desktop entry in~/.config/autostart:This ensures Compton starts silently in the background with your custom configuration.echo -e "[Desktop Entry]\nType=Application\nExec=compton --config ~/.config/compton.conf\nHidden=false\nNoDisplay=false\nX-GNOME-Autostart-enabled=true\nName=Compton" > ~/.config/autostart/compton.desktop
Verifying the Setup
After logging out and back in (or running compton --config ~/.config/compton.conf manually), check if Compton is active. You should see window shadows (unless excluded) and smooth fade effects when minimizing/maximizing windows. If you encounter issues (e.g., window flickering), press Alt+F2, type r, and press Enter to restart GNOME Shell—this often resolves temporary glitches.
Troubleshooting Common Issues
- Black Screen/Performance Lag: Switch Compton’s backend from
glxtoxrenderin the configuration file (changebackend = "glx"tobackend = "xrender"). This reduces GPU load but may disable some advanced effects. - Missing Shadows: Ensure
shadow-excludedoesn’t include the application you want shadows for. For example, to add Chrome to the exclusion list, modify the line to:shadow-exclude = ["class='.*Firefox'", "class='.*Chrome'"]; - Compton Not Starting: Verify the configuration file path and permissions (should be readable by your user). Run
compton --config ~/.config/compton.conf --log-level debugto view detailed logs and identify errors.
以上就是关于“Ubuntu Compton与Gnome:完美搭配指南”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm