xmonad-contrib-0.17.1: Community-maintained extensions for xmonad

Copyright | (c) 2021 Tony Zorman
License | BSD3-style (see LICENSE)
Maintainer | Tony Zorman <soliditsallgood@mailbox.org>
Safe Haskell | Safe-Inferred
Language | Haskell2010

XMonad.Prelude

Contents

- Keys

Description

Utility functions and re-exports for a more ergonomic developing experience. Users themselves will not find much use here.

Synopsis

- module Data.Traversable
- module Data.Monoid
- module Data.Maybe
- module Data.List
- module Data.Functor
- module Data.Function
- module Data.Foldable
- module Data.Char
- module Data.Bool
- module Control.Monad
- module Control.Applicative
- fi :: (Integral a, Num b) => a -> b
- chunksOf :: Int -> [a] -> [[a]]
- (.:) :: (a -> b) -> (c -> d -> a) -> c -> d -> b
- (!?) :: [a] -> Int -> Maybe a
- data NonEmpty a = a :| [a]
- notEmpty :: HasCallStack => [a] -> NonEmpty a
- safeGetWindowAttributes :: Window -> X (Maybe WindowAttributes)
- mkAbsolutePath :: MonadIO m => FilePath -> m FilePath
- keyToString :: (KeyMask, KeySym) -> String
- keymaskToString :: KeyMask -> KeyMask -> String
- cleanKeyMask :: X (KeyMask -> KeyMask)
- regularKeys :: [(String, KeySym)]
- allSpecialKeys :: [(String, KeySym)]
- specialKeys :: [(String, KeySym)]
- multimediaKeys :: [(String, KeySym)]
- functionKeys :: [(String, KeySym)]
- type WindowScreen = Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail

# Documentation

module Data.Traversable

module Data.Monoid

module Data.Maybe

module Data.List

module Data.Functor

module Data.Function

module Data.Foldable

module Data.Char

module Data.Bool

module Control.Monad

module Control.Applicative

fi :: (Integral a, Num b) => a -> b Source #

Short for `fromIntegral`.

chunksOf :: Int -> [a] -> [[a]] Source #

Given a maximum length, splits a list into sublists

    >>> chunksOf 5 (take 30 $ repeat 'a')
    ["aaaaa","aaaaa","aaaaa","aaaaa","aaaaa","aaaaa"]

(.:) :: (a -> b) -> (c -> d -> a) -> c -> d -> b Source #

Multivariable composition.

    f .: g ≡ (f .) . g ≡ \c d -> f (g c d)

(!?) :: [a] -> Int -> Maybe a Source #

Safe version of `(!!)`.

data NonEmpty a Source #

Non-empty (and non-strict) list type.

Since: base-4.9.0.0

Constructors

a :| [a] infixr 5 |

#### Instances

Instances details

MonadFix NonEmpty | Since: base-4.9.0.0
Instance details Defined in Control.Monad.Fix Methods mfix :: (a -> NonEmpty a) -> NonEmpty a Source #
Foldable NonEmpty | Since: base-4.9.0.0

Instance details

Defined in Data.Foldable

Methods

fold :: Monoid m => NonEmpty m -> m Source #

foldMap :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldMap' :: Monoid m => (a -> m) -> NonEmpty a -> m Source #

foldr :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldr' :: (a -> b -> b) -> b -> NonEmpty a -> b Source #

foldl :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldl' :: (b -> a -> b) -> b -> NonEmpty a -> b Source #

foldr1 :: (a -> a -> a) -> NonEmpty a -> a Source #

foldl1 :: (a -> a -> a) -> NonEmpty a -> a Source #

toList :: NonEmpty a -> [a] Source #

null :: NonEmpty a -> Bool Source #

length :: NonEmpty a -> Int Source #

elem :: Eq a => a -> NonEmpty a -> Bool Source #

maximum :: Ord a => NonEmpty a -> a Source #

minimum :: Ord a => NonEmpty a -> a Source #

sum :: Num a => NonEmpty a -> a Source #

product :: Num a => NonEmpty a -> a Source #

