ubuntu

Compton在Ubuntu中的设置方法

小樊
47
2025-10-07 20:08:34
栏目: 智能运维

Installing Compton on Ubuntu
To use Compton for enhanced window effects on Ubuntu, start by installing it via the 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. For newer versions or custom builds, you can compile from source (e.g., cloning the GitHub repository), but the package manager method is recommended for stability.

Configuring Compton
Compton’s configuration is managed via a text file, typically located at ~/.config/compton.conf. If this file doesn’t exist, create it using a text editor (e.g., nano):

mkdir -p ~/.config && nano ~/.config/compton.conf

Below are key configuration options to customize Compton’s behavior:

Save the file after editing. For detailed explanations of all options, refer to the official Compton documentation.

Applying Configuration Changes
After modifying the config file, restart Compton to apply the changes. Run the following command in the terminal:

pkill compton && compton -b --config ~/.config/compton.conf

The -b flag runs Compton in the background, and --config specifies the path to your custom config file.

Setting Up Compton to Start Automatically
To ensure Compton launches on system boot, create a systemd service file:

sudo nano /etc/systemd/system/compton.service

Add the following content to the file:

[Unit]
Description=Compton Window Compositor
After=graphical.target

[Service]
ExecStart=/usr/bin/compton --config /etc/compton.conf
Restart=on-failure

[Install]
WantedBy=graphical.target

Save the file, then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable compton
sudo systemctl start compton

This configures Compton to start automatically when you log in to your Ubuntu session.

Troubleshooting Common Issues

Check Compton’s logs for errors by running it in the foreground:

compton --config ~/.config/compton.conf

This will display real-time output that can help diagnose issues.

0
看了该问题的人还看了