Skip to content

WM_CLASS and WM_NAME not set before window is mapped #879

@jonhoo

Description

@jonhoo

Many Linux window managers rely on being able to match against a new window's WM_CLASS or WM_NAME at launch to place them on the right workspace, set floating properties, etc. Since the window manager only looks at the value of these properties when the window is first mapped, ICCCM requires (for WM_CLASS) that

This property must be present when the window leaves the Withdrawn state and may be changed only while the window is in the Withdrawn state. Window managers may examine the property only when they start up and when the window leaves the Withdrawn state, but there should be no need for a client to change its state dynamically.

While no such requirement exists for WM_NAME, setting it before the window is mapped is advantageous for the same reason. Unfortunately, glutin currently does not appear to do this (neither does Spotify fwiw). It sets these properties after mapping the new window. While using xprop to inspect the window launched by examples/window.rs does show the right WM_NAME and WM_CLASS ("A fantastic window!"), this information is not visible to window managers. For example, neither of these two xmonad window hooks work:

className =? "A fantastic window!" --> doShift "1"
title =? "A fantastic window!" --> doShift "1"

On the other hand, matching against "" does move the window, suggesting that the window is initially mapped without title or class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions