mirror of
https://github.com/xmonad/xmonad.git
synced 2025-08-02 05:01:53 -07:00
hide existential Layout (mostly) from user API.
This commit is contained in:
@@ -173,7 +173,7 @@ terminal = "xterm"
|
||||
--
|
||||
-- (The comment formatting character is used when generating the manpage)
|
||||
--
|
||||
keys :: XConfig -> M.Map (KeyMask, KeySym) (X ())
|
||||
keys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
|
||||
keys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||
-- launching and killing programs
|
||||
[ ((modMask .|. shiftMask, xK_Return), spawn $ XMonad.terminal conf) -- %! Launch terminal
|
||||
@@ -234,7 +234,7 @@ keys conf@(XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||
|
||||
-- | Mouse bindings: default actions bound to mouse events
|
||||
--
|
||||
mouseBindings :: XConfig -> M.Map (KeyMask, Button) (Window -> X ())
|
||||
mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
|
||||
mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||
-- mod-button1 %! Set the window to floating mode and move by dragging
|
||||
[ ((modMask, button1), (\w -> focus w >> mouseMoveWindow w))
|
||||
@@ -250,12 +250,11 @@ mouseBindings (XConfig {XMonad.modMask = modMask}) = M.fromList $
|
||||
-- % Extension-provided definitions
|
||||
|
||||
-- | And, finally, the default set of configuration values itself
|
||||
defaultConfig :: XConfig
|
||||
defaultConfig = XConfig
|
||||
{ XMonad.borderWidth = borderWidth
|
||||
, XMonad.workspaces = workspaces
|
||||
, XMonad.defaultGaps = defaultGaps
|
||||
, XMonad.layoutHook = Layout layout
|
||||
, XMonad.layoutHook = layout
|
||||
, XMonad.terminal = terminal
|
||||
, XMonad.normalBorderColor = normalBorderColor
|
||||
, XMonad.focusedBorderColor = focusedBorderColor
|
||||
|
@@ -51,7 +51,7 @@ data XState = XState
|
||||
|
||||
data XConf = XConf
|
||||
{ display :: Display -- ^ the X11 display
|
||||
, config :: !XConfig -- ^ initial user configuration
|
||||
, config :: !(XConfig Layout) -- ^ initial user configuration
|
||||
, theRoot :: !Window -- ^ the root window
|
||||
, normalBorder :: !Pixel -- ^ border color of unfocused windows
|
||||
, focusedBorder :: !Pixel -- ^ border color of the focused window
|
||||
@@ -62,18 +62,18 @@ data XConf = XConf
|
||||
}
|
||||
|
||||
-- todo, better name
|
||||
data XConfig = XConfig
|
||||
data XConfig l = XConfig
|
||||
{ normalBorderColor :: !String
|
||||
, focusedBorderColor :: !String
|
||||
, terminal :: !String
|
||||
, layoutHook :: !(Layout Window)
|
||||
, layoutHook :: !(l Window)
|
||||
, manageHook :: Window -> X (WindowSet -> WindowSet)
|
||||
, workspaces :: [String]
|
||||
, defaultGaps :: [(Int,Int,Int,Int)]
|
||||
, numlockMask :: !KeyMask
|
||||
, modMask :: !KeyMask
|
||||
, keys :: XConfig -> M.Map (ButtonMask,KeySym) (X ())
|
||||
, mouseBindings :: XConfig -> M.Map (ButtonMask, Button) (Window -> X ())
|
||||
, keys :: XConfig Layout -> M.Map (ButtonMask,KeySym) (X ())
|
||||
, mouseBindings :: XConfig Layout -> M.Map (ButtonMask, Button) (Window -> X ())
|
||||
, borderWidth :: !Dimension
|
||||
, logHook :: X ()
|
||||
}
|
||||
|
@@ -38,8 +38,10 @@ import System.IO
|
||||
-- |
|
||||
-- The main entry point
|
||||
--
|
||||
xmonad :: XConfig -> IO ()
|
||||
xmonad xmc = do
|
||||
xmonad :: (LayoutClass l Window, Read (l Window)) => XConfig l -> IO ()
|
||||
xmonad initxmc = do
|
||||
-- First, wrap the layout in an existential, to keep things pretty:
|
||||
let xmc = initxmc { layoutHook = Layout $ layoutHook initxmc }
|
||||
dpy <- openDisplay ""
|
||||
let dflt = defaultScreen dpy
|
||||
|
||||
|
Reference in New Issue
Block a user