mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-08-01 20:51:52 -07:00
@@ -520,6 +520,9 @@
|
|||||||
|
|
||||||
- Added `windowTag`
|
- Added `windowTag`
|
||||||
|
|
||||||
|
- Added `(^?)`, `(~?)` and `($?)` operators as infix versions of `isPrefixOf`, `isInfixOf`
|
||||||
|
and `isSuffixOf` working with `ManageHook`s.
|
||||||
|
|
||||||
* `XMonad.Util.EZConfig`
|
* `XMonad.Util.EZConfig`
|
||||||
|
|
||||||
- Added support for XF86Bluetooth.
|
- Added support for XF86Bluetooth.
|
||||||
|
@@ -25,11 +25,25 @@
|
|||||||
-- > ],
|
-- > ],
|
||||||
-- > ...
|
-- > ...
|
||||||
-- > }
|
-- > }
|
||||||
|
--
|
||||||
|
-- Here's how you can define more helpers like the ones from this module:
|
||||||
|
--
|
||||||
|
-- > -- some function you want to transform into an infix operator
|
||||||
|
-- > f :: a -> b -> Bool
|
||||||
|
-- >
|
||||||
|
-- > -- a new helper
|
||||||
|
-- > q ***? x = fmap (\a -> f a x) q
|
||||||
|
-- > -- or
|
||||||
|
-- > q ***? x = fmap (`f` x) q
|
||||||
|
--
|
||||||
|
-- Any existing operator can be "lifted" in the same way:
|
||||||
|
--
|
||||||
|
-- > q ++? x = fmap (++ x) q
|
||||||
|
|
||||||
module XMonad.Hooks.ManageHelpers (
|
module XMonad.Hooks.ManageHelpers (
|
||||||
Side(..),
|
Side(..),
|
||||||
composeOne,
|
composeOne,
|
||||||
(-?>), (/=?), (<==?), (</=?), (-->>), (-?>>),
|
(-?>), (/=?), (^?), (~?), ($?), (<==?), (</=?), (-->>), (-?>>),
|
||||||
currentWs,
|
currentWs,
|
||||||
windowTag,
|
windowTag,
|
||||||
isInProperty,
|
isInProperty,
|
||||||
@@ -95,6 +109,18 @@ infixr 0 -?>, -->>, -?>>
|
|||||||
(/=?) :: (Eq a, Functor m) => m a -> a -> m Bool
|
(/=?) :: (Eq a, Functor m) => m a -> a -> m Bool
|
||||||
q /=? x = fmap (/= x) q
|
q /=? x = fmap (/= x) q
|
||||||
|
|
||||||
|
-- | q ^? x. if the result of q 'isPrefixOf' x, return True
|
||||||
|
(^?) :: (Eq a, Functor m) => m [a] -> [a] -> m Bool
|
||||||
|
q ^? x = fmap (`isPrefixOf` x) q
|
||||||
|
|
||||||
|
-- | q ~? x. if the result of q 'isSuffixOf' x, return True
|
||||||
|
(~?) :: (Eq a, Functor m) => m [a] -> [a] -> m Bool
|
||||||
|
q ~? x = fmap (`isInfixOf` x) q
|
||||||
|
|
||||||
|
-- | q $? x. if the result of q 'isSuffixOf' x, return True
|
||||||
|
($?) :: (Eq a, Functor m) => m [a] -> [a] -> m Bool
|
||||||
|
q $? x = fmap (`isSuffixOf` x) q
|
||||||
|
|
||||||
-- | q <==? x. if the result of q equals x, return True grouped with q
|
-- | q <==? x. if the result of q equals x, return True grouped with q
|
||||||
(<==?) :: (Eq a, Functor m) => m a -> a -> m (Match a)
|
(<==?) :: (Eq a, Functor m) => m a -> a -> m (Match a)
|
||||||
q <==? x = fmap (`eq` x) q
|
q <==? x = fmap (`eq` x) q
|
||||||
|
Reference in New Issue
Block a user