summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Xmobar.hs9
-rw-r--r--src/Xmobar/App/Defaults.hs71
-rw-r--r--src/Xmobar/App/EventLoop.hs2
-rw-r--r--src/Xmobar/App/Main.hs2
-rw-r--r--src/Xmobar/Config/Types.hs (renamed from src/Xmobar/Config.hs)59
-rw-r--r--src/Xmobar/X11/Draw.hs2
-rw-r--r--src/Xmobar/X11/Parsers.hs2
-rw-r--r--src/Xmobar/X11/Types.hs2
-rw-r--r--src/Xmobar/X11/Window.hs2
9 files changed, 86 insertions, 65 deletions
diff --git a/src/Xmobar.hs b/src/Xmobar.hs
index 2b15835..dda56db 100644
--- a/src/Xmobar.hs
+++ b/src/Xmobar.hs
@@ -16,9 +16,11 @@
-----------------------------------------------------------------------------
module Xmobar (xmobar
+ , defaultConfig
+ , getXdgConfigFile
, Runnable (..)
, Exec (..)
- , module Xmobar.Config
+ , module Xmobar.Config.Types
, module Xmobar.Plugins.BufferedPipeReader
, module Xmobar.Plugins.CommandReader
, module Xmobar.Plugins.Date
@@ -40,7 +42,7 @@ module Xmobar (xmobar
import Xmobar.Run.Runnable
import Xmobar.Run.Commands
-import Xmobar.Config
+import Xmobar.Config.Types
import Xmobar.Plugins.BufferedPipeReader
import Xmobar.Plugins.CommandReader
import Xmobar.Plugins.Date
@@ -59,4 +61,5 @@ import Xmobar.Plugins.PipeReader
import Xmobar.Plugins.StdinReader
import Xmobar.Plugins.XMonadLog
-import Xmobar.App.Main (xmobar)
+import Xmobar.App.Main(xmobar)
+import Xmobar.App.Defaults(defaultConfig, getXdgConfigFile)
diff --git a/src/Xmobar/App/Defaults.hs b/src/Xmobar/App/Defaults.hs
new file mode 100644
index 0000000..ac3146c
--- /dev/null
+++ b/src/Xmobar/App/Defaults.hs
@@ -0,0 +1,71 @@
+------------------------------------------------------------------------------
+-- |
+-- Module: Xmobar.Config.Defaults
+-- Copyright: (c) 2018 Jose Antonio Ortega Ruiz
+-- License: BSD3-style (see LICENSE)
+--
+-- Maintainer: jao@gnu.org
+-- Stability: unstable
+-- Portability: portable
+-- Created: Sun Nov 25, 2018 22:26
+--
+--
+-- Default values for Xmobar configurations
+--
+------------------------------------------------------------------------------
+
+
+module Xmobar.App.Defaults (defaultConfig, getXdgConfigFile) where
+
+import System.Environment
+import System.Directory (getHomeDirectory)
+import System.FilePath ((</>))
+
+import Xmobar.Plugins.Date
+import Xmobar.Plugins.StdinReader
+import Xmobar.Config.Types
+import Xmobar.Run.Runnable
+
+-- | The default configuration values
+defaultConfig :: Config
+defaultConfig =
+ Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
+ , additionalFonts = []
+ , wmClass = "xmobar"
+ , wmName = "xmobar"
+ , bgColor = "#000000"
+ , fgColor = "#BFBFBF"
+ , alpha = 255
+ , position = Top
+ , border = NoBorder
+ , borderColor = "#BFBFBF"
+ , borderWidth = 1
+ , textOffset = -1
+ , iconOffset = -1
+ , textOffsets = []
+ , hideOnStart = False
+ , lowerOnStart = True
+ , persistent = False
+ , allDesktops = True
+ , overrideRedirect = True
+ , pickBroadest = False
+ , iconRoot = "."
+ , 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>"
+ }
+
+xdgConfigDir :: IO String
+xdgConfigDir = do env <- getEnvironment
+ case lookup "XDG_CONFIG_HOME" env of
+ Just val -> return val
+ Nothing -> fmap (</> ".config") getHomeDirectory
+
+xmobarConfigDir :: IO FilePath
+xmobarConfigDir = fmap (</> "xmobar") xdgConfigDir
+
+getXdgConfigFile :: IO FilePath
+getXdgConfigFile = fmap (</> "xmobarrc") xmobarConfigDir
diff --git a/src/Xmobar/App/EventLoop.hs b/src/Xmobar/App/EventLoop.hs
index 95ce129..c751511 100644
--- a/src/Xmobar/App/EventLoop.hs
+++ b/src/Xmobar/App/EventLoop.hs
@@ -36,9 +36,9 @@ import Data.Bits
import Data.Map hiding (foldr, map, filter)
import Data.Maybe (fromJust, isJust)
-import Xmobar.Config
import Xmobar.Utils
import Xmobar.System.Signal
+import Xmobar.Config.Types
import Xmobar.X11.Actions
import Xmobar.Run.Commands
import Xmobar.Run.Runnable
diff --git a/src/Xmobar/App/Main.hs b/src/Xmobar/App/Main.hs
index 329a4b5..b180e39 100644
--- a/src/Xmobar/App/Main.hs
+++ b/src/Xmobar/App/Main.hs
@@ -24,7 +24,7 @@ import Graphics.X11.Xlib
import Control.Concurrent.Async (Async, cancel)
import Control.Exception (bracket)
-import Xmobar.Config
+import Xmobar.Config.Types
import Xmobar.System.Signal (setupSignalHandler, withDeferSignals)
import Xmobar.Run.Template
import Xmobar.X11.Types
diff --git a/src/Xmobar/Config.hs b/src/Xmobar/Config/Types.hs
index a07af9e..ab85d5b 100644
--- a/src/Xmobar/Config.hs
+++ b/src/Xmobar/Config/Types.hs
@@ -8,30 +8,21 @@
-- Stability : unstable
-- Portability : unportable
--
--- The configuration module of Xmobar, a text based status bar
+-- The configuration types
--
-----------------------------------------------------------------------------
-module Xmobar.Config
+module Xmobar.Config.Types
( -- * Configuration
-- $config
Config (..)
, XPosition (..), Align (..), Border(..)
- , defaultConfig
- , getXdgConfigFile
) where
-import Xmobar.Plugins.Date
-import Xmobar.Plugins.StdinReader
-
-import System.Environment
-import System.Directory (getHomeDirectory)
-import System.FilePath ((</>))
-
import Xmobar.Run.Runnable (Runnable(..))
-- $config
--- Configuration data type and default configuration
+-- Configuration data type
-- | The configuration data type
data Config =
@@ -97,47 +88,3 @@ data Border = NoBorder
| BottomBM Int
| FullBM Int
deriving ( Read, Eq )
-
--- | The default configuration values
-defaultConfig :: Config
-defaultConfig =
- Config { font = "-misc-fixed-*-*-*-*-10-*-*-*-*-*-*-*"
- , additionalFonts = []
- , wmClass = "xmobar"
- , wmName = "xmobar"
- , bgColor = "#000000"
- , fgColor = "#BFBFBF"
- , alpha = 255
- , position = Top
- , border = NoBorder
- , borderColor = "#BFBFBF"
- , borderWidth = 1
- , textOffset = -1
- , iconOffset = -1
- , textOffsets = []
- , hideOnStart = False
- , lowerOnStart = True
- , persistent = False
- , allDesktops = True
- , overrideRedirect = True
- , pickBroadest = False
- , iconRoot = "."
- , 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>"
- }
-
-xdgConfigDir :: IO String
-xdgConfigDir = do env <- getEnvironment
- case lookup "XDG_CONFIG_HOME" env of
- Just val -> return val
- Nothing -> fmap (</> ".config") getHomeDirectory
-
-xmobarConfigDir :: IO FilePath
-xmobarConfigDir = fmap (</> "xmobar") xdgConfigDir
-
-getXdgConfigFile :: IO FilePath
-getXdgConfigFile = fmap (</> "xmobarrc") xmobarConfigDir
diff --git a/src/Xmobar/X11/Draw.hs b/src/Xmobar/X11/Draw.hs
index 781ced8..246eb84 100644
--- a/src/Xmobar/X11/Draw.hs
+++ b/src/Xmobar/X11/Draw.hs
@@ -29,11 +29,11 @@ import Data.Map hiding (foldr, map, filter)
import Graphics.X11.Xlib hiding (textExtents, textWidth)
import Graphics.X11.Xlib.Extras
+import Xmobar.Config.Types
import qualified Xmobar.X11.Bitmap as B
import Xmobar.X11.Actions (Action(..))
import Xmobar.X11.Types
import Xmobar.X11.XUtil
-import Xmobar.Config
import Xmobar.X11.ColorCache
import Xmobar.X11.Window (drawBorder)
import Xmobar.X11.Parsers (Widget(..))
diff --git a/src/Xmobar/X11/Parsers.hs b/src/Xmobar/X11/Parsers.hs
index c76110d..258964a 100644
--- a/src/Xmobar/X11/Parsers.hs
+++ b/src/Xmobar/X11/Parsers.hs
@@ -16,7 +16,7 @@
module Xmobar.X11.Parsers (parseString, Widget(..)) where
-import Xmobar.Config
+import Xmobar.Config.Types
import Xmobar.X11.Actions
import Control.Monad (guard, mzero)
diff --git a/src/Xmobar/X11/Types.hs b/src/Xmobar/X11/Types.hs
index c5c7ade..f551c2a 100644
--- a/src/Xmobar/X11/Types.hs
+++ b/src/Xmobar/X11/Types.hs
@@ -23,7 +23,7 @@ import Data.Map
import Xmobar.X11.Bitmap
import Xmobar.X11.XUtil
-import Xmobar.Config
+import Xmobar.Config.Types
-- | The X type is a ReaderT
type X = ReaderT XConf IO
diff --git a/src/Xmobar/X11/Window.hs b/src/Xmobar/X11/Window.hs
index 78f4b26..23568ab 100644
--- a/src/Xmobar/X11/Window.hs
+++ b/src/Xmobar/X11/Window.hs
@@ -28,7 +28,7 @@ import Data.List (maximumBy)
import Data.Maybe (fromMaybe)
import System.Posix.Process (getProcessID)
-import Xmobar.Config
+import Xmobar.Config.Types
import Xmobar.X11.XUtil
-- $window