windowTypeFor

fun windowTypeFor(width: Dp, formFactor: FormFactor = FormFactor.Handheld): WindowType

Resolves the width bucket, using breakpoints appropriate to formFactor.

  • Handheld / Desktop use the Material 3 width classes (600dp / 840dp) so a consumer that already resolves a WindowSizeClass upstream maps onto this 1:1.

  • Watch is always WindowType.Compact. Every Wear OS device is 192–227dp; bucketing is noise.

  • Tv uses 1280dp / 1920dp. Note that real Android TV normalises to roughly 960dp wide regardless of panel resolution — a 720p set runs tvdpi and a 1080p set runs xhdpi, and both land near 960x540dp. So essentially every real television resolves to WindowType.Compact, and the Compact TV token set is therefore the standard 10-foot set, not a cut-down one. The Medium and Expanded TV sets exist for desktop-as-TV windows and ultrawide panels.

(The repo this idea came from used 1400/2600dp for TV, which classifies every real Android TV as its smallest bucket while labelling it "720p" — those numbers describe a desktop window emulating a TV, not a TV.)