summaryrefslogtreecommitdiffhomepage
path: root/src/Xmobar/Config
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-09-10 04:33:56 +0100
committerjao <jao@gnu.org>2022-09-10 04:33:56 +0100
commitb2d0d19c4b3d33ea336e78c62e7eddfa805281ac (patch)
tree2b42db25b82ffa3e23f702bb0bbb9d19673ff541 /src/Xmobar/Config
parentf81a7cfef463907ba4b68cb1352a869960350685 (diff)
downloadxmobar-b2d0d19c4b3d33ea336e78c62e7eddfa805281ac.tar.gz
xmobar-b2d0d19c4b3d33ea336e78c62e7eddfa805281ac.tar.bz2
cairo: fonts, offsets, colors, actions
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