Skip to content

Latest commit

 

History

24 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lswt-rs

A Rust implementation of lswt - list Wayland toplevels.

Features

  • 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)

Requirements

Your Wayland compositor must support at least one of the following protocols:

  • zwlr_foreign_toplevel_management_unstable_v1 version 3 or higher
  • treeland_foreign_toplevel_manager_v1 version 1 or higher (Deepin/Treeland)
  • ext_foreign_toplevel_list_v1 version 1 or higher

Most wlroots-based compositors (Sway, river, Hyprland, etc.) and Deepin's Treeland support these protocols.

Installation

From source

cargo build --release
sudo cp target/release/lswt /usr/local/bin/

Usage

# 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

Options

  • -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)

REPL Commands

When in REPL mode (--repl), the following commands are available:

  • list, ls - List all toplevels in normal format
  • list-json, lj - List all toplevels in JSON format
  • info <id> - Show detailed info for a toplevel by ID
  • info <app-id> - Show detailed info for a toplevel by app-id
  • count - Show number of toplevels
  • protocol - Show current protocol
  • help, h - Show help
  • exit, quit, q - Exit REPL

Custom Format Fields

  • t - title
  • a - app-id
  • i - identifier (if supported)
  • A - activated/focused state
  • f - fullscreen state
  • m - minimized state
  • M - maximized state

Example Output

Normal format

state:   app-id:             title:
--a-     firefox             Mozilla Firefox
m-a-     kitty               Terminal
----     code                Visual Studio Code

JSON format

{
  "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
    }
  ]
}

License

GPL-3.0-or-later

This project is a Rust reimplementation inspired by the original C implementation by Leon Henrik Plickat.

Contributing

Contributions are welcome! Please feel free to submit pull requests or open issues.

About

list wayland toplevels

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages