You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Kubuntu 16.04下是否有命令可修改活动窗口透明度(支持脚本与快捷键)

Adjust Active Window Transparency via Command in Kubuntu 16.04

Absolutely! Since Kubuntu 16.04 runs KDE Plasma 5 with KWin as its window manager, you have two solid command-line options to tweak active window transparency—ideal for scripting or binding to keyboard shortcuts.

KWin exposes a DBus API that lets you directly control the current active window's opacity. This is the most reliable method for KDE systems, as it integrates natively with the window manager.

To set the active window to 80% opacity (20% transparent), run this command:

qdbus org.kde.kwin /KWin setCurrentWindowOpacity 0.8
  • Replace 0.8 with any value between 0 (fully transparent) and 1 (fully opaque) to fine-tune the effect.
  • This command works instantly and uses tools pre-installed in Kubuntu 16.04, so no extra packages needed.

Method 2: Use X11's xprop Tool (Generic X11 Approach)

If you prefer a more X11-agnostic method that works across most window managers, xprop lets you modify the window's opacity property directly.

Here's a one-liner to set the active window to 80% opacity:

xprop -id $(xprop -root _NET_ACTIVE_WINDOW | awk '{print $5}') -f _NET_WM_WINDOW_OPACITY 32c -set _NET_WM_WINDOW_OPACITY $(printf 0x%x $((0xffffffff * 80 / 100)))
  • Adjust the 80 to your desired opacity percentage (e.g., 60 for 60% opaque/40% transparent).
  • The value 0xffffffff represents full opacity; multiplying it by your percentage (divided by 100) converts it to the hexadecimal format xprop requires.

Using These Commands in Scripts/Keyboard Shortcuts

  1. For Scripts: Save either command in a shell script (e.g., adjust_window_opacity.sh), make it executable with chmod +x adjust_window_opacity.sh, and run it whenever you need to adjust transparency.
  2. For Keyboard Shortcuts:
    • Open System Settings → Shortcuts → Custom Shortcuts.
    • Click Edit → New → Global Shortcut → Command/URL.
    • Name your shortcut (e.g., "Lower Active Window Opacity"), set a trigger like Ctrl+Alt+Down, and paste the command in the Action field.
    • Repeat for another shortcut to reset full opacity (e.g., Ctrl+Alt+Up with qdbus org.kde.kwin /KWin setCurrentWindowOpacity 1.0).

内容的提问来源于stack exchange,提问作者DK Bose

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:29:09