diff options
author | jao <jao@gnu.org> | 2022-09-26 03:52:56 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-09-26 03:52:56 +0100 |
commit | f946b9c37b39a1b46bfe6433434f951ece531d94 (patch) | |
tree | aaccadcf6efcbc05c6f09c83a640b66b457d0ef6 | |
parent | 579b787c66124c1bc67dfa7a4ad00f3a8e3611cb (diff) | |
download | xmobar-f946b9c37b39a1b46bfe6433434f951ece531d94.tar.gz xmobar-f946b9c37b39a1b46bfe6433434f951ece531d94.tar.bz2 |
more little import clean ups
-rw-r--r-- | src/Xmobar/System/Environment.hs | 6 | ||||
-rw-r--r-- | src/Xmobar/X11/Events.hs | 19 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/Xmobar/System/Environment.hs b/src/Xmobar/System/Environment.hs index 25802fe..42483ca 100644 --- a/src/Xmobar/System/Environment.hs +++ b/src/Xmobar/System/Environment.hs @@ -13,14 +13,14 @@ ----------------------------------------------------------------------------- module Xmobar.System.Environment(expandEnv) where -import Data.Maybe (fromMaybe) -import System.Environment (lookupEnv) +import qualified Data.Maybe as M +import qualified System.Environment as E expandEnv :: String -> IO String expandEnv "" = return "" expandEnv (c:s) = case c of '$' -> do - envVar <- fromMaybe "" <$> lookupEnv e + envVar <- M.fromMaybe "" <$> E.lookupEnv e remainder <- expandEnv s' return $ envVar ++ remainder where (e, s') = getVar s diff --git a/src/Xmobar/X11/Events.hs b/src/Xmobar/X11/Events.hs index 4334f6b..fbd2bd0 100644 --- a/src/Xmobar/X11/Events.hs +++ b/src/Xmobar/X11/Events.hs @@ -1,7 +1,7 @@ ------------------------------------------------------------------------------ -- | -- Module: Xmobar.X11.Events --- Copyright: (c) 2018 Jose Antonio Ortega Ruiz +-- Copyright: (c) 2018, 2022 Jose Antonio Ortega Ruiz -- License: BSD3-style (see LICENSE) -- -- Maintainer: jao@gnu.org @@ -17,20 +17,19 @@ module Xmobar.X11.Events(nextEvent') where -import Control.Concurrent -import System.Posix.Types (Fd(..)) +import qualified Control.Concurrent as C +import qualified System.Posix.Types as T -import Graphics.X11.Xlib ( - Display(..), XEventPtr, nextEvent, pending, connectionNumber) +import qualified Graphics.X11.Xlib as X -- | A version of nextEvent that does not block in foreign calls. -nextEvent' :: Display -> XEventPtr -> IO () +nextEvent' :: X.Display -> X.XEventPtr -> IO () nextEvent' d p = do - pend <- pending d + pend <- X.pending d if pend /= 0 - then nextEvent d p + then X.nextEvent d p else do - threadWaitRead (Fd fd) + C.threadWaitRead (T.Fd fd) nextEvent' d p where - fd = connectionNumber d + fd = X.connectionNumber d |