diff options
author | jao <jao@gnu.org> | 2018-11-25 03:40:55 +0000 |
---|---|---|
committer | jao <jao@gnu.org> | 2018-11-25 03:40:55 +0000 |
commit | 0691071716e6cfa6040044be0ca782771fe6104c (patch) | |
tree | a079186bc8e4f44933a9a4c49f11ac30fcd6762b | |
parent | b909762b396932bf6d768c1f4beae5bbcb50f95a (diff) | |
download | xmobar-0691071716e6cfa6040044be0ca782771fe6104c.tar.gz xmobar-0691071716e6cfa6040044be0ca782771fe6104c.tar.bz2 |
Refactoring: Xmobar.System
-rw-r--r-- | src/lib/Xmobar.hs | 2 | ||||
-rw-r--r-- | src/lib/Xmobar/Commands.hs | 2 | ||||
-rw-r--r-- | src/lib/Xmobar/Plugins/BufferedPipeReader.hs | 2 | ||||
-rw-r--r-- | src/lib/Xmobar/Plugins/DateZone.hs | 3 | ||||
-rw-r--r-- | src/lib/Xmobar/Plugins/Monitors/Disk.hs | 4 | ||||
-rw-r--r-- | src/lib/Xmobar/System/DBus.hs (renamed from src/lib/Xmobar/IPC/DBus.hs) | 4 | ||||
-rw-r--r-- | src/lib/Xmobar/System/Localize.hsc (renamed from src/lib/Xmobar/Localize.hsc) | 4 | ||||
-rw-r--r-- | src/lib/Xmobar/System/Signal.hs (renamed from src/lib/Xmobar/Signal.hs) | 6 | ||||
-rw-r--r-- | src/lib/Xmobar/System/StatFS.hsc (renamed from src/lib/Xmobar/StatFS.hsc) | 2 | ||||
-rw-r--r-- | src/lib/Xmobar/X11/EventLoop.hs | 8 | ||||
-rw-r--r-- | xmobar.cabal | 10 |
11 files changed, 25 insertions, 22 deletions
diff --git a/src/lib/Xmobar.hs b/src/lib/Xmobar.hs index 2b160a1..3ab779d 100644 --- a/src/lib/Xmobar.hs +++ b/src/lib/Xmobar.hs @@ -27,7 +27,7 @@ import Control.Exception (bracket) import Xmobar.Config import Xmobar.Runnable import Xmobar.Parsers -import Xmobar.Signal (setupSignalHandler, withDeferSignals) +import Xmobar.System.Signal (setupSignalHandler, withDeferSignals) import Xmobar.X11.Types import Xmobar.X11.EventLoop (startLoop, startCommand) import Xmobar.X11.XUtil diff --git a/src/lib/Xmobar/Commands.hs b/src/lib/Xmobar/Commands.hs index 9c92de0..93a9590 100644 --- a/src/lib/Xmobar/Commands.hs +++ b/src/lib/Xmobar/Commands.hs @@ -31,7 +31,7 @@ import System.Process import System.Exit import System.IO (hClose) -import Xmobar.Signal +import Xmobar.System.Signal import Xmobar.Utils (hGetLineSafe) class Show e => Exec e where diff --git a/src/lib/Xmobar/Plugins/BufferedPipeReader.hs b/src/lib/Xmobar/Plugins/BufferedPipeReader.hs index 4bb80db..ce6a783 100644 --- a/src/lib/Xmobar/Plugins/BufferedPipeReader.hs +++ b/src/lib/Xmobar/Plugins/BufferedPipeReader.hs @@ -22,8 +22,8 @@ import System.IO.Unsafe(unsafePerformIO) import Xmobar.Environment import Xmobar.Plugins -import Xmobar.Signal import Xmobar.Utils(hGetLineSafe) +import Xmobar.System.Signal data BufferedPipeReader = BufferedPipeReader String [(Int, Bool, String)] deriving (Read, Show) diff --git a/src/lib/Xmobar/Plugins/DateZone.hs b/src/lib/Xmobar/Plugins/DateZone.hs index 753f530..f386202 100644 --- a/src/lib/Xmobar/Plugins/DateZone.hs +++ b/src/lib/Xmobar/Plugins/DateZone.hs @@ -30,12 +30,13 @@ import Control.Concurrent.STM import System.IO.Unsafe -import Xmobar.Localize import Data.Time.Format import Data.Time.LocalTime import Data.Time.LocalTime.TimeZone.Olson import Data.Time.LocalTime.TimeZone.Series +import Xmobar.System.Localize + #if ! MIN_VERSION_time(1,5,0) import System.Locale (TimeLocale) #endif diff --git a/src/lib/Xmobar/Plugins/Monitors/Disk.hs b/src/lib/Xmobar/Plugins/Monitors/Disk.hs index aedad75..3f89629 100644 --- a/src/lib/Xmobar/Plugins/Monitors/Disk.hs +++ b/src/lib/Xmobar/Plugins/Monitors/Disk.hs @@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Plugins.Monitors.Disk --- Copyright : (c) 2010, 2011, 2012, 2014 Jose A Ortega Ruiz +-- Copyright : (c) 2010, 2011, 2012, 2014, 2018 Jose A Ortega Ruiz -- License : BSD-style (see LICENSE) -- -- Maintainer : Jose A Ortega Ruiz <jao@gnu.org> @@ -15,7 +15,7 @@ module Xmobar.Plugins.Monitors.Disk (diskUConfig, runDiskU, startDiskIO) where import Xmobar.Plugins.Monitors.Common -import Xmobar.StatFS +import Xmobar.System.StatFS import Data.IORef (IORef, newIORef, readIORef, writeIORef) diff --git a/src/lib/Xmobar/IPC/DBus.hs b/src/lib/Xmobar/System/DBus.hs index 894637b..103a5a9 100644 --- a/src/lib/Xmobar/IPC/DBus.hs +++ b/src/lib/Xmobar/System/DBus.hs @@ -12,7 +12,7 @@ -- ----------------------------------------------------------------------------- -module Xmobar.IPC.DBus (runIPC) where +module Xmobar.System.DBus (runIPC) where import DBus import DBus.Client hiding (interfaceName) @@ -23,7 +23,7 @@ import Control.Exception (handle) import System.IO (stderr, hPutStrLn) import Control.Monad.IO.Class (liftIO) -import Xmobar.Signal +import Xmobar.System.Signal busName :: BusName busName = busName_ "org.Xmobar.Control" diff --git a/src/lib/Xmobar/Localize.hsc b/src/lib/Xmobar/System/Localize.hsc index 984aa2b..eec5e3b 100644 --- a/src/lib/Xmobar/Localize.hsc +++ b/src/lib/Xmobar/System/Localize.hsc @@ -2,7 +2,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Localize --- Copyright : (C) 2011 Martin Perner +-- Copyright : (C) 2011, 2018 Martin Perner -- License : BSD-style (see LICENSE) -- -- Maintainer : Martin Perner <martin@perner.cc> @@ -13,7 +13,7 @@ -- ----------------------------------------------------------------------------- -module Xmobar.Localize +module Xmobar.System.Localize ( setupTimeLocale, getTimeLocale ) where diff --git a/src/lib/Xmobar/Signal.hs b/src/lib/Xmobar/System/Signal.hs index fd68e80..ce39e10 100644 --- a/src/lib/Xmobar/Signal.hs +++ b/src/lib/Xmobar/System/Signal.hs @@ -16,7 +16,7 @@ -- ----------------------------------------------------------------------------- -module Xmobar.Signal where +module Xmobar.System.Signal where import Data.Foldable (for_) import Data.Typeable (Typeable) @@ -33,7 +33,9 @@ import DBus (IsVariant(..)) import Control.Monad ((>=>)) #endif -import Xmobar.Utils (safeHead) +safeHead :: [a] -> Maybe a +safeHead [] = Nothing +safeHead (x:_) = Just x data WakeUp = WakeUp deriving (Show,Typeable) instance Exception WakeUp diff --git a/src/lib/Xmobar/StatFS.hsc b/src/lib/Xmobar/System/StatFS.hsc index 25de0df..529b16a 100644 --- a/src/lib/Xmobar/StatFS.hsc +++ b/src/lib/Xmobar/System/StatFS.hsc @@ -15,7 +15,7 @@ {-# LANGUAGE CPP, ForeignFunctionInterface, EmptyDataDecls #-} -module Xmobar.StatFS ( FileSystemStats(..), getFileSystemStats ) where +module Xmobar.System.StatFS ( FileSystemStats(..), getFileSystemStats ) where import Foreign import Foreign.C.Types diff --git a/src/lib/Xmobar/X11/EventLoop.hs b/src/lib/Xmobar/X11/EventLoop.hs index 1c864c3..231d953 100644 --- a/src/lib/Xmobar/X11/EventLoop.hs +++ b/src/lib/Xmobar/X11/EventLoop.hs @@ -36,25 +36,25 @@ import Data.Bits import Data.Map hiding (foldr, map, filter) import Data.Maybe (fromJust, isJust) -import Xmobar.X11.Bitmap as Bitmap -import Xmobar.X11.Types import Xmobar.Config import Xmobar.Parsers import Xmobar.Commands import Xmobar.Actions import Xmobar.Runnable -import Xmobar.Signal +import Xmobar.System.Signal import Xmobar.X11.Window import Xmobar.X11.XUtil import Xmobar.Utils import Xmobar.X11.Draw +import Xmobar.X11.Bitmap as Bitmap +import Xmobar.X11.Types #ifdef XFT import Graphics.X11.Xft #endif #ifdef DBUS -import Xmobar.IPC.DBus +import Xmobar.System.DBus #endif runX :: XConf -> X () -> IO () diff --git a/xmobar.cabal b/xmobar.cabal index f250dfd..e0cc2e8 100644 --- a/xmobar.cabal +++ b/xmobar.cabal @@ -129,10 +129,11 @@ library Xmobar.Plugins.Monitors.Bright, Xmobar.Plugins.Monitors.CatInt - other-modules: Xmobar.Localize, - Xmobar.Parsers, + other-modules: Xmobar.Parsers, Xmobar.Utils, - Xmobar.StatFS, + Xmobar.System.StatFS, + Xmobar.System.Localize, + Xmobar.System.Signal, Xmobar.X11.Types, Xmobar.X11.XUtil, Xmobar.X11.Bitmap, @@ -140,7 +141,6 @@ library Xmobar.X11.ColorCache, Xmobar.X11.Window, Xmobar.X11.Draw, - Xmobar.Signal, Xmobar.Environment extra-libraries: Xrandr Xrender @@ -224,7 +224,7 @@ library if flag(with_dbus) || flag(all_extensions) build-depends: dbus >= 1 - other-modules: Xmobar.IPC.DBus + other-modules: Xmobar.System.DBus cpp-options: -DDBUS if flag(with_xpm) || flag(all_extensions) |