-
-
Notifications
You must be signed in to change notification settings - Fork 194
(Widget) Active Windows Title
github-actions edited this page Jun 23, 2026
·
11 revisions
Shows the title of the window you are currently using right in your status bar. You can format the text however you like, switch between different label styles, automatically hide titles for specific apps, rewrite text patterns using rules, and even display the app's icon.
| Option | Type | Default | Description |
|---|---|---|---|
label |
string | "{win[title]}" |
The label format for the active window. |
label_alt |
string | "[class_name='{win[class_name]}' exe='{win[process][name]}' hwnd={win[hwnd]}]" |
The alternative label format for the active window. |
class_name |
string | "" |
Additional CSS class name for the widget. |
label_no_window |
string | None |
The label to display when no window is active. |
label_icon |
boolean | true |
Whether to display an icon with the label. |
label_icon_size |
integer | 16 |
The size of the icon displayed with the label. |
max_length |
integer | None |
The maximum length of the label text. |
max_length_ellipsis |
string | "..." |
The ellipsis to use when the label text exceeds the maximum length. |
monitor_exclusive |
boolean | true |
Whether the widget should be exclusive to the monitor. |
ignore_window |
dict | {'classes': [], 'processes': [], 'titles': []} |
Windows to ignore based on class names, process names, and titles. |
callbacks |
dict | {'on_left': 'toggle_label', 'on_middle': 'do_nothing', 'on_right': 'do_nothing'} |
Callbacks for mouse events on the widget. |
rewrite |
dict | See below | Rewrite options for the widget. |
active_window:
type: "yasb.active_window.ActiveWindowWidget"
options:
label: "{win[title]}"
label_alt: "[class_name='{win[class_name]}' exe='{win[process][name]}' hwnd={win[hwnd]}]"
label_no_window: ""
label_icon: true
label_icon_size: 16
max_length: 56
max_length_ellipsis: "..."
monitor_exclusive: true
- label: The format string for the active window title. You can use placeholders to dynamically insert window information. See Label Format Placeholders below.
-
label_alt: The alternative format string for the active window. Useful for displaying additional window details. Supports the same placeholders as
label. - class_name: Additional CSS class name for the widget. This allows for custom styling.
- label_no_window: The text to display when no window is active. If not specified, it defaults to an empty string.
- label_icon: A boolean indicating whether to display the window icon.
- label_icon_size: The size of the window icon in pixels. Must be between 12px and 24px.
- max_length: The maximum number of characters to display for the window title. If the title exceeds this length, it will be truncated.
- max_length_ellipsis: The string to append to truncated window titles.
- monitor_exclusive: A boolean indicating whether the widget should be exclusive to a single monitor.
- ignore_window: A dictionary specifying which windows to ignore. It contains three lists: classes, processes, and titles.
-
callbacks: A dictionary specifying the callbacks for mouse events. The keys are
on_left,on_middle, andon_right, and the values are the names of the callback functions. -
rewrite: A dictionary containing rewrite options for the widget. Rewrite rules are applied to
title,process.name, andapp_name. See Rewrite Options below.
You can use the following placeholders in label and label_alt:
| Placeholder | Description | Example |
|---|---|---|
{win[title]} |
Window title | "Document1 - Microsoft Word" |
{win[app_name]} |
Friendly application name (resolved from process). | "Photos" |
{win[class_name]} |
Window class name | "Chrome_WidgetWin_1" |
{win[hwnd]} |
Window handle (HWND) | 1234567 |
{win[process][name]} |
Process executable name | "explorer.exe" |
{win[process][pid]} |
Process ID | 12345 |
{win[process][path]} |
Full path to the executable | "C:\Windows\explorer.exe" |
{win[monitor_hwnd]} |
Monitor handle | 65537 |
# Show just the window title
label: "{win[title]}"
# Show friendly app name
label: "{win[app_name]}"
# Show app name followed by window title
label: "{win[app_name]} - {win[title]}"
# Show process name and title
label: "{win[process][name]}: {win[title]}"
# Show detailed info on alt label
label_alt: "[{win[app_name]}] class='{win[class_name]}' exe='{win[process][name]}' pid={win[process][pid]}"The rewrite option allows you to supply a list of search-and-replace rules to be applied, in order, to the window title. Each rule is a dict with the following schema:
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
pattern |
string | yes | None | A Python regular expression to match against the raw window title. More Info |
replacement |
string | yes | None | The replacement text; can use backrefs like \1, \2, etc. |
case |
string | no | None | If specified, the replacement will be converted to the specified case. Allowed values: lower, upper, title, capitalize
|
active_window:
type: "yasb.active_window.ActiveWindowWidget"
options:
label: "{win[title]}"
# …
rewrite:
# Strip trailing “.exe” (case-insensitive) and lowercase:
- pattern: "^(.+?)\\.exe$"
replacement: "\\1"
case: lower
# Uppercase the literal word “Studio” anywhere in the title:
- pattern: "\\bStudio\\b"
replacement: "STUDIO"
# Replace any title like “…YASB Reborn - Foo” with “🌎 Foo”
- pattern: "(.*)YASB Reborn -(.*)$"
replacement: "🌎 \\2".active-window-widget {}
.active-window-widget.your_class {} /* If you are using class_name option */
.active-window-widget .widget-container {}
.active-window-widget .widget-container .label {}
.active-window-widget .widget-container .label.alt {}
.active-window-widget .widget-container .icon {}- Home
- Installation
- Configuration
- Keybindings
- Styling
- YASB CLI
- FAQ
- Contributing
- Writing Widget
- UI Components
- Widgets:
- Active Windows Title
- Ai Chat
- Applications
- Battery
- Bluetooth
- Brightness
- Cava
- Claude Usage
- Copilot
- CPU
- Clock
- Custom
- Github
- GlazeWM Binding Mode
- GlazeWM Tiling Direction
- GlazeWM Workspaces
- Glucose Monitor
- Grouper
- GPU
- Home
- Disk
- Do Not Disturb
- Language
- Launchpad
- Libre Hardware Monitor
- Media
- Memory
- Microphone
- Notifications
- Notes
- OBS
- Open Meteo
- Server Monitor
- Systray
- Todo
- Traffic
- Taskbar
- Pomodoro
- Power Menu
- Power Plan
- Quick Launch
- Recycle Bin
- Update Check
- Visual Studio Code
- Volume
- Wallpapers
- Weather
- WiFi
- WHKD
- Window Controls
- Window Switcher
- Windows Desktops
- Komorebi Control
- Komorebi Layout
- Komorebi Stack
- Komorebi Workspaces