Skip to content

Commit

Permalink
Add details to ManageHook.hs docs (#504)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
mgkurtz and liskin committed Apr 27, 2024
1 parent 383e3d6 commit cde1a25
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/XMonad/ManageHook.hs
Expand Up @@ -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
Expand All @@ -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)

Expand Down

0 comments on commit cde1a25

Please sign in to comment.