module Xmobar.Config.Types
( Config (..)
, XPosition (..), Align (..), Border (..), TextOutputFormat (..)
, Segment
, FontIndex
, Box(..)
, BoxBorder(..)
, BoxOffset(..)
, BoxMargins(..)
, TextRenderInfo(..)
, Widget(..)
, SignalChan (..)
, Action (..)
, Button
) where
import qualified Control.Concurrent.STM as STM
import qualified Xmobar.Run.Runnable as R
import qualified Xmobar.System.Signal as S
import Data.Int (Int32)
import Foreign.C.Types (CInt)
import Xmobar.Run.Actions (Action (..), Button)
data Config =
Config { Config -> String
font :: String
, Config -> [String]
additionalFonts :: [String]
, Config -> String
wmClass :: String
, Config -> String
wmName :: String
, Config -> String
bgColor :: String
, Config -> String
fgColor :: String
, Config -> XPosition
position :: XPosition
, Config -> Bool
textOutput :: Bool
, Config -> TextOutputFormat
textOutputFormat :: TextOutputFormat
, Config -> Int
textOffset :: Int
, Config -> [Int]
textOffsets :: [Int]
, Config -> Int
iconOffset :: Int
, Config -> Border
border :: Border
, Config -> String
borderColor :: String
, Config -> Int
borderWidth :: Int
, Config -> Int
alpha :: Int
, Config -> Bool
hideOnStart :: Bool
, Config -> Bool
allDesktops :: Bool
, Config -> Bool
overrideRedirect :: Bool
, Config -> Bool
pickBroadest :: Bool
, Config -> Bool
lowerOnStart :: Bool
, Config -> Bool
persistent :: Bool
, Config -> String
iconRoot :: FilePath
, Config -> [Runnable]
commands :: [R.Runnable]
, Config -> String
sepChar :: String
, Config -> String
alignSep :: String
, Config -> String
template :: String
, Config -> Bool
verbose :: Bool
, Config -> SignalChan
signal :: SignalChan
, Config -> Double
dpi :: Double
} deriving (ReadPrec [Config]
ReadPrec Config
Int -> ReadS Config
ReadS [Config]
(Int -> ReadS Config)
-> ReadS [Config]
-> ReadPrec Config
-> ReadPrec [Config]
-> Read Config
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Config
readsPrec :: Int -> ReadS Config
$creadList :: ReadS [Config]
readList :: ReadS [Config]
$creadPrec :: ReadPrec Config
readPrec :: ReadPrec Config
$creadListPrec :: ReadPrec [Config]
readListPrec :: ReadPrec [Config]
Read, Int -> Config -> ShowS
[Config] -> ShowS
Config -> String
(Int -> Config -> ShowS)
-> (Config -> String) -> ([Config] -> ShowS) -> Show Config
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Config -> ShowS
showsPrec :: Int -> Config -> ShowS
$cshow :: Config -> String
show :: Config -> String
$cshowList :: [Config] -> ShowS
showList :: [Config] -> ShowS
Show)
data XPosition = Top
| TopH
Int
| TopHM
Int
Int
Int
Int
Int
| TopW
Align
Int
| TopSize
Align
Int
Int
| TopP
Int
Int
| Bottom
| BottomH
Int
| BottomHM
Int
Int
Int
Int
Int
| BottomP
Int
Int
| BottomW
Align
Int
| BottomSize
Align
Int
Int
| Static { XPosition -> Int
xpos :: Int
, XPosition -> Int
ypos :: Int
, XPosition -> Int
width :: Int
, XPosition -> Int
height :: Int
}
| OnScreen
Int
XPosition
deriving ( ReadPrec [XPosition]
ReadPrec XPosition
Int -> ReadS XPosition
ReadS [XPosition]
(Int -> ReadS XPosition)
-> ReadS [XPosition]
-> ReadPrec XPosition
-> ReadPrec [XPosition]
-> Read XPosition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS XPosition
readsPrec :: Int -> ReadS XPosition
$creadList :: ReadS [XPosition]
readList :: ReadS [XPosition]
$creadPrec :: ReadPrec XPosition
readPrec :: ReadPrec XPosition
$creadListPrec :: ReadPrec [XPosition]
readListPrec :: ReadPrec [XPosition]
Read, Int -> XPosition -> ShowS
[XPosition] -> ShowS
XPosition -> String
(Int -> XPosition -> ShowS)
-> (XPosition -> String)
-> ([XPosition] -> ShowS)
-> Show XPosition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> XPosition -> ShowS
showsPrec :: Int -> XPosition -> ShowS
$cshow :: XPosition -> String
show :: XPosition -> String
$cshowList :: [XPosition] -> ShowS
showList :: [XPosition] -> ShowS
Show, XPosition -> XPosition -> Bool
(XPosition -> XPosition -> Bool)
-> (XPosition -> XPosition -> Bool) -> Eq XPosition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: XPosition -> XPosition -> Bool
== :: XPosition -> XPosition -> Bool
$c/= :: XPosition -> XPosition -> Bool
/= :: XPosition -> XPosition -> Bool
Eq )
data Align = L | R | C deriving ( ReadPrec [Align]
ReadPrec Align
Int -> ReadS Align
ReadS [Align]
(Int -> ReadS Align)
-> ReadS [Align]
-> ReadPrec Align
-> ReadPrec [Align]
-> Read Align
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Align
readsPrec :: Int -> ReadS Align
$creadList :: ReadS [Align]
readList :: ReadS [Align]
$creadPrec :: ReadPrec Align
readPrec :: ReadPrec Align
$creadListPrec :: ReadPrec [Align]
readListPrec :: ReadPrec [Align]
Read, Int -> Align -> ShowS
[Align] -> ShowS
Align -> String
(Int -> Align -> ShowS)
-> (Align -> String) -> ([Align] -> ShowS) -> Show Align
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Align -> ShowS
showsPrec :: Int -> Align -> ShowS
$cshow :: Align -> String
show :: Align -> String
$cshowList :: [Align] -> ShowS
showList :: [Align] -> ShowS
Show, Align -> Align -> Bool
(Align -> Align -> Bool) -> (Align -> Align -> Bool) -> Eq Align
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Align -> Align -> Bool
== :: Align -> Align -> Bool
$c/= :: Align -> Align -> Bool
/= :: Align -> Align -> Bool
Eq )
data Border = NoBorder
| TopB
| BottomB
| FullB
| TopBM Int
| BottomBM Int
| FullBM Int
deriving ( ReadPrec [Border]
ReadPrec Border
Int -> ReadS Border
ReadS [Border]
(Int -> ReadS Border)
-> ReadS [Border]
-> ReadPrec Border
-> ReadPrec [Border]
-> Read Border
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS Border
readsPrec :: Int -> ReadS Border
$creadList :: ReadS [Border]
readList :: ReadS [Border]
$creadPrec :: ReadPrec Border
readPrec :: ReadPrec Border
$creadListPrec :: ReadPrec [Border]
readListPrec :: ReadPrec [Border]
Read, Int -> Border -> ShowS
[Border] -> ShowS
Border -> String
(Int -> Border -> ShowS)
-> (Border -> String) -> ([Border] -> ShowS) -> Show Border
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Border -> ShowS
showsPrec :: Int -> Border -> ShowS
$cshow :: Border -> String
show :: Border -> String
$cshowList :: [Border] -> ShowS
showList :: [Border] -> ShowS
Show, Border -> Border -> Bool
(Border -> Border -> Bool)
-> (Border -> Border -> Bool) -> Eq Border
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Border -> Border -> Bool
== :: Border -> Border -> Bool
$c/= :: Border -> Border -> Bool
/= :: Border -> Border -> Bool
Eq )
data TextOutputFormat = Plain | Ansi | Pango | Swaybar deriving (ReadPrec [TextOutputFormat]
ReadPrec TextOutputFormat
Int -> ReadS TextOutputFormat
ReadS [TextOutputFormat]
(Int -> ReadS TextOutputFormat)
-> ReadS [TextOutputFormat]
-> ReadPrec TextOutputFormat
-> ReadPrec [TextOutputFormat]
-> Read TextOutputFormat
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS TextOutputFormat
readsPrec :: Int -> ReadS TextOutputFormat
$creadList :: ReadS [TextOutputFormat]
readList :: ReadS [TextOutputFormat]
$creadPrec :: ReadPrec TextOutputFormat
readPrec :: ReadPrec TextOutputFormat
$creadListPrec :: ReadPrec [TextOutputFormat]
readListPrec :: ReadPrec [TextOutputFormat]
Read, Int -> TextOutputFormat -> ShowS
[TextOutputFormat] -> ShowS
TextOutputFormat -> String
(Int -> TextOutputFormat -> ShowS)
-> (TextOutputFormat -> String)
-> ([TextOutputFormat] -> ShowS)
-> Show TextOutputFormat
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextOutputFormat -> ShowS
showsPrec :: Int -> TextOutputFormat -> ShowS
$cshow :: TextOutputFormat -> String
show :: TextOutputFormat -> String
$cshowList :: [TextOutputFormat] -> ShowS
showList :: [TextOutputFormat] -> ShowS
Show, TextOutputFormat -> TextOutputFormat -> Bool
(TextOutputFormat -> TextOutputFormat -> Bool)
-> (TextOutputFormat -> TextOutputFormat -> Bool)
-> Eq TextOutputFormat
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: TextOutputFormat -> TextOutputFormat -> Bool
== :: TextOutputFormat -> TextOutputFormat -> Bool
$c/= :: TextOutputFormat -> TextOutputFormat -> Bool
/= :: TextOutputFormat -> TextOutputFormat -> Bool
Eq)
type FontIndex = Int
newtype SignalChan = SignalChan {SignalChan -> Maybe (TMVar SignalType)
unSignalChan :: Maybe (STM.TMVar S.SignalType)}
instance Read SignalChan where
readsPrec :: Int -> ReadS SignalChan
readsPrec Int
_ String
_ = ReadS SignalChan
forall a. String -> [a]
forall (m :: * -> *) a. MonadFail m => String -> m a
fail String
"SignalChan is not readable from a String"
instance Show SignalChan where
show :: SignalChan -> String
show (SignalChan (Just TMVar SignalType
_)) = String
"SignalChan (Just <tmvar>)"
show (SignalChan Maybe (TMVar SignalType)
Nothing) = String
"SignalChan Nothing"
data Widget = Icon String | Text String | Hspace Int32 deriving Int -> Widget -> ShowS
[Widget] -> ShowS
Widget -> String
(Int -> Widget -> ShowS)
-> (Widget -> String) -> ([Widget] -> ShowS) -> Show Widget
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Widget -> ShowS
showsPrec :: Int -> Widget -> ShowS
$cshow :: Widget -> String
show :: Widget -> String
$cshowList :: [Widget] -> ShowS
showList :: [Widget] -> ShowS
Show
data BoxOffset = BoxOffset Align Int32 deriving (BoxOffset -> BoxOffset -> Bool
(BoxOffset -> BoxOffset -> Bool)
-> (BoxOffset -> BoxOffset -> Bool) -> Eq BoxOffset
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoxOffset -> BoxOffset -> Bool
== :: BoxOffset -> BoxOffset -> Bool
$c/= :: BoxOffset -> BoxOffset -> Bool
/= :: BoxOffset -> BoxOffset -> Bool
Eq, Int -> BoxOffset -> ShowS
[BoxOffset] -> ShowS
BoxOffset -> String
(Int -> BoxOffset -> ShowS)
-> (BoxOffset -> String)
-> ([BoxOffset] -> ShowS)
-> Show BoxOffset
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoxOffset -> ShowS
showsPrec :: Int -> BoxOffset -> ShowS
$cshow :: BoxOffset -> String
show :: BoxOffset -> String
$cshowList :: [BoxOffset] -> ShowS
showList :: [BoxOffset] -> ShowS
Show)
data BoxMargins = BoxMargins Int32 Int32 Int32 Int32 deriving (BoxMargins -> BoxMargins -> Bool
(BoxMargins -> BoxMargins -> Bool)
-> (BoxMargins -> BoxMargins -> Bool) -> Eq BoxMargins
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoxMargins -> BoxMargins -> Bool
== :: BoxMargins -> BoxMargins -> Bool
$c/= :: BoxMargins -> BoxMargins -> Bool
/= :: BoxMargins -> BoxMargins -> Bool
Eq, Int -> BoxMargins -> ShowS
[BoxMargins] -> ShowS
BoxMargins -> String
(Int -> BoxMargins -> ShowS)
-> (BoxMargins -> String)
-> ([BoxMargins] -> ShowS)
-> Show BoxMargins
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoxMargins -> ShowS
showsPrec :: Int -> BoxMargins -> ShowS
$cshow :: BoxMargins -> String
show :: BoxMargins -> String
$cshowList :: [BoxMargins] -> ShowS
showList :: [BoxMargins] -> ShowS
Show)
data BoxBorder = BBTop
| BBBottom
| BBVBoth
| BBLeft
| BBRight
| BBHBoth
| BBFull
deriving (ReadPrec [BoxBorder]
ReadPrec BoxBorder
Int -> ReadS BoxBorder
ReadS [BoxBorder]
(Int -> ReadS BoxBorder)
-> ReadS [BoxBorder]
-> ReadPrec BoxBorder
-> ReadPrec [BoxBorder]
-> Read BoxBorder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
$creadsPrec :: Int -> ReadS BoxBorder
readsPrec :: Int -> ReadS BoxBorder
$creadList :: ReadS [BoxBorder]
readList :: ReadS [BoxBorder]
$creadPrec :: ReadPrec BoxBorder
readPrec :: ReadPrec BoxBorder
$creadListPrec :: ReadPrec [BoxBorder]
readListPrec :: ReadPrec [BoxBorder]
Read, BoxBorder -> BoxBorder -> Bool
(BoxBorder -> BoxBorder -> Bool)
-> (BoxBorder -> BoxBorder -> Bool) -> Eq BoxBorder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: BoxBorder -> BoxBorder -> Bool
== :: BoxBorder -> BoxBorder -> Bool
$c/= :: BoxBorder -> BoxBorder -> Bool
/= :: BoxBorder -> BoxBorder -> Bool
Eq, Int -> BoxBorder -> ShowS
[BoxBorder] -> ShowS
BoxBorder -> String
(Int -> BoxBorder -> ShowS)
-> (BoxBorder -> String)
-> ([BoxBorder] -> ShowS)
-> Show BoxBorder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> BoxBorder -> ShowS
showsPrec :: Int -> BoxBorder -> ShowS
$cshow :: BoxBorder -> String
show :: BoxBorder -> String
$cshowList :: [BoxBorder] -> ShowS
showList :: [BoxBorder] -> ShowS
Show)
data Box = Box { Box -> BoxBorder
bBorder :: BoxBorder
, Box -> BoxOffset
bOffset :: BoxOffset
, Box -> CInt
bWidth :: CInt
, Box -> String
bColor :: String
, Box -> BoxMargins
bMargins :: BoxMargins
} deriving (Box -> Box -> Bool
(Box -> Box -> Bool) -> (Box -> Box -> Bool) -> Eq Box
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Box -> Box -> Bool
== :: Box -> Box -> Bool
$c/= :: Box -> Box -> Bool
/= :: Box -> Box -> Bool
Eq, Int -> Box -> ShowS
[Box] -> ShowS
Box -> String
(Int -> Box -> ShowS)
-> (Box -> String) -> ([Box] -> ShowS) -> Show Box
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> Box -> ShowS
showsPrec :: Int -> Box -> ShowS
$cshow :: Box -> String
show :: Box -> String
$cshowList :: [Box] -> ShowS
showList :: [Box] -> ShowS
Show)
data TextRenderInfo = TextRenderInfo { :: String
, TextRenderInfo -> Int32
tBgTopOffset :: Int32
, TextRenderInfo -> Int32
tBgBottomOffset :: Int32
, TextRenderInfo -> [Box]
tBoxes :: [Box]
} deriving Int -> TextRenderInfo -> ShowS
[TextRenderInfo] -> ShowS
TextRenderInfo -> String
(Int -> TextRenderInfo -> ShowS)
-> (TextRenderInfo -> String)
-> ([TextRenderInfo] -> ShowS)
-> Show TextRenderInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> TextRenderInfo -> ShowS
showsPrec :: Int -> TextRenderInfo -> ShowS
$cshow :: TextRenderInfo -> String
show :: TextRenderInfo -> String
$cshowList :: [TextRenderInfo] -> ShowS
showList :: [TextRenderInfo] -> ShowS
Show
type Segment = (Widget, TextRenderInfo, FontIndex, Maybe [Action])