Skip to content

changeopacity

Bakkeby edited this page Feb 27, 2024 · 3 revisions
Function Expected argument Default keybindings
changeopacity float, e.g. -0.10 or 0.10 Super+shift+plus, Super+Shift+minus

The changeopacity function allows for the opacity of a window to be changed during runtime.

changeopacity.gif

Note that this only works for compositors that support reading the _NET_WM_OPACITY property of X windows.

xcompmgr seems to work out of the box while picom will need this configuration item set to true:

# Detect '_NET_WM_OPACITY' on client windows, useful for window managers
# not passing '_NET_WM_OPACITY' of client windows to frame windows.
#
detect-client-opacity = true;

Also note that if you have opacity rules in picom such that a window is set to have 80% opacity then you can not make the window more opaque by setting the _NET_WM_OPACITY to, say, 90%.

The default keybindings increases or decreases opacity by 5 percent and by default the client will be opaque (100% opacity).

If in doubt one can check that the _NET_WM_WINDOW_OPACITY property has been set using xprop.

$ xprop | grep OPACITY
_NET_WM_WINDOW_OPACITY(CARDINAL) = 1288490142

The argument passed to the function is relative to the current opacity, i.e. 0.10 will increase the opacity by ten percent and -0.10 will decrease the opacity by ten percent.

The opacity of a client can also be set absolutely with argument values greater than 1.0 (in which case 1.0 is subtracted from the value used). E.g. passing 1.80 will set the opacity as 0.80 (80%).

The default opacity of windows is controlled by the defaultopacity setting in config.h.

External command:

$ duskc run_command changeopacity -0.10  # reduce opacity by 10%
$ duskc run_command changeopacity 0.10   # increase opacity by 10%
$ duskc run_command changeopacity 1.80   # explicitly set opacity to be 80%

Back to Functions > Window.

Clone this wiki locally