X.ManageHook: Clarify {app,class}Name documentation

Users often mistakenly use className to query the application (resource)
name of a window; probably since WM_CLASS even has "class" in its name,
so confusion ensues.  Improve the documentation to explicitly state
which of the two strings in WM_CLASS the respective functions match.
This commit is contained in:
Tony Zorman 2022-08-08 11:00:27 +02:00
parent a13a1dcee8
commit b06d885e76

View File

@ -80,7 +80,8 @@ title = ask >>= \w -> liftX $ do
return $ if null l then "" else head l return $ if null l then "" else head l
io $ bracket getProp (xFree . tp_value) extract `E.catch` \(SomeException _) -> return "" io $ bracket getProp (xFree . tp_value) extract `E.catch` \(SomeException _) -> return ""
-- | Return the application name. -- | Return the application name; i.e., the /first/ string returned by
-- @WM_CLASS@.
appName :: Query String appName :: Query String
appName = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resName $ io $ getClassHint d w) appName = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resName $ io $ getClassHint d w)
@ -88,7 +89,8 @@ appName = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resName $ io $ getClas
resource :: Query String resource :: Query String
resource = appName resource = appName
-- | Return the resource class. -- | Return the resource class; i.e., the /second/ string returned by
-- @WM_CLASS@.
className :: Query String className :: Query String
className = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resClass $ io $ getClassHint d w) className = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resClass $ io $ getClassHint d w)