首页主机资讯Compton在Debian上的自定义主题支持

Compton在Debian上的自定义主题支持

时间2025-10-23 08:35:03发布访客分类主机资讯浏览538
导读:Note: The original Compton project is no longer actively maintained, and most modern Linux distributions (including Debi...

Note: The original Compton project is no longer actively maintained, and most modern Linux distributions (including Debian) have switched to Picom (a fork of Compton) as the default window compositor. The steps below are adapted for Picom, which retains compatibility with most Compton configuration options.

1. Install Picom on Debian

Before customizing themes, ensure Picom is installed. Run the following command to install it via APT:

sudo apt update &
    &
     sudo apt install picom

2. Create or Edit the Picom Configuration File

Picom’s configuration file is typically located at ~/.config/picom/picom.conf. If the directory or file doesn’t exist, create it:

mkdir -p ~/.config/picom
nano ~/.config/picom/picom.conf

3. Customize Theme Parameters

Edit the configuration file to define your theme. Key parameters for theming include:

  • Colors: Set background, foreground, and border colors.
  • Transparency: Adjust window opacity and shadow opacity.
  • Shadows: Enable/disable shadows and exclude specific windows (e.g., dialogs, tooltips).
  • Effects: Enable fading, blur, or scaling.

Below is an example configuration for a dark theme:

# Enable shadows (exclude dialogs and tooltips)
shadow = true;
    
shadow-exclude = [
    "window_type = 'dialog'",
    "window_type = 'dropdown_menu'",
    "window_type = 'tooltip'"
];
    
shadow-color = "#000000";
    
shadow-opacity = 0.3;
    
shadow-offset-x = 0;
    
shadow-offset-y = 2;
    

# Set background and foreground colors
background = "#1e1e1e";
    
foreground = "#d4d4d4";
    

# Window opacity (0.0 = fully transparent, 1.0 = opaque)
opacity = 0.95;
    
inactive-opacity = 0.8;
    

# Border settings
border-width = 1px;
    
border-color = "#4e4e4e";
    

# Fading effects
fade = true;
    
fade-in-step = 0.05;
    
fade-out-step = 0.05;
    

# Blur effect (set to 0 to disable)
blur = true;
    
blur-radius = 5;
    
blur-background = true;
    

4. Apply the Custom Theme

After saving the configuration file, restart Picom to apply the changes:

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

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

5. Optional: Advanced Customization with Lua

For advanced theming (e.g., dynamic effects, per-window customization), you can use a Lua script. Install Lua and create a script file (e.g., ~/.config/picom/picom.lua):

sudo apt install lua5.3
nano ~/.config/picom/picom.lua

Add custom logic (example: dynamic shadow adjustment based on window type):

local ffi = require("ffi")
local libpicom = ffi.load("libpicom")

-- Custom shadow exclusion
libpicom.shadow_exclude = {

    {
x = 0, y = 0, width = 1920, height = 1080}
,  -- Exclude primary display
    {
x = 1920, y = 0, width = 3840, height = 1080}
  -- Exclude secondary display
}
    

-- Dynamic opacity for specific windows
libpicom.opacity = function(window)
    if window.class == "Firefox" then
        return 0.9  -- Slightly more transparent for Firefox
    else
        return 0.95  -- Default opacity
    end
end

Modify your Picom command to use the Lua script:

pkill picom &
    &
     picom -b --config ~/.config/picom/picom.conf -l ~/.config/picom/picom.lua

6. Autostart Picom on Login

To ensure Picom starts automatically when you log in, add it to your desktop environment’s startup applications:

  • GNOME/KDE: Open “Startup Applications” and add a new entry with the command:
    picom -b --config ~/.config/picom/picom.conf
    
  • Systemd (for all users): Create a systemd user service (optional but recommended for advanced users):
    nano ~/.config/systemd/user/picom.service
    
    Add the following content:
    [Unit]
    Description=Picom Compositor
    After=graphical.target
    
    [Service]
    ExecStart=/usr/bin/picom -b --config ~/.config/picom/picom.conf
    Restart=always
    
    [Install]
    WantedBy=default.target
    
    Enable and start the service:
    systemctl --user enable picom &
        &
         systemctl --user start picom
    

By following these steps, you can fully customize Picom’s appearance and behavior on Debian. The process is similar to Compton, but Picom offers better maintenance and compatibility with modern systems.

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: Compton在Debian上的自定义主题支持
本文地址: https://pptw.com/jishu/733076.html
Compton在Debian上的安全性分析 Debian中Compton与其他显示管理器的集成

游客 回复需填写必要信息