{-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-orphans #-}
{-# LANGUAGE TypeFamilies #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Config
-- Copyright   :  (c) Spencer Janssen 2007
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  dons@galois.com
-- Stability   :  stable
-- Portability :  portable
--
-- This module specifies the default configuration values for xmonad.
--
-- DO NOT MODIFY THIS FILE!  It won't work.  You may configure xmonad
-- by providing your own @~\/.xmonad\/xmonad.hs@ that overrides
-- specific fields in the default config, 'def'.  For a starting point, you can
-- copy the @xmonad.hs@ found in the @man@ directory, or look at
-- examples on the xmonad wiki.
--
------------------------------------------------------------------------

module XMonad.Config (defaultConfig, Default(..)) where

--
-- Useful imports
--
import XMonad.Core as XMonad hiding
    (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings
    ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse
    ,handleEventHook,clickJustFocuses,rootMask,clientMask)
import qualified XMonad.Core as XMonad
    (workspaces,manageHook,keys,logHook,startupHook,borderWidth,mouseBindings
    ,layoutHook,modMask,terminal,normalBorderColor,focusedBorderColor,focusFollowsMouse
    ,handleEventHook,clickJustFocuses,rootMask,clientMask)

import XMonad.Layout
import XMonad.Operations
import XMonad.ManageHook
import qualified XMonad.StackSet as W
import Data.Bits ((.|.))
import Data.Default.Class
import Data.Monoid
import qualified Data.Map as M
import System.Exit
import Graphics.X11.Xlib
import Graphics.X11.Xlib.Extras

-- | The default number of workspaces (virtual screens) and their names.
-- By default we use numeric strings, but any string may be used as a
-- workspace name. The number of workspaces is determined by the length
-- of this list.
--
-- A tagging example:
--
-- > workspaces = ["web", "irc", "code" ] ++ map show [4..9]
--
workspaces :: [WorkspaceId]
workspaces :: [WorkspaceId]
workspaces = (Int -> WorkspaceId) -> [Int] -> [WorkspaceId]
forall a b. (a -> b) -> [a] -> [b]
map Int -> WorkspaceId
forall a. Show a => a -> WorkspaceId
show [Int
1 .. Int
9 :: Int]

-- | modMask lets you specify which modkey you want to use. The default
-- is mod1Mask ("left alt").  You may also consider using mod3Mask
-- ("right alt"), which does not conflict with emacs keybindings. The
-- "windows key" is usually mod4Mask.
--
defaultModMask :: KeyMask
defaultModMask :: KeyMask
defaultModMask = KeyMask
mod1Mask

-- | Width of the window border in pixels.
--
borderWidth :: Dimension
borderWidth :: Dimension
borderWidth = Dimension
1

-- | Border colors for unfocused and focused windows, respectively.
--
normalBorderColor, focusedBorderColor :: String
normalBorderColor :: WorkspaceId
normalBorderColor  = WorkspaceId
"gray" -- "#dddddd"
focusedBorderColor :: WorkspaceId
focusedBorderColor = WorkspaceId
"red"  -- "#ff0000" don't use hex, not <24 bit safe

------------------------------------------------------------------------
-- Window rules

-- | Execute arbitrary actions and WindowSet manipulations when managing
-- a new window. You can use this to, for example, always float a
-- particular program, or have a client always appear on a particular
-- workspace.
--
-- To find the property name associated with a program, use
--  xprop | grep WM_CLASS
-- and click on the client you're interested in.
--
manageHook :: ManageHook
manageHook :: ManageHook
manageHook = [ManageHook] -> ManageHook
forall m. Monoid m => [m] -> m
composeAll
                [ Query WorkspaceId
className Query WorkspaceId -> WorkspaceId -> Query Bool
forall a. Eq a => Query a -> a -> Query Bool
=? WorkspaceId
"MPlayer"        Query Bool -> ManageHook -> ManageHook
forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> ManageHook
doFloat
                , Query WorkspaceId
className Query WorkspaceId -> WorkspaceId -> Query Bool
forall a. Eq a => Query a -> a -> Query Bool
=? WorkspaceId
"mplayer2"       Query Bool -> ManageHook -> ManageHook
forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> ManageHook
doFloat ]

------------------------------------------------------------------------
-- Logging

-- | Perform an arbitrary action on each internal state change or X event.
-- Examples include:
--
--      * do nothing
--
--      * log the state to stdout
--
-- See the 'DynamicLog' extension for examples.
--
logHook :: X ()
logHook :: X ()
logHook = () -> X ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

------------------------------------------------------------------------
-- Event handling

-- | Defines a custom handler function for X Events. The function should
-- return (All True) if the default handler is to be run afterwards.
-- To combine event hooks, use mappend or mconcat from Data.Monoid.
handleEventHook :: Event -> X All
handleEventHook :: Event -> X All
handleEventHook Event
_ = All -> X All
forall (m :: * -> *) a. Monad m => a -> m a
return (Bool -> All
All Bool
True)

-- | Perform an arbitrary action at xmonad startup.
startupHook :: X ()
startupHook :: X ()
startupHook = () -> X ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()

------------------------------------------------------------------------
-- Extensible layouts
--
-- You can specify and transform your layouts by modifying these values.
-- If you change layout bindings be sure to use 'mod-shift-space' after
-- restarting (with 'mod-q') to reset your layout state to the new
-- defaults, as xmonad preserves your old layout settings by default.
--

-- | The available layouts.  Note that each layout is separated by |||, which
-- denotes layout choice.
layout :: Choose Tall (Choose (Mirror Tall) Full) a
layout = Tall a
tiled Tall a
-> Choose (Mirror Tall) Full a
-> Choose Tall (Choose (Mirror Tall) Full) a
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
||| Tall a -> Mirror Tall a
forall (l :: * -> *) a. l a -> Mirror l a
Mirror Tall a
tiled Mirror Tall a -> Full a -> Choose (Mirror Tall) Full a
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
||| Full a
forall a. Full a
Full
  where
     -- default tiling algorithm partitions the screen into two panes
     tiled :: Tall a
tiled   = Int -> Rational -> Rational -> Tall a
forall a. Int -> Rational -> Rational -> Tall a
Tall Int
nmaster Rational
delta Rational
ratio

     -- The default number of windows in the master pane
     nmaster :: Int
nmaster = Int
1

     -- Default proportion of screen occupied by master pane
     ratio :: Rational
ratio   = Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
2

     -- Percent of screen to increment by when resizing panes
     delta :: Rational
delta   = Rational
3Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
100

------------------------------------------------------------------------
-- Event Masks:

-- | The client events that xmonad is interested in
clientMask :: EventMask
clientMask :: EventMask
clientMask = EventMask
structureNotifyMask EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
enterWindowMask EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
propertyChangeMask

-- | The root events that xmonad is interested in
rootMask :: EventMask
rootMask :: EventMask
rootMask =  EventMask
substructureRedirectMask EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
substructureNotifyMask
        EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
enterWindowMask EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
leaveWindowMask EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
structureNotifyMask
        EventMask -> EventMask -> EventMask
forall a. Bits a => a -> a -> a
.|. EventMask
buttonPressMask

------------------------------------------------------------------------
-- Key bindings:

-- | The preferred terminal program, which is used in a binding below and by
-- certain contrib modules.
terminal :: String
terminal :: WorkspaceId
terminal = WorkspaceId
"xterm"

-- | Whether focus follows the mouse pointer.
focusFollowsMouse :: Bool
focusFollowsMouse :: Bool
focusFollowsMouse = Bool
True

-- | Whether a mouse click select the focus or is just passed to the window
clickJustFocuses :: Bool
clickJustFocuses :: Bool
clickJustFocuses = Bool
True


-- | The xmonad key bindings. Add, modify or remove key bindings here.
--
-- (The comment formatting character is used when generating the manpage)
--
keys :: XConfig Layout -> M.Map (KeyMask, KeySym) (X ())
keys :: XConfig Layout -> Map (KeyMask, EventMask) (X ())
keys conf :: XConfig Layout
conf@(XConfig {modMask :: forall (l :: * -> *). XConfig l -> KeyMask
XMonad.modMask = KeyMask
modMask}) = [((KeyMask, EventMask), X ())] -> Map (KeyMask, EventMask) (X ())
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList ([((KeyMask, EventMask), X ())] -> Map (KeyMask, EventMask) (X ()))
-> [((KeyMask, EventMask), X ())]
-> Map (KeyMask, EventMask) (X ())
forall a b. (a -> b) -> a -> b
$
    -- launching and killing programs
    [ ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_Return), WorkspaceId -> X ()
forall (m :: * -> *). MonadIO m => WorkspaceId -> m ()
spawn (WorkspaceId -> X ()) -> WorkspaceId -> X ()
forall a b. (a -> b) -> a -> b
$ XConfig Layout -> WorkspaceId
forall (l :: * -> *). XConfig l -> WorkspaceId
XMonad.terminal XConfig Layout
conf) -- %! Launch terminal
    , ((KeyMask
modMask,               EventMask
xK_p     ), WorkspaceId -> X ()
forall (m :: * -> *). MonadIO m => WorkspaceId -> m ()
spawn WorkspaceId
"dmenu_run") -- %! Launch dmenu
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_p     ), WorkspaceId -> X ()
forall (m :: * -> *). MonadIO m => WorkspaceId -> m ()
spawn WorkspaceId
"gmrun") -- %! Launch gmrun
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_c     ), X ()
kill) -- %! Close the focused window

    , ((KeyMask
modMask,               EventMask
xK_space ), ChangeLayout -> X ()
forall a. Message a => a -> X ()
sendMessage ChangeLayout
NextLayout) -- %! Rotate through the available layout algorithms
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_space ), Layout EventMask -> X ()
setLayout (Layout EventMask -> X ()) -> Layout EventMask -> X ()
forall a b. (a -> b) -> a -> b
$ XConfig Layout -> Layout EventMask
forall (l :: * -> *). XConfig l -> l EventMask
XMonad.layoutHook XConfig Layout
conf) -- %!  Reset the layouts on the current workspace to default

    , ((KeyMask
modMask,               EventMask
xK_n     ), X ()
refresh) -- %! Resize viewed windows to the correct size

    -- move focus up or down the window stack
    , ((KeyMask
modMask,               EventMask
xK_Tab   ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.focusDown) -- %! Move focus to the next window
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_Tab   ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.focusUp  ) -- %! Move focus to the previous window
    , ((KeyMask
modMask,               EventMask
xK_j     ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.focusDown) -- %! Move focus to the next window
    , ((KeyMask
modMask,               EventMask
xK_k     ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.focusUp  ) -- %! Move focus to the previous window
    , ((KeyMask
modMask,               EventMask
xK_m     ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.focusMaster  ) -- %! Move focus to the master window

    -- modifying the window order
    , ((KeyMask
modMask,               EventMask
xK_Return), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.swapMaster) -- %! Swap the focused window and the master window
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_j     ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.swapDown  ) -- %! Swap the focused window with the next window
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_k     ), (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.swapUp    ) -- %! Swap the focused window with the previous window

    -- resizing the master/slave ratio
    , ((KeyMask
modMask,               EventMask
xK_h     ), Resize -> X ()
forall a. Message a => a -> X ()
sendMessage Resize
Shrink) -- %! Shrink the master area
    , ((KeyMask
modMask,               EventMask
xK_l     ), Resize -> X ()
forall a. Message a => a -> X ()
sendMessage Resize
Expand) -- %! Expand the master area

    -- floating layer support
    , ((KeyMask
modMask,               EventMask
xK_t     ), (EventMask -> X ()) -> X ()
withFocused ((EventMask -> X ()) -> X ()) -> (EventMask -> X ()) -> X ()
forall a b. (a -> b) -> a -> b
$ (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (EventMask -> WindowSet -> WindowSet) -> EventMask -> X ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventMask -> WindowSet -> WindowSet
forall a i l s sd.
Ord a =>
a -> StackSet i l a s sd -> StackSet i l a s sd
W.sink) -- %! Push window back into tiling

    -- increase or decrease number of windows in the master area
    , ((KeyMask
modMask              , EventMask
xK_comma ), IncMasterN -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> IncMasterN
IncMasterN Int
1)) -- %! Increment the number of windows in the master area
    , ((KeyMask
modMask              , EventMask
xK_period), IncMasterN -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> IncMasterN
IncMasterN (-Int
1))) -- %! Deincrement the number of windows in the master area

    -- quit, or restart
    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_q     ), IO () -> X ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