Eq1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftEq :: (a -> b -> Bool) -> NonEmpty a -> NonEmpty b -> Bool Source #
Ord1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftCompare :: (a -> b -> Ordering) -> NonEmpty a -> NonEmpty b -> Ordering Source #
Read1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftReadsPrec :: (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (NonEmpty a) Source # liftReadList :: (Int -> ReadS a) -> ReadS [a] -> ReadS [NonEmpty a] Source # liftReadPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec (NonEmpty a) Source # liftReadListPrec :: ReadPrec a -> ReadPrec [a] -> ReadPrec [NonEmpty a] Source #
Show1 NonEmpty | Since: base-4.10.0.0
Instance details Defined in Data.Functor.Classes Methods liftShowsPrec :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> NonEmpty a -> ShowS Source # liftShowList :: (Int -> a -> ShowS) -> ([a] -> ShowS) -> [NonEmpty a] -> ShowS Source #
Traversable NonEmpty | Since: base-4.9.0.0
Instance details Defined in Data.Traversable Methods traverse :: Applicative f => (a -> f b) -> NonEmpty a -> f (NonEmpty b) Source # sequenceA :: Applicative f => NonEmpty (f a) -> f (NonEmpty a) Source # mapM :: Monad m => (a -> m b) -> NonEmpty a -> m (NonEmpty b) Source # sequence :: Monad m => NonEmpty (m a) -> m (NonEmpty a) Source #
Applicative NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods pure :: a -> NonEmpty a Source # (<*>) :: NonEmpty (a -> b) -> NonEmpty a -> NonEmpty b Source # liftA2 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c Source # (*>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # (<*) :: NonEmpty a -> NonEmpty b -> NonEmpty a Source #
Functor NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods fmap :: (a -> b) -> NonEmpty a -> NonEmpty b Source # (<$) :: a -> NonEmpty b -> NonEmpty a Source #
Monad NonEmpty | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods (>>=) :: NonEmpty a -> (a -> NonEmpty b) -> NonEmpty b Source # (>>) :: NonEmpty a -> NonEmpty b -> NonEmpty b Source # return :: a -> NonEmpty a Source #
NFData1 NonEmpty | Since: deepseq-1.4.3.0
Instance details Defined in Control.DeepSeq Methods liftRnf :: (a -> ()) -> NonEmpty a -> () Source #
Generic1 NonEmpty |
Instance details Defined in GHC.Generics Associated Types type Rep1 NonEmpty :: k -> Type Source # Methods from1 :: forall (a :: k). NonEmpty a -> Rep1 NonEmpty a Source # to1 :: forall (a :: k). Rep1 NonEmpty a -> NonEmpty a Source #
Lift a => Lift (NonEmpty a :: Type) | Since: template-haskell-2.15.0.0
Instance details Defined in Language.Haskell.TH.Syntax Methods lift :: Quote m => NonEmpty a -> m Exp Source # liftTyped :: forall (m :: Type -> Type). Quote m => NonEmpty a -> Code m (NonEmpty a) Source #
Semigroup (NonEmpty a) | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods (<>) :: NonEmpty a -> NonEmpty a -> NonEmpty a Source # sconcat :: NonEmpty (NonEmpty a) -> NonEmpty a Source # stimes :: Integral b => b -> NonEmpty a -> NonEmpty a Source #
Generic (NonEmpty a) |
Instance details Defined in GHC.Generics Associated Types type Rep (NonEmpty a) :: Type -> Type Source # Methods from :: NonEmpty a -> Rep (NonEmpty a) x Source # to :: Rep (NonEmpty a) x -> NonEmpty a Source #
IsList (NonEmpty a) | Since: base-4.9.0.0
Instance details Defined in GHC.IsList Associated Types type Item (NonEmpty a) Source # Methods fromList :: [Item (NonEmpty a)] -> NonEmpty a Source # fromListN :: Int -> [Item (NonEmpty a)] -> NonEmpty a Source # toList :: NonEmpty a -> [Item (NonEmpty a)] Source #
Read a => Read (NonEmpty a) | Since: base-4.11.0.0
Instance details Defined in GHC.Read Methods readsPrec :: Int -> ReadS (NonEmpty a) Source # readList :: ReadS [NonEmpty a] Source # readPrec :: ReadPrec (NonEmpty a) Source # readListPrec :: ReadPrec [NonEmpty a] Source #
Show a => Show (NonEmpty a) | Since: base-4.11.0.0
Instance details Defined in GHC.Show Methods showsPrec :: Int -> NonEmpty a -> ShowS Source # show :: NonEmpty a -> String Source # showList :: [NonEmpty a] -> ShowS Source #
NFData a => NFData (NonEmpty a) | Since: deepseq-1.4.2.0
Instance details Defined in Control.DeepSeq Methods rnf :: NonEmpty a -> () Source #
Eq a => Eq (NonEmpty a) | Since: base-4.9.0.0
Instance details Defined in GHC.Base Methods (==) :: NonEmpty a -> NonEmpty a -> Bool Source # (/=) :: NonEmpty a -> NonEmpty a -> Bool Source #
Ord a => Ord (NonEmpty a) | Since: base-4.9.0.0

Instance details

Defined in GHC.Base

Methods

compare :: NonEmpty a -> NonEmpty a -> Ordering Source #

(<) :: NonEmpty a -> NonEmpty a -> Bool Source #

(<=) :: NonEmpty a -> NonEmpty a -> Bool Source #

(>) :: NonEmpty a -> NonEmpty a -> Bool Source #

(>=) :: NonEmpty a -> NonEmpty a -> Bool Source #

max :: NonEmpty a -> NonEmpty a -> NonEmpty a Source #

min :: NonEmpty a -> NonEmpty a -> NonEmpty a Source #

type Rep1 NonEmpty | Since: base-4.6.0.0
Instance details Defined in GHC.Generics type Rep1 NonEmpty = D1 ('MetaData "NonEmpty" "GHC.Base" "base" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) Par1 :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec1 [])))
type Rep (NonEmpty a) | Since: base-4.6.0.0
Instance details Defined in GHC.Generics type Rep (NonEmpty a) = D1 ('MetaData "NonEmpty" "GHC.Base" "base" 'False) (C1 ('MetaCons ":|" ('InfixI 'RightAssociative 5) 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 a) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [a])))
type Item (NonEmpty a) |
Instance details Defined in GHC.IsList type Item (NonEmpty a) = a

notEmpty :: HasCallStack => [a] -> NonEmpty a Source #

`fromList` with a better error message. Useful to silence GHC's Pattern match(es) are non-exhaustive warning in places where the programmer knows it's always non-empty, but it's infeasible to express that in the type system.

safeGetWindowAttributes :: Window -> X (Maybe WindowAttributes) Source #

A safe version of `getWindowAttributes`.

mkAbsolutePath :: MonadIO m => FilePath -> m FilePath Source #

(Naïvely) turn a relative path into an absolute one.

- If the path starts with `/`, do nothing.
- If it starts with `~/`, replace that with the actual home
- directory.
- If it starts with `$`, read the name of an environment
- variable and replace it with the contents of that.
- Otherwise, prepend the home directory and `/` to the path.

# Keys

keyToString :: (KeyMask, KeySym) -> String Source #

Convert a full key combination; i.e., a `KeyMask` and `KeySym` pair, into a string.

keymaskToString Source #

Arguments

:: KeyMask | Num lock mask
-> KeyMask | Modifier mask
-> String |

Convert a modifier mask into a useful string.

cleanKeyMask :: X (KeyMask -> KeyMask) Source #

Strip numlock, capslock, mouse buttons and XKB group from a `KeyMask`, leaving only modifier keys like Shift, Control, Super, Hyper in the mask (hence the "Key" in "cleanKeyMask").

Core's `cleanMask` only strips the first two because key events from passive grabs (key bindings) are stripped of mouse buttons and XKB group by the X server already for compatibility reasons. For more info, see: https://www.x.org/releases/X11R7.7/doc/kbproto/xkbproto.html#Delivering_a_Key_or_Button_Event_to_a_Client

regularKeys :: [(String, KeySym)] Source #

A list of "regular" (extended ASCII) keys.

allSpecialKeys :: [(String, KeySym)] Source #

A list of all special key names and their associated KeySyms.

specialKeys :: [(String, KeySym)] Source #

A list of special key names and their corresponding KeySyms.

multimediaKeys :: [(String, KeySym)] Source #

List of multimedia keys. If Xlib does not know about some keysym it's omitted from the list (`stringToKeysym` returns `noSymbol` in this case).

functionKeys :: [(String, KeySym)] Source #

A list pairing function key descriptor strings (e.g. `"F2"`) with the associated KeySyms.

type WindowScreen = Screen WorkspaceId (Layout Window) Window ScreenId ScreenDetail Source #

The specialized `Screen` derived from `WindowSet`.