From cdb33d39b135e9daf49df17be7d7006a9747e599 Mon Sep 17 00:00:00 2001 From: Benoit de Chezelles Date: Wed, 26 Aug 2026 01:01:15 +0200 Subject: [PATCH] docs: Add dedicated pages for window_background_{opacity,image{,_hsb}} --- docs/config/appearance.md | 74 ++------------- docs/config/lua/config/background.md | 8 +- .../lua/config/kde_window_background_blur.md | 7 +- .../config/macos_window_background_blur.md | 6 +- .../config/wayland_window_background_blur.md | 4 +- .../lua/config/win32_system_backdrop.md | 4 +- .../lua/config/window_background_gradient.md | 7 +- .../lua/config/window_background_image.md | 39 ++++++++ .../lua/config/window_background_image_hsb.md | 48 ++++++++++ .../lua/config/window_background_opacity.md | 90 +++++++++++++++++++ docs/config/lua/config/window_decorations.md | 2 +- 11 files changed, 206 insertions(+), 83 deletions(-) create mode 100644 docs/config/lua/config/window_background_image.md create mode 100644 docs/config/lua/config/window_background_image_hsb.md create mode 100644 docs/config/lua/config/window_background_opacity.md diff --git a/docs/config/appearance.md b/docs/config/appearance.md index 8c3a53011..6462744bf 100644 --- a/docs/config/appearance.md +++ b/docs/config/appearance.md @@ -451,48 +451,9 @@ reduce it by half, and 2.0 will double the value. {{since('20201031-154415-9614e117')}} -You can attach an image to the background of the wezterm window: - -```lua -config.window_background_image = '/path/to/wallpaper.jpg' -``` - -If the path is a relative path then it will be expanded relative -to the directory containing your `wezterm.lua` config file. - -PNG, JPEG, GIF, BMP, ICO, TIFF, PNM, DDS, TGA and farbfeld files -can be loaded. Animated GIF and PNG files will animate while -the window has focus. - -The image will be scaled to fit the window contents. Very large -images may decrease render performance and take up VRAM from the -GPU, so you may wish to resize the image file before using it. - -You can optionally transform the background image by specifying -a hue, saturation, brightness multiplier: - -```lua -config.window_background_image = '/path/to/wallpaper.jpg' - -config.window_background_image_hsb = { - -- Darken the background image by reducing it to 1/3rd - brightness = 0.3, - - -- You can adjust the hue by scaling its value. - -- a multiplier of 1.0 leaves the value unchanged. - hue = 1.0, - - -- You can adjust the saturation also. - saturation = 1.0, -} -``` - -See [Styling Inactive Panes](#styling-inactive-panes) for more information -on hue, saturation, brightness transformations. - -If you'd like to have control over scaling, tiling/repeating, scrolling -behavior and more, take a look at the more powerful -[background](lua/config/background.md) configuration option. +See [window_background_image](lua/config/window_background_image.md) and +[window_background_image_hsb](lua/config/window_background_image_hsb.md) +for configuration information on background images. ## Window Background Gradient @@ -507,34 +468,17 @@ for configuration information on gradients. {{since('20201031-154415-9614e117')}} -If your Operating System provides Compositing support then WezTerm is able to -specify the alpha channel value for the background content, rendering the -window background translucent (some refer to this as transparent rather than -translucent) and causing the windows/desktop behind it to show through the -window. - -macOS, Windows and Wayland support compositing out of the box. X11 may require -installing or configuring a compositing window manager. XWayland under -Mutter/Wayland also works without any additional configuration. - -`window_background_opacity` specifies the alpha channel value -with floating point numbers in the range `0.0` (meaning completely -translucent/transparent) through to `1.0` (meaning completely opaque). - -Setting this to a value other than the default `1.0` may impact render -performance. - -```lua -config.window_background_opacity = 1.0 -``` +See [window_background_opacity](lua/config/window_background_opacity.md) +for configuration information on opacity. ## Text Background Opacity {{since('20201031-154415-9614e117')}} -When using a background image or background opacity, the image content can -have relatively low contrast with respect to the text you are trying to -read in your terminal. +When using a [background image](lua/config/window_background_image.md) or +[background opacity](lua/config/window_background_opacity.md), the image +content can have relatively low contrast with respect to the text you are +trying to read in your terminal. The `text_background_opacity` setting specifies the alpha channel value to use for the background color of cells other than the default background color. diff --git a/docs/config/lua/config/background.md b/docs/config/lua/config/background.md index 16ae9eeff..0172ef3f5 100644 --- a/docs/config/lua/config/background.md +++ b/docs/config/lua/config/background.md @@ -84,10 +84,10 @@ A source can be one of the following: Specifying the following options: -* `window_background_gradient` -* `window_background_image` -* `window_background_opacity` -* `window_background_image_hsb` +* [window_background_gradient](window_background_gradient.md) +* [window_background_image](window_background_image.md) +* [window_background_opacity](window_background_opacity.md) +* [window_background_image_hsb](window_background_image_hsb.md) will implicitly prepend a layer to the `background` configuration with width and height set to 100%. diff --git a/docs/config/lua/config/kde_window_background_blur.md b/docs/config/lua/config/kde_window_background_blur.md index da4b60fc2..4290a152c 100644 --- a/docs/config/lua/config/kde_window_background_blur.md +++ b/docs/config/lua/config/kde_window_background_blur.md @@ -6,10 +6,11 @@ tags: {{since('nightly')}} -*Deprecated; this option was added & deprecated in the same version. Use [wayland_window_background_blur](wayland_window_background_blur.md) instead* +*Deprecated; this option was added & deprecated in the same version. +Use [wayland_window_background_blur](wayland_window_background_blur.md) instead* -When combined with `window_background_opacity`, enables background blur -using the KDE Wayland blur protocol. +When combined with [window_background_opacity](window_background_opacity.md), +enables background blur using the KDE Wayland blur protocol. This can be used to produce a translucent window effect rather than a crystal clear transparent window effect. diff --git a/docs/config/lua/config/macos_window_background_blur.md b/docs/config/lua/config/macos_window_background_blur.md index a5b3daf01..fb70237c3 100644 --- a/docs/config/lua/config/macos_window_background_blur.md +++ b/docs/config/lua/config/macos_window_background_blur.md @@ -6,14 +6,14 @@ tags: {{since('20230326-111934-3666303c')}} -When combined with `window_background_opacity`, configures the blur radius -amount used by macOS when compositing the window on the screen. +When combined with [window_background_opacity](window_background_opacity.md), +configures the blur radius amount used by macOS when compositing the window on +the screen. This can be used to produce a translucent window effect rather than a crystal clear transparent window effect. The screenshot below was achieved using this configuration: - ```lua config.window_background_opacity = 0.3 config.macos_window_background_blur = 20 diff --git a/docs/config/lua/config/wayland_window_background_blur.md b/docs/config/lua/config/wayland_window_background_blur.md index 19c4404cc..26bbdf877 100644 --- a/docs/config/lua/config/wayland_window_background_blur.md +++ b/docs/config/lua/config/wayland_window_background_blur.md @@ -4,8 +4,8 @@ tags: --- # wayland_window_background_blur = false -When combined with `window_background_opacity`, enables background blur -using the Wayland background effect protocol. +When combined with [window_background_opacity](window_background_opacity.md), +enables background blur using the Wayland background effect protocol. This can be used to produce a translucent window effect rather than a crystal clear transparent window effect. diff --git a/docs/config/lua/config/win32_system_backdrop.md b/docs/config/lua/config/win32_system_backdrop.md index c9dfe32f4..3927f576a 100644 --- a/docs/config/lua/config/win32_system_backdrop.md +++ b/docs/config/lua/config/win32_system_backdrop.md @@ -7,8 +7,8 @@ tags: {{since('20230712-072601-f4abf8fd')}} -When combined with `window_background_opacity`, chooses from available -window background effects provided by Windows. +When combined with [window_background_opacity](window_background_opacity.md), +chooses from available window background effects provided by Windows. The possible values for `win32_system_backdrop` are: diff --git a/docs/config/lua/config/window_background_gradient.md b/docs/config/lua/config/window_background_gradient.md index 3c9c65066..06aeabf5e 100644 --- a/docs/config/lua/config/window_background_gradient.md +++ b/docs/config/lua/config/window_background_gradient.md @@ -7,9 +7,10 @@ tags: {{since('20210814-124438-54e29167')}} -Dynamically generates a `window_background_image` from the provided gradient -specification. When `window_background_gradient` is configured, the value -for `window_background_image` is ignored. +Dynamically generates a [window_background_image](window_background_image.md) from the provided +gradient specification. +When `window_background_gradient` is configured, the value for `window_background_image` is +ignored. Linear gradients with vertical or horizontal orientation are supported: diff --git a/docs/config/lua/config/window_background_image.md b/docs/config/lua/config/window_background_image.md new file mode 100644 index 000000000..ec8d11358 --- /dev/null +++ b/docs/config/lua/config/window_background_image.md @@ -0,0 +1,39 @@ +--- +tags: + - appearance + - background +--- +# `window_background_image` + +![Screenshot](../../../screenshots/wezterm-vday-screenshot.png) + +{{since('20201031-154415-9614e117')}} + +You can attach an image to the background of the wezterm window: +```lua +config.window_background_image = '/path/to/wallpaper.jpg' +``` + +If the path is a relative path then it will be expanded relative to the +directory containing your `wezterm.lua` config file. + +PNG, JPEG, GIF, BMP, ICO, TIFF, PNM, DDS, TGA and farbfeld files can be +loaded. Animated GIF and PNG files will animate while the window has focus. + +The image will be scaled to fit the window contents. Very large images may +decrease render performance and take up VRAM from the GPU, so you may wish to +resize the image file before using it. + +You can optionally transform the background image with a hue, saturation, +brightness multiplier, for example, to darken a bright wallpaper so that text +remains readable. +See [window_background_image_hsb](window_background_image_hsb.md). + +## Relationship with other options + +The background image is ignored when +[window_background_gradient](window_background_gradient.md) is set. + +To have control over scaling, tiling/repeating, scrolling behavior and more, +take a look at the more powerful [background](background.md) configuration +option. diff --git a/docs/config/lua/config/window_background_image_hsb.md b/docs/config/lua/config/window_background_image_hsb.md new file mode 100644 index 000000000..9866cbf37 --- /dev/null +++ b/docs/config/lua/config/window_background_image_hsb.md @@ -0,0 +1,48 @@ +--- +tags: + - appearance + - background +--- +# `window_background_image_hsb` + +{{since('20201031-154415-9614e117')}} + +Configures a Hue, Saturation, Brightness transformation that is applied to the +[window_background_image](window_background_image.md). + +The transform works by converting the RGB values of the image to HSV values and +then multiplying the HSV by the numbers specified in `window_background_image_hsb`. + +Modifying the hue changes the hue of the color by rotating it through the color +wheel. +_It is not as useful as the other components, but is available "for free" as part +of the colorspace conversion._ + +Modifying the saturation can add or reduce the amount of "colorfulness". +Making the value smaller can make it appear more washed out. + +Modifying the brightness can be used to dim or increase the perceived amount of +light. + +The range of these values is 0.0 and up; they are used to multiply the existing +values, so the default of 1.0 preserves the existing component, whilst 0.5 will +reduce it by half, and 2.0 will double the value. + +```lua +config.window_background_image = '/path/to/wallpaper.jpg' + +config.window_background_image_hsb = { + -- Darken the background image by reducing it to 1/3rd + brightness = 0.3, + + -- You can adjust the hue by scaling its value. + -- a multiplier of 1.0 leaves the value unchanged. + hue = 1.0, + + -- You can also adjust the saturation. + saturation = 1.0, +} +``` + +The same kind of transformation can be applied to monochrome glyphs with +[foreground_text_hsb](foreground_text_hsb.md). diff --git a/docs/config/lua/config/window_background_opacity.md b/docs/config/lua/config/window_background_opacity.md new file mode 100644 index 000000000..8f575d110 --- /dev/null +++ b/docs/config/lua/config/window_background_opacity.md @@ -0,0 +1,90 @@ +--- +tags: + - appearance + - background +--- +# `window_background_opacity = 1.0` + +{{since('20201031-154415-9614e117')}} + +Specifies the alpha channel value for the window background. +If your Operating System provides compositing support, the window background +is rendered translucent (some refer to this as transparent rather than +translucent), causing the windows and desktop behind it to show through. + +The value is a floating point number in the range `0.0` (completely +translucent/transparent) through to `1.0` (completely opaque), which is the +default. + +```lua +config.window_background_opacity = 0.8 +``` + +The opacity also applies to the +[window_background_image](window_background_image.md) and +[window_background_gradient](window_background_gradient.md) layers. + +## Performance + +Setting `window_background_opacity` to a value other than the default `1.0` +may impact render performance. + +## Platform support + +macOS, Windows and Wayland support compositing out of the box. +X11 may require installing or configuring a compositing window manager. +XWayland under Mutter/Wayland also works without any additional configuration. + +On macOS, the window shadow is disabled automatically when the opacity is +set to less than `1.0`. You can re-enable it by adding `MACOS_FORCE_ENABLE_SHADOW` +to [window_decorations](window_decorations.md). + +## Blur and backdrop effects + +Opacity can be combined with operating system blur effects for a frosted +glass look rather than a crystal clear view of the desktop: + +- [macos_window_background_blur](macos_window_background_blur.md) +- [wayland_window_background_blur](wayland_window_background_blur.md) +- [win32_system_backdrop](win32_system_backdrop.md) + +For example, on macOS: +```lua +config.window_background_opacity = 0.3 +config.macos_window_background_blur = 20 +``` + +On Windows, you need to reduce the opacity below `1.0` for +`win32_system_backdrop` effects to work. For best results with the `"Mica"` +and `"Tabbed"` effects, set it to `0`. + +With a backdrop effect you may want to raise the opacity of the non-default +background colors to keep text readable. +See [text_background_opacity](../../appearance.md#text-background-opacity). + +## Toggling opacity at runtime + +A common use case for opacity is to quickly peek at the desktop or another +window behind the terminal, and to toggle back to opaque for normal work. + +```lua +return { + keys = { + { + key = 'o', + mods = 'CTRL', + action = wezterm.action_callback(function(window, pane) + local overrides = window:get_config_overrides() or {} + if not overrides.window_background_opacity then + -- no override yet, set the opacity + overrides.window_background_opacity = 0.5 + else + -- else we override already, reset opacity to default from config + overrides.window_background_opacity = nil + end + window:set_config_overrides(overrides) + end) + }, + }, +} +``` diff --git a/docs/config/lua/config/window_decorations.md b/docs/config/lua/config/window_decorations.md index 04e5b1c26..31f58f11e 100644 --- a/docs/config/lua/config/window_decorations.md +++ b/docs/config/lua/config/window_decorations.md @@ -25,7 +25,7 @@ The value is a set of flags: * `MACOS_FORCE_ENABLE_SHADOW` - enable the window shadow effect. The window shadow effect is normally disabled by wezterm when the - [window_background_opacity](../../appearance.md#window-background-opacity) is set + [window_background_opacity](window_background_opacity.md) is set to less than `1.0`. {{since('20230408-112425-69ae8472', outline=true)}}