Running wl-pick twice left the second instance hung with no window at all and no way to end it but kill. The hang was in the capture phase, not the overlay. sway answers a capture request for a toplevel that another client is already capturing with silence: no frame, no failed, no stopped. captures_settled() waits for every tile to reach one of those three, so it waited forever, holding its buffers, having never created a layer surface. Any concurrent capture client will do this, not just a second wl-pick. So the phases before the overlay is interactive now have a deadline. pump_for polls the connection with one, and a tile that never arrives is drawn as a bare label, exactly as an outright capture failure already was. report_unsettled names those tiles on stderr, which is the diagnostic whose absence made this hard to find. The first instance had a second problem: sway hands the keyboard to the new overlay and sends the old one wl_keyboard.leave, but the dispatcher only handled Key, so the loser sat on screen holding a grab it no longer had, deaf to every key. That is the process that stays around. Losing the grab for good now ends the run, so a second wl-pick started from the same keybinding replaces the first rather than stranding it. For good, because sway also sends leave followed immediately by enter on the same surface -- microseconds apart -- as a focus refresh when the pointer crosses the overlay. Treating a bare leave as terminal made a lone instance quit itself after less than a second. Focus is tracked in the dispatcher and the main loop only gives up once it has failed to come back. pump had no callers left after that: every wait is now either budgeted or focus-aware.
25 lines
789 B
TOML
25 lines
789 B
TOML
[package]
|
|
name = "wl-pick"
|
|
version = "0.3.0"
|
|
edition = "2024"
|
|
description = "A live grid of window and display previews, for picking one"
|
|
license = "MIT"
|
|
repository = "https://github.com/mil-ad/wl-pick"
|
|
readme = "README.md"
|
|
keywords = ["wayland", "sway", "wlroots", "screencast", "switcher"]
|
|
categories = ["command-line-utilities", "os::unix-apis"]
|
|
# The floor is cosmic-text, which needs 1.89; let-chains here need 1.88.
|
|
rust-version = "1.89"
|
|
|
|
[dependencies]
|
|
wayland-client = "0.31"
|
|
wayland-protocols = { version = "0.32", features = ["client", "staging", "unstable"] }
|
|
wayland-protocols-wlr = { version = "0.3", features = ["client"] }
|
|
memmap2 = "0.9"
|
|
rustix = { version = "1", features = ["event", "fs", "mm", "shm"] }
|
|
swayipc = "4"
|
|
cosmic-text = "0.19"
|
|
|
|
[profile.release]
|
|
strip = true
|