io (ExitCode -> IO ()
forall a. ExitCode -> IO a
exitWith ExitCode
ExitSuccess)) -- %! Quit xmonad
    , ((KeyMask
modMask              , EventMask
xK_q     ), WorkspaceId -> X ()
forall (m :: * -> *). MonadIO m => WorkspaceId -> m ()
spawn WorkspaceId
"if type xmonad; then xmonad --recompile && xmonad --restart; else xmessage xmonad not in \\$PATH: \"$PATH\"; fi") -- %! Restart xmonad

    , ((KeyMask
modMask KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
shiftMask, EventMask
xK_slash ), X ()
helpCommand) -- %! Run xmessage with a summary of the default keybindings (useful for beginners)
    -- repeat the binding for non-American layout keyboards
    , ((KeyMask
modMask              , EventMask
xK_question), X ()
helpCommand) -- %! Run xmessage with a summary of the default keybindings (useful for beginners)
    ]
    [((KeyMask, EventMask), X ())]
-> [((KeyMask, EventMask), X ())] -> [((KeyMask, EventMask), X ())]
forall a. [a] -> [a] -> [a]
++
    -- mod-[1..9] %! Switch to workspace N
    -- mod-shift-[1..9] %! Move client to workspace N
    [((KeyMask
m KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
modMask, EventMask
k), (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (WindowSet -> WindowSet) -> X ()
forall a b. (a -> b) -> a -> b
$ WorkspaceId -> WindowSet -> WindowSet
f WorkspaceId
i)
        | (WorkspaceId
i, EventMask
k) <- [WorkspaceId] -> [EventMask] -> [(WorkspaceId, EventMask)]
forall a b. [a] -> [b] -> [(a, b)]
zip (XConfig Layout -> [WorkspaceId]
forall (l :: * -> *). XConfig l -> [WorkspaceId]
XMonad.workspaces XConfig Layout
conf) [EventMask
xK_1 .. EventMask
xK_9]
        , (WorkspaceId -> WindowSet -> WindowSet
f, KeyMask
m) <- [(WorkspaceId -> WindowSet -> WindowSet
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.greedyView, KeyMask
0), (WorkspaceId -> WindowSet -> WindowSet
forall a s i l sd.
(Ord a, Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.shift, KeyMask
shiftMask)]]
    [((KeyMask, EventMask), X ())]
-> [((KeyMask, EventMask), X ())] -> [((KeyMask, EventMask), X ())]
forall a. [a] -> [a] -> [a]
++
    -- mod-{w,e,r} %! Switch to physical/Xinerama screens 1, 2, or 3
    -- mod-shift-{w,e,r} %! Move client to screen 1, 2, or 3
    [((KeyMask
m KeyMask -> KeyMask -> KeyMask
forall a. Bits a => a -> a -> a
.|. KeyMask
modMask, EventMask
key), ScreenId -> X (Maybe WorkspaceId)
screenWorkspace ScreenId
sc X (Maybe WorkspaceId) -> (Maybe WorkspaceId -> X ()) -> X ()
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (Maybe WorkspaceId -> (WorkspaceId -> X ()) -> X ())
-> (WorkspaceId -> X ()) -> Maybe WorkspaceId -> X ()
forall a b c. (a -> b -> c) -> b -> a -> c
flip Maybe WorkspaceId -> (WorkspaceId -> X ()) -> X ()
forall (m :: * -> *) a. Monad m => Maybe a -> (a -> m ()) -> m ()
whenJust ((WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (WorkspaceId -> WindowSet -> WindowSet) -> WorkspaceId -> X ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. WorkspaceId -> WindowSet -> WindowSet
f))
        | (EventMask
key, ScreenId
sc) <- [EventMask] -> [ScreenId] -> [(EventMask, ScreenId)]
forall a b. [a] -> [b] -> [(a, b)]
zip [EventMask
xK_w, EventMask
xK_e, EventMask
xK_r] [ScreenId
0..]
        , (WorkspaceId -> WindowSet -> WindowSet
f, KeyMask
m) <- [(WorkspaceId -> WindowSet -> WindowSet
forall s i l a sd.
(Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.view, KeyMask
0), (WorkspaceId -> WindowSet -> WindowSet
forall a s i l sd.
(Ord a, Eq s, Eq i) =>
i -> StackSet i l a s sd -> StackSet i l a s sd
W.shift, KeyMask
shiftMask)]]
  where
    helpCommand :: X ()
    helpCommand :: X ()
helpCommand = WorkspaceId -> X ()
forall (m :: * -> *). MonadIO m => WorkspaceId -> m ()
spawn (WorkspaceId
"printf " WorkspaceId -> WorkspaceId -> WorkspaceId
forall a. [a] -> [a] -> [a]
++ WorkspaceId -> WorkspaceId
forall a. Show a => a -> WorkspaceId
show WorkspaceId
help WorkspaceId -> WorkspaceId -> WorkspaceId
forall a. [a] -> [a] -> [a]
++ WorkspaceId
" | xmessage -file -")

-- | Mouse bindings: default actions bound to mouse events
mouseBindings :: XConfig Layout -> M.Map (KeyMask, Button) (Window -> X ())
mouseBindings :: XConfig Layout -> Map (KeyMask, Dimension) (EventMask -> X ())
mouseBindings (XConfig {modMask :: forall (l :: * -> *). XConfig l -> KeyMask
XMonad.modMask = KeyMask
modMask}) = [((KeyMask, Dimension), EventMask -> X ())]
-> Map (KeyMask, Dimension) (EventMask -> X ())
forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
    -- mod-button1 %! Set the window to floating mode and move by dragging
    [ ((KeyMask
modMask, Dimension
button1), \EventMask
w -> EventMask -> X ()
focus EventMask
w X () -> X () -> X ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> EventMask -> X ()
mouseMoveWindow EventMask
w
                                          X () -> X () -> X ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.shiftMaster)
    -- mod-button2 %! Raise the window to the top of the stack
    , ((KeyMask
modMask, Dimension
button2), (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (EventMask -> WindowSet -> WindowSet) -> EventMask -> X ()
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.shiftMaster (WindowSet -> WindowSet)
-> (WindowSet -> WindowSet) -> WindowSet -> WindowSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
.) ((WindowSet -> WindowSet) -> WindowSet -> WindowSet)
-> (EventMask -> WindowSet -> WindowSet)
-> EventMask
-> WindowSet
-> WindowSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventMask -> WindowSet -> WindowSet
forall s a i l sd.
(Eq s, Eq a, Eq i) =>
a -> StackSet i l a s sd -> StackSet i l a s sd
W.focusWindow)
    -- mod-button3 %! Set the window to floating mode and resize by dragging
    , ((KeyMask
modMask, Dimension
button3), \EventMask
w -> EventMask -> X ()
focus EventMask
w X () -> X () -> X ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> EventMask -> X ()
mouseResizeWindow EventMask
w
                                         X () -> X () -> X ()
forall (m :: * -> *) a b. Monad m => m a -> m b -> m b
>> (WindowSet -> WindowSet) -> X ()
windows WindowSet -> WindowSet
forall i l a s sd. StackSet i l a s sd -> StackSet i l a s sd
W.shiftMaster)
    -- you may also bind events to the mouse scroll wheel (button4 and button5)
    ]

instance (a ~ Choose Tall (Choose (Mirror Tall) Full)) => Default (XConfig a) where
  def :: XConfig a
def = XConfig :: forall (l :: * -> *).
WorkspaceId
-> WorkspaceId
-> WorkspaceId
-> l EventMask
-> ManageHook
-> (Event -> X All)
-> [WorkspaceId]
-> KeyMask
-> (XConfig Layout -> Map (KeyMask, EventMask) (X ()))
-> (XConfig Layout -> Map (KeyMask, Dimension) (EventMask -> X ()))
-> Dimension
-> X ()
-> X ()
-> Bool
-> Bool
-> EventMask
-> EventMask
-> ([WorkspaceId] -> XConfig Layout -> IO (XConfig Layout))
-> Map TypeRep ConfExtension
-> XConfig l
XConfig
    { borderWidth :: Dimension
XMonad.borderWidth        = Dimension
borderWidth
    , workspaces :: [WorkspaceId]
XMonad.workspaces         = [WorkspaceId]
workspaces
    , layoutHook :: a EventMask
XMonad.layoutHook         = a EventMask
forall a. Choose Tall (Choose (Mirror Tall) Full) a
layout
    , terminal :: WorkspaceId
XMonad.terminal           = WorkspaceId
terminal
    , normalBorderColor :: WorkspaceId
XMonad.normalBorderColor  = WorkspaceId
normalBorderColor
    , focusedBorderColor :: WorkspaceId
XMonad.focusedBorderColor = WorkspaceId
focusedBorderColor
    , modMask :: KeyMask
XMonad.modMask            = KeyMask
defaultModMask
    , keys :: XConfig Layout -> Map (KeyMask, EventMask) (X ())
XMonad.keys               = XConfig Layout -> Map (KeyMask, EventMask) (X ())
keys
    , logHook :: X ()
XMonad.logHook            = X ()
logHook
    , startupHook :: X ()
XMonad.startupHook        = X ()
startupHook
    , mouseBindings :: XConfig Layout -> Map (KeyMask, Dimension) (EventMask -> X ())
XMonad.mouseBindings      = XConfig Layout -> Map (KeyMask, Dimension) (EventMask -> X ())
mouseBindings
    , manageHook :: ManageHook
XMonad.manageHook         = ManageHook
manageHook
    , handleEventHook :: Event -> X All
XMonad.handleEventHook    = Event -> X All
handleEventHook
    , focusFollowsMouse :: Bool
XMonad.focusFollowsMouse  = Bool
focusFollowsMouse
    , clickJustFocuses :: Bool
XMonad.clickJustFocuses       = Bool
clickJustFocuses
    , clientMask :: EventMask
XMonad.clientMask         = EventMask
clientMask
    , rootMask :: EventMask
XMonad.rootMask           = EventMask
rootMask
    , handleExtraArgs :: [WorkspaceId] -> XConfig Layout -> IO (XConfig Layout)
XMonad.handleExtraArgs = \ [WorkspaceId]
xs XConfig Layout
theConf -> case [WorkspaceId]
xs of
                [] -> XConfig Layout -> IO (XConfig Layout)
forall (m :: * -> *) a. Monad m => a -> m a
return XConfig Layout
theConf
                [WorkspaceId]
_ -> WorkspaceId -> IO (XConfig Layout)
forall (m :: * -> *) a. MonadFail m => WorkspaceId -> m a
fail (WorkspaceId
"unrecognized flags:" WorkspaceId -> WorkspaceId -> WorkspaceId
forall a. [a] -> [a] -> [a]
++ [WorkspaceId] -> WorkspaceId
forall a. Show a => a -> WorkspaceId
show [WorkspaceId]
xs)
    , extensibleConf :: Map TypeRep ConfExtension
XMonad.extensibleConf     = Map TypeRep ConfExtension
forall k a. Map k a
M.empty
    }

-- | The default set of configuration values itself
{-# DEPRECATED defaultConfig "Use def (from Data.Default, and re-exported by XMonad and XMonad.Config) instead." #-}
defaultConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full))
defaultConfig :: XConfig (Choose Tall (Choose (Mirror Tall) Full))
defaultConfig = XConfig (Choose Tall (Choose (Mirror Tall) Full))
forall a. Default a => a
def

-- | Finally, a copy of the default bindings in simple textual tabular format.
help :: String
help :: WorkspaceId
help = [WorkspaceId] -> WorkspaceId
unlines [WorkspaceId
"The default modifier key is 'alt'. Default keybindings:",
    WorkspaceId
"",
    WorkspaceId
"-- launching and killing programs",
    WorkspaceId
"mod-Shift-Enter  Launch xterminal",
    WorkspaceId
"mod-p            Launch dmenu",
    WorkspaceId
"mod-Shift-p      Launch gmrun",
    WorkspaceId
"mod-Shift-c      Close/kill the focused window",
    WorkspaceId
"mod-Space        Rotate through the available layout algorithms",
    WorkspaceId
"mod-Shift-Space  Reset the layouts on the current workSpace to default",
    WorkspaceId
"mod-n            Resize/refresh viewed windows to the correct size",
    WorkspaceId
"mod-Shift-/      Show this help message with the default keybindings",
    WorkspaceId
"",
    WorkspaceId
"-- move focus up or down the window stack",
    WorkspaceId
"mod-Tab        Move focus to the next window",
    WorkspaceId
"mod-Shift-Tab  Move focus to the previous window",
    WorkspaceId
"mod-j          Move focus to the next window",
    WorkspaceId
"mod-k          Move focus to the previous window",
    WorkspaceId
"mod-m          Move focus to the master window",
    WorkspaceId
"",
    WorkspaceId
"-- modifying the window order",
    WorkspaceId
"mod-Return   Swap the focused window and the master window",
    WorkspaceId
"mod-Shift-j  Swap the focused window with the next window",
    WorkspaceId
"mod-Shift-k  Swap the focused window with the previous window",
    WorkspaceId
"",
    WorkspaceId
"-- resizing the master/slave ratio",
    WorkspaceId
"mod-h  Shrink the master area",
    WorkspaceId
"mod-l  Expand the master area",
    WorkspaceId
"",
    WorkspaceId
"-- floating layer support",
    WorkspaceId
"mod-t  Push window back into tiling; unfloat and re-tile it",
    WorkspaceId
"",
    WorkspaceId
"-- increase or decrease number of windows in the master area",
    WorkspaceId
"mod-comma  (mod-,)   Increment the number of windows in the master area",
    WorkspaceId
"mod-period (mod-.)   Deincrement the number of windows in the master area",
    WorkspaceId
"",
    WorkspaceId
"-- quit, or restart",
    WorkspaceId
"mod-Shift-q  Quit xmonad",
    WorkspaceId
"mod-q        Restart xmonad",
    WorkspaceId
"",
    WorkspaceId
"-- Workspaces & screens",
    WorkspaceId
"mod-[1..9]         Switch to workSpace N",
    WorkspaceId
"mod-Shift-[1..9]   Move client to workspace N",
    WorkspaceId
"mod-{w,e,r}        Switch to physical/Xinerama screens 1, 2, or 3",
    WorkspaceId
"mod-Shift-{w,e,r}  Move client to screen 1, 2, or 3",
    WorkspaceId
"",
    WorkspaceId
"-- Mouse bindings: default actions bound to mouse events",
    WorkspaceId
"mod-button1  Set the window to floating mode and move by dragging",
    WorkspaceId
"mod-button2  Raise the window to the top of the stack",
    WorkspaceId
"mod-button3  Set the window to floating mode and resize by dragging"]