summaryrefslogtreecommitdiffhomepage
path: root/src/Config.hs
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-21 02:36:35 +0100
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-12-21 02:36:35 +0100
commite3853a9cb2a9a2cffa174d1334e2ca8ba610f151 (patch)
tree13aa04faea320afe85636e23686280386c1c2910 /src/Config.hs
parent598bfe5deeff079280e8513c55dc7bda3e8cf9a0 (diff)
downloadxmobar-e3853a9cb2a9a2cffa174d1334e2ca8ba610f151.tar.gz
xmobar-e3853a9cb2a9a2cffa174d1334e2ca8ba610f151.tar.bz2
Haskell sources moved to src/ to unclutter toplevel
Diffstat (limited to 'src/Config.hs')
-rw-r--r--src/Config.hs116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/Config.hs b/src/Config.hs
new file mode 100644
index 0000000..6eb55a0
--- /dev/null
+++ b/src/Config.hs
@@ -0,0 +1,116 @@
+{-# LANGUAGE CPP, TypeOperators #-}
+
+-----------------------------------------------------------------------------
+-- |
+-- Module : Xmobar.Config
+-- Copyright : (c) Andrea Rossato
+-- License : BSD-style (see LICENSE)
+--
+-- Maintainer : Jose A. Ortega Ruiz <jao@gnu.org>
+-- Stability : unstable
+-- Portability : unportable
+--
+-- The configuration module of Xmobar, a text based status bar
+--
+-----------------------------------------------------------------------------
+
+module Config
+ ( -- * Configuration
+ -- $config
+ Config (..)
+ , XPosition (..), Align (..), Border(..)
+ , defaultConfig
+ , runnableTypes
+ ) where
+
+import Commands
+import {-# SOURCE #-} Runnable
+import Plugins.Monitors
+import Plugins.Date
+import Plugins.PipeReader
+import Plugins.CommandReader
+import Plugins.StdinReader
+import Plugins.XMonadLog
+import Plugins.EWMH
+
+#ifdef INOTIFY
+import Plugins.Mail
+import Plugins.MBox
+#endif
+
+-- $config
+-- Configuration data type and default configuration
+
+-- | The configuration data type
+data Config =
+ Config { font :: String -- ^ Font
+ , bgColor :: String -- ^ Backgroud color
+ , fgColor :: String -- ^ Default font color
+ , position :: XPosition -- ^ Top Bottom or Static
+ , border :: Border -- ^ NoBorder TopB BottomB or FullB
+ , borderColor :: String -- ^ Border color
+ , lowerOnStart :: Bool -- ^ Lower to the bottom of the
+ -- window stack on initialization
+ , commands :: [Runnable] -- ^ For setting the command, the command arguments
+ -- and refresh rate for the programs to run (optional)
+ , sepChar :: String -- ^ The character to be used for indicating
+ -- commands in the output template (default '%')
+ , alignSep :: String -- ^ Separators for left, center and right text alignment
+ , template :: String -- ^ The output template
+ } deriving (Read)
+
+data XPosition = Top
+ | TopW Align Int
+ | TopSize Align Int Int
+ | Bottom
+ | BottomW Align Int
+ | BottomSize Align Int Int
+ | Static {xpos, ypos, width, height :: Int}
+ | OnScreen Int XPosition
+ deriving ( Read, Eq )
+
+data Align = L | R | C deriving ( Read, Eq )
+
+data Border = NoBorder
+ | TopB
+ | BottomB
+ | FullB
+ | TopBM Int
+ | BottomBM Int
+ | FullBM Int
+ deriving ( Read, Eq )
+
+-- | The default configuration values
+defaultConfig :: Config
+defaultConfig =
+ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
+ , bgColor = "#000000"
+ , fgColor = "#BFBFBF"
+ , position = Top
+ , border = NoBorder
+ , borderColor = "#BFBFBF"
+ , lowerOnStart = True
+ , commands = [ Run $ Date "%a %b %_d %Y * %H:%M:%S" "theDate" 10
+ , Run StdinReader]
+ , sepChar = "%"
+ , alignSep = "}{"
+ , template = "%StdinReader% }{ <fc=#00FF00>%uname%</fc> * <fc=#FF0000>%theDate%</fc>"
+ }
+
+
+-- | An alias for tuple types that is more convenient for long lists.
+type a :*: b = (a, b)
+infixr :*:
+
+-- | This is the list of types that can be hidden inside
+-- 'Runnable.Runnable', the existential type that stores all commands
+-- to be executed by Xmobar. It is used by 'Runnable.readRunnable' in
+-- the 'Runnable.Runnable' Read instance. To install a plugin just add
+-- the plugin's type to the list of types (separated by ':*:') appearing in
+-- this function's type signature.
+runnableTypes :: Command :*: Monitors :*: Date :*: PipeReader :*: CommandReader :*: StdinReader :*: XMonadLog :*: EWMH :*:
+#ifdef INOTIFY
+ Mail :*: MBox :*:
+#endif
+ ()
+runnableTypes = undefined