A Rust implementation of lswt - list Wayland toplevels.
- List all Wayland toplevel windows with their titles and app-ids
- Support for multiple Wayland protocols:
zwlr-foreign-toplevel-management-unstable-v1(wlroots)treeland-foreign-toplevel-manager-v1(Deepin/Treeland)ext-foreign-toplevel-list-v1(standardized protocol)
- Multiple output formats:
- Normal (human-readable table)
- JSON (machine-readable)
- Custom format (user-defined fields)
- Watch mode for monitoring window changes in real-time
- Display window states (maximized, minimized, activated/focused, fullscreen)
Your Wayland compositor must support at least one of the following protocols:
zwlr_foreign_toplevel_management_unstable_v1version 3 or highertreeland_foreign_toplevel_manager_v1version 1 or higher (Deepin/Treeland)ext_foreign_toplevel_list_v1version 1 or higher
Most wlroots-based compositors (Sway, river, Hyprland, etc.) and Deepin's Treeland support these protocols.
cargo build --release
sudo cp target/release/lswt /usr/local/bin/# List all toplevels
lswt
# Output in JSON format
lswt --json
# Watch for changes
lswt --watch
# Watch with verbose state information
lswt --verbose-watch
# Enter interactive REPL mode
lswt --repl
# Custom output format (title,app-id,activated)
lswt --custom taA
# Force specific protocol (short names supported)
lswt --force-protocol wlr # wlroots protocol
lswt --force-protocol treeland # Deepin/Treeland protocol
lswt --force-protocol ext # Standard ext-foreign-toplevel-list protocol
# Full protocol names also work
lswt --force-protocol zwlr-foreign-toplevel-management-unstable-v1-h, --help- Print help information-v, --version- Print version-j, --json- Output data in JSON format-w, --watch- Run continuously and log title, identifier and app-id events-W, --verbose-watch- Like --watch, but also log activated, fullscreen, minimized and maximized state--repl- Enter interactive REPL mode-c <fmt>, --custom <fmt>- Define a custom line-based output format--force-protocol <name>- Use specified protocol (short names:wlr,treeland,ext)
When in REPL mode (--repl), the following commands are available:
list,ls- List all toplevels in normal formatlist-json,lj- List all toplevels in JSON formatinfo <id>- Show detailed info for a toplevel by IDinfo <app-id>- Show detailed info for a toplevel by app-idcount- Show number of toplevelsprotocol- Show current protocolhelp,h- Show helpexit,quit,q- Exit REPL
t- titlea- app-idi- identifier (if supported)A- activated/focused statef- fullscreen statem- minimized stateM- maximized state
state: app-id: title:
--a- firefox Mozilla Firefox
m-a- kitty Terminal
---- code Visual Studio Code
{
"json-output-version": 2,
"supported-data": {
"title": true,
"app-id": true,
"identifier": false,
"fullscreen": true,
"activated": true,
"minimized": true,
"maximized": true
},
"toplevels": [
{
"title": "Mozilla Firefox",
"app-id": "firefox",
"activated": true,
"fullscreen": false,
"minimized": false,
"maximized": false
}
]
}GPL-3.0-or-later
This project is a Rust reimplementation inspired by the original C implementation by Leon Henrik Plickat.
Contributions are welcome! Please feel free to submit pull requests or open issues.