diff options
author | jao <jao@gnu.org> | 2018-11-25 22:46:50 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-11-25 22:46:50 +0000 |
commit | 01ef9a6549e6de63384f2e597804c11f0d837455 (patch) | |
tree | 88536f0ad382a1c2eddfb2ce7e01bcb7b7c1e05d /src/Xmobar/App | |
parent | dba5bb8d946deca0872a17d98e3f1753c2160163 (diff) | |
download | xmobar-01ef9a6549e6de63384f2e597804c11f0d837455.tar.gz xmobar-01ef9a6549e6de63384f2e597804c11f0d837455.tar.bz2 |
Xmobar.App.Defaults and Xmobar.Config.Types
Diffstat (limited to 'src/Xmobar/App')
-rw-r--r-- | src/Xmobar/App/Defaults.hs | 71 | ||||
-rw-r--r-- | src/Xmobar/App/EventLoop.hs | 2 | ||||
-rw-r--r-- | src/Xmobar/App/Main.hs | 2 |
3 files changed, 73 insertions, 2 deletions
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 |