ubuntu

Compton在Ubuntu上怎么用

小樊
56
2025-08-31 14:08:21
栏目: 智能运维

Installing Compton on Ubuntu
To use Compton on Ubuntu, start by installing it via the APT package manager (the most common method for Debian-based systems). Open a terminal and run:

sudo apt update && sudo apt install compton

This command updates your package list and installs Compton along with its dependencies. For users preferring Snap, you can install Compton via Snapcraft (though APT is recommended for better integration):

sudo snap install compton

After installation, verify it’s installed correctly by checking the version:

compton --version

Configuring Compton
Compton’s default configuration file is located at ~/.config/compton.conf (create it if it doesn’t exist). You can edit this file using a text editor like nano:

nano ~/.config/compton.conf

Key parameters to customize include:

Save changes and exit the editor (Ctrl+O, Enter, Ctrl+X in nano).

Starting and Enabling Compton
To start Compton manually, run:

compton &

The & runs it in the background. To stop Compton, find its process ID (PID) and kill it:

killall compton

For automatic startup on login, add Compton to your system’s startup applications:

  1. Open Startup Applications (search for it in the Ubuntu Dash).
  2. Click Add, enter a name (e.g., “Compton”), and set the command to compton --config ~/.config/compton.conf.
  3. Click Add and close the window.

Alternatively, create a Systemd service for Compton (advanced users):

  1. Create a service file:
    sudo nano /etc/systemd/system/compton.service
    
  2. Add the following content (replace ~ with your home directory path):
    [Unit]
    Description=Compton Window Compositor
    After=graphical.target
    
    [Service]
    ExecStart=/usr/bin/compton --config /home/your-username/.config/compton.conf
    Restart=always
    User=your-username
    
    [Install]
    WantedBy=multi-user.target
    
  3. Save and exit, then enable the service:
    sudo systemctl enable compton && sudo systemctl start compton
    

Troubleshooting Common Issues

0
看了该问题的人还看了