Search code examples
awesome-wm

Client doesn't have a name/class at startup


I'm trying to start an application (Spotify) on a particular tag. Rules aren't applied and now I'm inspecting the client class by printing the class in a notification in the "manage" signal. This results in an empty notification.

client.connect_signal("manage", function (c, startup)
    naughty.notify({title=c.class})
end)

When I restart awesome, it does print the client class, so why isn't it working when the client is initially started?

Using xprop, it also prints the class: WM_CLASS(STRING) = "spotify", "Spotify"


Solution

  • Sounds like a bug in Spotify (and I think I heard about this one before). I would guess that Spotify does not follow ICCCM and only sets its WM_CLASS property after it made its window visible and not before.

    I fear that you cannot do much about this except for complaining to Spotify devs to fix their stuff.

    You could work around this by starting a timer in the manage signal that checks if a window turns out to be spotify a short time later. Alternatively, you could do something like client.connect_signal("property::class", function(c) if c.class == "Spotify" then print("This is now a spotify window") end end) to react to change to a window's class (of course you'd want to do something more useful to Spotify's windows than printing them). (Per the ICCCM, a window is not allowed to change its class while it is visible, but who cares about standards...)