From b06d885e764cc57d78e94402d583cbf72741d583 Mon Sep 17 00:00:00 2001 From: Tony Zorman Date: Mon, 8 Aug 2022 11:00:27 +0200 Subject: [PATCH] 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. --- src/XMonad/ManageHook.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/XMonad/ManageHook.hs b/src/XMonad/ManageHook.hs index b0628d4..8e46a90 100644 --- a/src/XMonad/ManageHook.hs +++ b/src/XMonad/ManageHook.hs @@ -80,7 +80,8 @@ title = ask >>= \w -> liftX $ do return $ if null l then "" else head l 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 = 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 = appName --- | Return the resource class. +-- | Return the resource class; i.e., the /second/ string returned by +-- @WM_CLASS@. className :: Query String className = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resClass $ io $ getClassHint d w)