summaryrefslogtreecommitdiffhomepage
path: root/src/lib/Xmobar/Plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Xmobar/Plugins')
-rw-r--r--src/lib/Xmobar/Plugins/BufferedPipeReader.hs1
-rw-r--r--src/lib/Xmobar/Plugins/CommandReader.hs1
-rw-r--r--src/lib/Xmobar/Plugins/MBox.hs2
-rw-r--r--src/lib/Xmobar/Plugins/Mail.hs2
-rw-r--r--src/lib/Xmobar/Plugins/MarqueePipeReader.hs3
-rw-r--r--src/lib/Xmobar/Plugins/PipeReader.hs5
-rw-r--r--src/lib/Xmobar/Plugins/StdinReader.hs1
-rw-r--r--src/lib/Xmobar/Plugins/Utils.hs43
8 files changed, 10 insertions, 48 deletions
diff --git a/src/lib/Xmobar/Plugins/BufferedPipeReader.hs b/src/lib/Xmobar/Plugins/BufferedPipeReader.hs
index d4d30a1..4bb80db 100644
--- a/src/lib/Xmobar/Plugins/BufferedPipeReader.hs
+++ b/src/lib/Xmobar/Plugins/BufferedPipeReader.hs
@@ -23,6 +23,7 @@ import System.IO.Unsafe(unsafePerformIO)
import Xmobar.Environment
import Xmobar.Plugins
import Xmobar.Signal
+import Xmobar.Utils(hGetLineSafe)
data BufferedPipeReader = BufferedPipeReader String [(Int, Bool, String)]
deriving (Read, Show)
diff --git a/src/lib/Xmobar/Plugins/CommandReader.hs b/src/lib/Xmobar/Plugins/CommandReader.hs
index 80b6299..e90fa62 100644
--- a/src/lib/Xmobar/Plugins/CommandReader.hs
+++ b/src/lib/Xmobar/Plugins/CommandReader.hs
@@ -17,6 +17,7 @@ module Xmobar.Plugins.CommandReader where
import System.IO
import Xmobar.Plugins
+import Xmobar.Utils (hGetLineSafe)
import System.Process(runInteractiveCommand, getProcessExitCode)
data CommandReader = CommandReader String String
diff --git a/src/lib/Xmobar/Plugins/MBox.hs b/src/lib/Xmobar/Plugins/MBox.hs
index 2281629..20e63cf 100644
--- a/src/lib/Xmobar/Plugins/MBox.hs
+++ b/src/lib/Xmobar/Plugins/MBox.hs
@@ -18,7 +18,7 @@ module Xmobar.Plugins.MBox (MBox(..)) where
import Prelude
import Xmobar.Plugins
#ifdef INOTIFY
-import Xmobar.Plugins.Utils (changeLoop, expandHome)
+import Xmobar.Utils (changeLoop, expandHome)
import Control.Monad (when)
import Control.Concurrent.STM
diff --git a/src/lib/Xmobar/Plugins/Mail.hs b/src/lib/Xmobar/Plugins/Mail.hs
index c41b5b3..d8946bf 100644
--- a/src/lib/Xmobar/Plugins/Mail.hs
+++ b/src/lib/Xmobar/Plugins/Mail.hs
@@ -17,7 +17,7 @@ module Xmobar.Plugins.Mail where
import Xmobar.Plugins
#ifdef INOTIFY
-import Xmobar.Plugins.Utils (expandHome, changeLoop)
+import Xmobar.Utils (expandHome, changeLoop)
import Control.Monad
import Control.Concurrent.STM
diff --git a/src/lib/Xmobar/Plugins/MarqueePipeReader.hs b/src/lib/Xmobar/Plugins/MarqueePipeReader.hs
index ad6f27f..ad1ae40 100644
--- a/src/lib/Xmobar/Plugins/MarqueePipeReader.hs
+++ b/src/lib/Xmobar/Plugins/MarqueePipeReader.hs
@@ -16,7 +16,8 @@ module Xmobar.Plugins.MarqueePipeReader where
import System.IO (openFile, IOMode(ReadWriteMode), Handle)
import Xmobar.Environment
-import Xmobar.Plugins (tenthSeconds, Exec(alias, start), hGetLineSafe)
+import Xmobar.Plugins (tenthSeconds, Exec(alias, start))
+import Xmobar.Utils(hGetLineSafe)
import System.Posix.Files (getFileStatus, isNamedPipe)
import Control.Concurrent(forkIO, threadDelay)
import Control.Concurrent.STM (TChan, atomically, writeTChan, tryReadTChan, newTChan)
diff --git a/src/lib/Xmobar/Plugins/PipeReader.hs b/src/lib/Xmobar/Plugins/PipeReader.hs
index 7166163..593a4a7 100644
--- a/src/lib/Xmobar/Plugins/PipeReader.hs
+++ b/src/lib/Xmobar/Plugins/PipeReader.hs
@@ -15,8 +15,9 @@
module Xmobar.Plugins.PipeReader where
import System.IO
-import Xmobar.Plugins
-import Xmobar.Environment
+import Xmobar.Plugins(Exec(..))
+import Xmobar.Environment(expandEnv)
+import Xmobar.Utils(hGetLineSafe)
import System.Posix.Files
import Control.Concurrent(threadDelay)
import Control.Exception
diff --git a/src/lib/Xmobar/Plugins/StdinReader.hs b/src/lib/Xmobar/Plugins/StdinReader.hs
index 372e4f9..ad8e60c 100644
--- a/src/lib/Xmobar/Plugins/StdinReader.hs
+++ b/src/lib/Xmobar/Plugins/StdinReader.hs
@@ -25,6 +25,7 @@ import System.IO
import Control.Exception (SomeException(..), handle)
import Xmobar.Plugins
import Xmobar.Actions (stripActions)
+import Xmobar.Utils (hGetLineSafe)
data StdinReader = StdinReader | UnsafeStdinReader
deriving (Read, Show)
diff --git a/src/lib/Xmobar/Plugins/Utils.hs b/src/lib/Xmobar/Plugins/Utils.hs
deleted file mode 100644
index 6546c15..0000000
--- a/src/lib/Xmobar/Plugins/Utils.hs
+++ /dev/null
@@ -1,43 +0,0 @@
-------------------------------------------------------------------------------
--- |
--- Module: Plugins.Utils
--- Copyright: (c) 2010 Jose Antonio Ortega Ruiz
--- License: BSD3-style (see LICENSE)
---
--- Maintainer: Jose A Ortega Ruiz <jao@gnu.org>
--- Stability: unstable
--- Portability: unportable
--- Created: Sat Dec 11, 2010 20:55
---
---
--- Miscellaneous utility functions
---
-------------------------------------------------------------------------------
-
-
-module Xmobar.Plugins.Utils (expandHome, changeLoop, safeHead) where
-
-import Control.Monad
-import Control.Concurrent.STM
-
-import System.Environment
-import System.FilePath
-
-
-expandHome :: FilePath -> IO FilePath
-expandHome ('~':'/':path) = fmap (</> path) (getEnv "HOME")
-expandHome p = return p
-
-changeLoop :: Eq a => STM a -> (a -> IO ()) -> IO ()
-changeLoop s f = atomically s >>= go
- where
- go old = do
- f old
- go =<< atomically (do
- new <- s
- guard (new /= old)
- return new)
-
-safeHead :: [a] -> Maybe a
-safeHead [] = Nothing
-safeHead (x:_) = Just x