REF rename a bunch of stuff
This commit is contained in:
parent
17ebd0137f
commit
1b4480ac3a
|
@ -12,7 +12,7 @@
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Options.Applicative
|
import Options.Applicative
|
||||||
import RIO hiding (hFlush)
|
import RIO hiding (hFlush)
|
||||||
import qualified RIO.ByteString.Lazy as BL
|
import qualified RIO.ByteString.Lazy as BL
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
module Main (main) where
|
module Main (main) where
|
||||||
|
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Data.Text.IO (hPutStrLn)
|
import Data.Text.IO (hPutStrLn)
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Functions for handling dependencies
|
-- Functions for handling dependencies
|
||||||
|
|
||||||
module Data.Internal.Dependency
|
module Data.Internal.XIO
|
||||||
-- feature types
|
-- feature types
|
||||||
( Feature
|
( Feature
|
||||||
, Always (..)
|
, Always (..)
|
||||||
|
@ -26,6 +26,7 @@ module Data.Internal.Dependency
|
||||||
, SubfeatureRoot
|
, SubfeatureRoot
|
||||||
, Msg (..)
|
, Msg (..)
|
||||||
-- configuration
|
-- configuration
|
||||||
|
, XEnv (..)
|
||||||
, XParams (..)
|
, XParams (..)
|
||||||
, XPFeatures (..)
|
, XPFeatures (..)
|
||||||
, XPQuery
|
, XPQuery
|
||||||
|
@ -134,7 +135,7 @@ runXIO x = do
|
||||||
pc <- mkDefaultProcessContext
|
pc <- mkDefaultProcessContext
|
||||||
withLogFunc logOpts $ \f -> do
|
withLogFunc logOpts $ \f -> do
|
||||||
p <- getParams
|
p <- getParams
|
||||||
let s = DepStage f pc p
|
let s = XEnv f pc p
|
||||||
runRIO s x
|
runRIO s x
|
||||||
|
|
||||||
-- | Execute an Always immediately
|
-- | Execute an Always immediately
|
||||||
|
@ -377,19 +378,19 @@ data PostFail = PostFail [Msg] | PostMissing Msg
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
-- Configuration
|
-- Configuration
|
||||||
|
|
||||||
type XIO a = RIO DepStage a
|
type XIO a = RIO XEnv a
|
||||||
|
|
||||||
data DepStage = DepStage
|
data XEnv = XEnv
|
||||||
{ dsLogFun :: !LogFunc
|
{ xLogFun :: !LogFunc
|
||||||
, dsProcCxt :: !ProcessContext
|
, xProcCxt :: !ProcessContext
|
||||||
, dsParams :: !XParams
|
, xParams :: !XParams
|
||||||
}
|
}
|
||||||
|
|
||||||
instance HasLogFunc DepStage where
|
instance HasLogFunc XEnv where
|
||||||
logFuncL = lens dsLogFun (\x y -> x {dsLogFun = y})
|
logFuncL = lens xLogFun (\x y -> x {xLogFun = y})
|
||||||
|
|
||||||
instance HasProcessContext DepStage where
|
instance HasProcessContext XEnv where
|
||||||
processContextL = lens dsProcCxt (\x y -> x {dsProcCxt = y})
|
processContextL = lens xProcCxt (\x y -> x {xProcCxt = y})
|
||||||
|
|
||||||
data XParams = XParams
|
data XParams = XParams
|
||||||
{ xpLogLevel :: LogLevel
|
{ xpLogLevel :: LogLevel
|
||||||
|
@ -510,7 +511,7 @@ infix 9 .:+
|
||||||
|
|
||||||
evalSometimesMsg :: Sometimes a -> XIO (Either [FMsg] (a, [FMsg]))
|
evalSometimesMsg :: Sometimes a -> XIO (Either [FMsg] (a, [FMsg]))
|
||||||
evalSometimesMsg (Sometimes n u xs) = do
|
evalSometimesMsg (Sometimes n u xs) = do
|
||||||
r <- asks (u . xpFeatures . dsParams)
|
r <- asks (u . xpFeatures . xParams)
|
||||||
if not r
|
if not r
|
||||||
then return $ Left [dis n]
|
then return $ Left [dis n]
|
||||||
else do
|
else do
|
|
@ -20,7 +20,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
import RIO.Directory
|
import RIO.Directory
|
||||||
( XdgDirectory (..)
|
( XdgDirectory (..)
|
||||||
|
|
|
@ -41,7 +41,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import RIO.Directory
|
import RIO.Directory
|
||||||
import RIO.FilePath
|
import RIO.FilePath
|
||||||
|
|
|
@ -26,7 +26,7 @@ module XMonad.Internal.Command.Power
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Graphics.X11.Types
|
import Graphics.X11.Types
|
||||||
import RIO
|
import RIO
|
||||||
import RIO.Directory
|
import RIO.Directory
|
||||||
|
|
|
@ -10,7 +10,7 @@ module XMonad.Internal.Concurrent.ACPIEvent
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Network.Socket
|
import Network.Socket
|
||||||
import Network.Socket.ByteString
|
import Network.Socket.ByteString
|
||||||
import RIO
|
import RIO
|
||||||
|
|
|
@ -88,13 +88,14 @@ data DynWorkspace = DynWorkspace
|
||||||
-- the same as that in XMonad itself (eg with Query types)
|
-- the same as that in XMonad itself (eg with Query types)
|
||||||
-- type MatchTags = M.Map String String
|
-- type MatchTags = M.Map String String
|
||||||
|
|
||||||
data WConf = WConf
|
data WEnv = WEnv
|
||||||
{ display :: Display
|
{ wDisplay :: !Display
|
||||||
, dynWorkspaces :: [DynWorkspace]
|
, wDynWorkspaces :: ![DynWorkspace]
|
||||||
, curPIDs :: MVar (S.Set Pid)
|
, wCurPIDs :: !(MVar (S.Set Pid))
|
||||||
|
-- , wXEnv :: !XEnv
|
||||||
}
|
}
|
||||||
|
|
||||||
type W a = RIO WConf ()
|
type WIO a = RIO WEnv a
|
||||||
|
|
||||||
runWorkspaceMon :: [DynWorkspace] -> IO ()
|
runWorkspaceMon :: [DynWorkspace] -> IO ()
|
||||||
runWorkspaceMon dws = withOpenDisplay $ \dpy -> do
|
runWorkspaceMon dws = withOpenDisplay $ \dpy -> do
|
||||||
|
@ -107,19 +108,19 @@ runWorkspaceMon dws = withOpenDisplay $ \dpy -> do
|
||||||
where
|
where
|
||||||
withEvents dpy e = do
|
withEvents dpy e = do
|
||||||
ps <- newMVar S.empty
|
ps <- newMVar S.empty
|
||||||
let c = WConf {display = dpy, dynWorkspaces = dws, curPIDs = ps}
|
let c = WEnv {wDisplay = dpy, wDynWorkspaces = dws, wCurPIDs = ps}
|
||||||
runRIO c $
|
runRIO c $
|
||||||
forever $
|
forever $
|
||||||
handleEvent =<< io (nextEvent dpy e >> getEvent e)
|
handleEvent =<< io (nextEvent dpy e >> getEvent e)
|
||||||
|
|
||||||
handleEvent :: Event -> W ()
|
handleEvent :: Event -> WIO ()
|
||||||
|
|
||||||
-- | assume this fires at least once when a new window is created (also could
|
-- | assume this fires at least once when a new window is created (also could
|
||||||
-- use CreateNotify but that is really noisy)
|
-- use CreateNotify but that is really noisy)
|
||||||
handleEvent MapNotifyEvent {ev_window = w} = do
|
handleEvent MapNotifyEvent {ev_window = w} = do
|
||||||
dpy <- asks display
|
dpy <- asks wDisplay
|
||||||
hint <- io $ getClassHint dpy w
|
hint <- io $ getClassHint dpy w
|
||||||
dws <- asks dynWorkspaces
|
dws <- asks wDynWorkspaces
|
||||||
let tag =
|
let tag =
|
||||||
M.lookup (resClass hint) $
|
M.lookup (resClass hint) $
|
||||||
M.fromList $
|
M.fromList $
|
||||||
|
@ -133,9 +134,9 @@ handleEvent MapNotifyEvent {ev_window = w} = do
|
||||||
_ -> return ()
|
_ -> return ()
|
||||||
handleEvent _ = return ()
|
handleEvent _ = return ()
|
||||||
|
|
||||||
withUniquePid :: Pid -> String -> W ()
|
withUniquePid :: Pid -> String -> WIO ()
|
||||||
withUniquePid pid tag = do
|
withUniquePid pid tag = do
|
||||||
ps <- asks curPIDs
|
ps <- asks wCurPIDs
|
||||||
pids <- readMVar ps
|
pids <- readMVar ps
|
||||||
io
|
io
|
||||||
$ unless (pid `elem` pids)
|
$ unless (pid `elem` pids)
|
||||||
|
|
|
@ -11,7 +11,7 @@ module XMonad.Internal.Concurrent.VirtualBox
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO hiding (try)
|
import RIO hiding (try)
|
||||||
import RIO.Directory
|
import RIO.Directory
|
||||||
import RIO.FilePath
|
import RIO.FilePath
|
||||||
|
|
|
@ -15,7 +15,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import RIO.FilePath
|
import RIO.FilePath
|
||||||
import XMonad.Internal.DBus.Brightness.Common
|
import XMonad.Internal.DBus.Brightness.Common
|
||||||
|
|
|
@ -18,7 +18,7 @@ import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import qualified DBus.Introspection as I
|
import qualified DBus.Introspection as I
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import qualified RIO.Text as T
|
import qualified RIO.Text as T
|
||||||
import XMonad.Core (io)
|
import XMonad.Core (io)
|
||||||
|
|
|
@ -15,7 +15,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import RIO.FilePath
|
import RIO.FilePath
|
||||||
import XMonad.Internal.DBus.Brightness.Common
|
import XMonad.Internal.DBus.Brightness.Common
|
||||||
|
|
|
@ -27,7 +27,7 @@ where
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import qualified RIO.Text as T
|
import qualified RIO.Text as T
|
||||||
import XMonad.Internal.DBus.Brightness.ClevoKeyboard
|
import XMonad.Internal.DBus.Brightness.ClevoKeyboard
|
||||||
|
|
|
@ -11,7 +11,7 @@ module XMonad.Internal.DBus.Removable (runRemovableMon) where
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import qualified RIO.Map as M
|
import qualified RIO.Map as M
|
||||||
import XMonad.Core (io)
|
import XMonad.Core (io)
|
||||||
|
|
|
@ -16,7 +16,7 @@ import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import qualified DBus.Introspection as I
|
import qualified DBus.Introspection as I
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import Graphics.X11.XScreenSaver
|
import Graphics.X11.XScreenSaver
|
||||||
import RIO
|
import RIO
|
||||||
import XMonad.Internal.DBus.Common
|
import XMonad.Internal.DBus.Common
|
||||||
|
|
|
@ -42,7 +42,7 @@ where
|
||||||
import DBus
|
import DBus
|
||||||
import DBus.Client
|
import DBus.Client
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import RIO.FilePath
|
import RIO.FilePath
|
||||||
import RIO.List
|
import RIO.List
|
||||||
|
|
|
@ -14,7 +14,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import qualified RIO.Text as T
|
import qualified RIO.Text as T
|
||||||
import XMonad.Internal.Command.Desktop
|
import XMonad.Internal.Command.Desktop
|
||||||
|
|
|
@ -16,7 +16,7 @@ where
|
||||||
|
|
||||||
import DBus
|
import DBus
|
||||||
import Data.Internal.DBus
|
import Data.Internal.DBus
|
||||||
import Data.Internal.Dependency
|
import Data.Internal.XIO
|
||||||
import RIO
|
import RIO
|
||||||
import qualified RIO.Map as M
|
import qualified RIO.Map as M
|
||||||
import qualified RIO.Set as S
|
import qualified RIO.Set as S
|
||||||
|
|
Loading…
Reference in New Issue