温馨提示×

debian compton如何设快捷键

小樊
45
2026-09-26 03:27:11
栏目: 智能运维

在 Debian 上,如果你使用的是 compton(现已常被称为 picom 的前身) 作为合成器,它本身不直接提供快捷键功能,通常需要配合窗口管理器(如 i3、Openbox、bspwm)或桌面环境(如 XFCE、KDE) 来设置快捷键。

下面按常见使用场景说明。


一、在 i3 / bspwm / 平铺WM 中设置 compton 快捷键

1. 启动/停止 compton

先确保 compton 可被执行:

which compton

2. 示例:i3 设置快捷键

编辑 ~/.config/i3/config:

bindsym $mod+Shift+c exec --no-startup-id pkill compton; exec --no-startup-id compton
bindsym $mod+Ctrl+c exec --no-startup-id pkill compton

说明:

  • $mod+Shift+c:重启 compton
  • $mod+Ctrl+c:关闭 compton

重新加载 i3:

$mod+Shift+r

二、用快捷键切换 compton 配置(如透明/模糊)

1. 准备两套配置

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

2. i3 示例

bindsym $mod+b exec --no-startup-id pkill compton; exec --no-startup-id compton --config ~/.config/compton-blur.conf
bindsym $mod+t exec --no-startup-id pkill compton; exec --no-startup-id compton --config ~/.config/compton.conf

三、在 XFCE / MATE 等桌面环境中

使用 xbindkeys(通用方案)

1. 安装

sudo apt install xbindkeys

2. 生成配置

xbindkeys --defaults > ~/.xbindkeysrc

3. 编辑 ~/.xbindkeysrc

示例(Ctrl+Alt+C 重启 compton):

"pkill compton; compton"
   control+alt + c

4. 启动 xbindkeys

xbindkeys

可加入:

  • 自动启动
  • ~/.xprofile

四、仅切换“透明度”快捷键(推荐做法)

如果你只是想用快捷键调节窗口透明度,compton 不支持,应使用窗口管理器功能:

i3 示例

bindsym $mod+plus  opacity plus 0.1
bindsym $mod+minus opacity minus 0.1

五、常见问题

compton 没反应?

  • 确认是否运行:ps aux | grep compton
  • 查看日志:compton --log-level trace

Debian 新版本建议

Debian 11+ 更推荐:

sudo apt install picom

命令为 picom,配置兼容 compton。


如果你能告诉我:

  • 使用的 桌面环境 / 窗口管理器
  • 想用快捷键 做什么(开关 / 重启 / 切配置 / 调透明)

我可以给你精确到配置文件的方案。

0 踩