Add details to ManageHook.hs docs (#504)

* Add details to ManageHook.hs docs

* Link specialised variants in `stringProperty` doc

* Fix typo

Co-authored-by: Tomáš Janoušek <tomi@nomi.cz>

---------

Co-authored-by: Tomáš Janoušek <tomi@nomi.cz>
This commit is contained in:
Markus Kurtz 2024-04-27 16:51:25 +02:00 committed by GitHub
parent 383e3d6f47
commit cde1a25bca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -64,7 +64,8 @@ x <&&> y = ifM x y (pure False)
(<||>) :: Monad m => m Bool -> m Bool -> m Bool
x <||> y = ifM x (pure True) y
-- | Return the window title.
-- | Return the window title; i.e., the string returned by @_NET_WM_NAME@,
-- or failing that, the string returned by @WM_NAME@.
title :: Query String
title = ask >>= \w -> liftX $ do
d <- asks display
@ -91,7 +92,9 @@ className :: Query String
className = ask >>= (\w -> liftX $ withDisplay $ \d -> fmap resClass $ io $ getClassHint d w)
-- | A query that can return an arbitrary X property of type 'String',
-- identified by name.
-- identified by name. Works for ASCII strings only. For the properties
-- @_NET_WM_NAME@/@WM_NAME@ and @WM_CLASS@ the specialised variants 'title'
-- and 'appName'/'className' are preferred.
stringProperty :: String -> Query String
stringProperty p = ask >>= (\w -> liftX $ withDisplay $ \d -> fromMaybe "" <$> getStringProperty d w p)