Make WezTerm Transparent: Windows-focused Guide
WezTerm is a powerful terminal emulator that supports the Wayland protocol, providing a modern and feature-rich terminal experience. One of its notable features is the ability to run transparently, which means the terminal window blends with the background of your desktop. In this article, we'll focus on making WezTerm transparent on Windows.
Prerequisites
Before we dive into the steps, make sure you have the following prerequisites in place:
- WezTerm installed.
- Windows 10 version 2004 or later.
- A compatible terminal multiplexer like Mux.
Install WezTerm
If you haven't installed WezTerm yet, you can download it from the official website: https://wezfurlong.org/wezterm/
Follow the installation instructions for your specific platform (Windows in our case). After installation, you can launch WezTerm from the Start menu.
Install Mux
Mux is a terminal multiplexer that allows you to manage multiple terminal sessions within a single window. It's a popular choice for managing WezTerm sessions, and it's required for the transparent feature.
To install Mux, follow these steps:
- Open PowerShell as an administrator.
- Run the following command to install the Chocolatey package manager:
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
- Install Mux using Chocolatey:
choco install mux
Configure WezTerm
First, let's create a configuration file for WezTerm. Create a new file named "config.lua" in the following directory:
%USERPROFILE%\.config\wezterm
Open the file in your favorite text editor and add the following content:
local wezterm = require("wezterm") local mux = wezterm.mux
wezterm.on("update-config", function(config, screen) mux.new({ domain = "mux.wezterm.local", on_attach = function(workspace) wezterm.send_key("M-x mux manage", "S-m") end }, { name = "Transparent Terminal" }) end)
Save the file and close the text editor.
Make WezTerm Transparent
Now, let's modify the configuration to make WezTerm transparent:
Open the "config.lua" file in your text editor and add the following lines:
wezterm.on("activate", function(args) local window = wezterm.workspace_window(args.target) if window then local workspace = window:get_active_tab() local title = workspace:get_title() if title then local window_id = window:get_id() local window_info = wezterm.workspace_window_info(window_id) local x, y, width, height = window_info.x, window_info.y, window_info.width, window_info.height
wezterm.call("view-config", { window = { background = { type = "image", src = "%USERPROFILE%\.config\wezterm\transparent.png", scale = 1.0, x = x, y = y, width = width, height = height }, }, tab = { background = { type = "image", src = "%USERPROFILE%\.config\wezterm\transparent.png", scale = 1.0, x = 0, y = 0, width = 1, height = 1 } } }) end end end)
Save the file and close the text editor.
Create Transparent Image
We need a transparent image to use as the background for our terminal. You can create a 1x1 pixel transparent PNG image using an image editor like GIMP or Photoshop. Save the image in the following directory:
%USERPROFILE%\.config\wezterm
Name the file "transparent.png".
Launch WezTerm
Now, launch WezTerm from the Start menu. The terminal window should appear transparent, blending with your desktop background.
Summary
In this article, we've covered the steps to make WezTerm transparent on Windows. We've installed WezTerm and Mux, created a configuration file, and made the terminal window transparent using an image as the background.