summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Config
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xmobar/Config')
-rw-r--r--src/Xmobar/Config/Types.hs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Xmobar/Config/Types.hs b/src/Xmobar/Config/Types.hs
index 951759d..216ac19 100644
--- a/src/Xmobar/Config/Types.hs
+++ b/src/Xmobar/Config/Types.hs
@@ -18,6 +18,7 @@ module Xmobar.Config.Types
Config (..)
, XPosition (..), Align (..), Border (..), TextOutputFormat (..)
, SignalChan (..)
+ , indexedFont, indexedOffset
) where
import qualified Control.Concurrent.STM as STM
@@ -73,6 +74,16 @@ data Config =
, signal :: SignalChan -- ^ The signal channel used to send signals to xmobar
} deriving (Read, Show)
+indexedFont :: Config -> Int -> String
+indexedFont config idx =
+ if idx < 1 || idx > length (additionalFonts config)
+ then font config else (additionalFonts config) !! (idx - 1)
+
+indexedOffset :: Config -> Int -> Int
+indexedOffset config idx =
+ if idx < 1 || idx > length (textOffsets config)
+ then textOffset config else (textOffsets config) !! (idx - 1)
+
data XPosition = Top
| TopH Int
| TopW Align Int