最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
Compton与Wayland怎样搭配
时间:2026-07-18 09:27:01 编辑:袖梨 来源:一聚教程网
Installing ComptonCompton can be installed using your distribution’s package manager. For Debian/Ubuntu-based systems, run:

sudo apt update && sudo apt install comptonFor Arch-based systems (e.g., Manjaro), use:
sudo pacman -S comptonThis installs the latest version of Compton compatible with your system.
Configuring Compton for WaylandCompton’s configuration file is typically located at ~/.config/compton.conf (create it if it doesn’t exist). To enable Wayland support, add or modify the following key:
backend = "wayland";Additional optimizations (optional but recommended) include enabling shadows (with exclusions for performance) and transparency:
shadow = true;shadow-exclude = ["WINDOW_CLASS=.*Firefox", "WINDOW_CLASS=.*Chrome"];# Exclude resource-heavy appsglx-no-stencil = true;# Improves performancealpha-threshold = 0.05;# Sets transparency thresholdSave the file after editing.
Switching to a Wayland SessionMost Linux distributions allow you to choose between X11 and Wayland at login. On the login screen, click the gear icon (or equivalent) next to your username and select a Wayland session (e.g., “GNOME on Wayland” or “KDE Plasma on Wayland”). This ensures Compton runs under the Wayland display server.
Starting Compton AutomaticallyTo start Compton when your system boots, create a Systemd service file:
sudo nano /etc/systemd/system/compton.serviceAdd the following content (replace your_username with your actual username):
[Unit]Description=Compton Window CompositorAfter=display-manager.service[Service]ExecStart=/usr/bin/compton --config ~/.config/compton.confRestart=alwaysUser=your_username[Install]WantedBy=multi-user.targetSave the file, then enable and start the service:
sudo systemctl daemon-reloadsudo systemctl enable comptonsudo systemctl start comptonYou can verify Compton is running with:
systemctl status comptonAlternatively, add Compton to your desktop environment’s autostart (e.g., GNOME: ~/.config/autostart/compton.desktop).
Troubleshooting Compatibility IssuesSome Wayland applications (notably input method frameworks like Fcitx5) may not work seamlessly with Compton. To resolve this:
- Exclude Input Method Windows: Add their window class to
shadow-excludeincompton.conf(e.g.,WINDOW_CLASS=.*Fcitx). - Use XWayland Fallback: If an app fails to render, launch it with
GTK_USE_PORTAL=1(e.g.,GTK_USE_PORTAL=1 firefox) to force it into XWayland mode, which Compton handles better.
相关文章
- Ruby的面向对象方式编程学习杂记 09-23
- 解析proxy代理模式在Ruby设计模式开发中的运用 09-23
- 深入剖析Ruby设计模式编程中对命令模式的相关使用 09-23
- 详解组合模式的结构及其在Ruby设计模式编程中的运用 09-23
- 设计模式中的模板方法模式在Ruby中的应用实例两则 09-23
- 借助RubyGnome2库进行GTK下的Ruby GUI编程的基本方法 09-23