From 7c270f9d0810db118f4ba3b8c47bc70b8be78d1e Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 26 Nov 2018 02:16:41 +0000 Subject: App.Defaults -> App.Config --- src/Xmobar.hs | 2 +- src/Xmobar/App/Config.hs | 71 ++++++++++++++++++++++++++++++++++++++++++++++ src/Xmobar/App/Defaults.hs | 71 ---------------------------------------------- xmobar.cabal | 2 +- 4 files changed, 73 insertions(+), 73 deletions(-) create mode 100644 src/Xmobar/App/Config.hs delete mode 100644 src/Xmobar/App/Defaults.hs diff --git a/src/Xmobar.hs b/src/Xmobar.hs index bee6f29..df31abd 100644 --- a/src/Xmobar.hs +++ b/src/Xmobar.hs @@ -64,4 +64,4 @@ import Xmobar.Plugins.StdinReader import Xmobar.Plugins.XMonadLog import Xmobar.App.Main(xmobar) -import Xmobar.App.Defaults(defaultConfig, getXdgConfigFile) +import Xmobar.App.Config(defaultConfig, getXdgConfigFile) diff --git a/src/Xmobar/App/Config.hs b/src/Xmobar/App/Config.hs new file mode 100644 index 0000000..86bc9cb --- /dev/null +++ b/src/Xmobar/App/Config.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.Config (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% }{ " ++ + "%uname% * %theDate%" + } + +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/Defaults.hs b/src/Xmobar/App/Defaults.hs deleted file mode 100644 index ac3146c..0000000 --- a/src/Xmobar/App/Defaults.hs +++ /dev/null @@ -1,71 +0,0 @@ ------------------------------------------------------------------------------- --- | --- 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% }{ " ++ - "%uname% * %theDate%" - } - -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/xmobar.cabal b/xmobar.cabal index 5e74efb..2430f5f 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -104,7 +104,7 @@ library Xmobar.Run.Runnable Xmobar.App.EventLoop, Xmobar.App.Main, - Xmobar.App.Defaults, + Xmobar.App.Config, Xmobar.System.Utils, Xmobar.System.StatFS, Xmobar.System.Environment, -- cgit v1.2.3