{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
-----------------------------------------------------------------------------
-- |
-- Module      :  XMonad.Config.Arossato
-- Description :  Andrea Rossato's xmonad configuration.
-- Copyright   :  (c) Andrea Rossato 2007
-- License     :  BSD3-style (see LICENSE)
--
-- Maintainer  :  andrea.rossato@unibz.it
-- Stability   :  stable
-- Portability :  portable
--
-- This module specifies my xmonad defaults.
--
------------------------------------------------------------------------

module XMonad.Config.Arossato
    ( -- * Usage
      -- $usage
      arossatoConfig
    ) where

import qualified Data.Map as M

import XMonad
import qualified XMonad.StackSet as W

import XMonad.Actions.CycleWS
import XMonad.Hooks.DynamicLog hiding (xmobar)
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ServerMode
import XMonad.Layout.Accordion
import XMonad.Layout.Magnifier
import XMonad.Layout.NoBorders
import XMonad.Layout.SimpleFloat
import XMonad.Layout.Tabbed
import XMonad.Layout.WindowArranger
import XMonad.Prompt.Shell
import XMonad.Prompt.Ssh
import XMonad.Prompt.Theme
import XMonad.Prompt.Window
import XMonad.Prompt.XMonad
import XMonad.Util.Run
import XMonad.Util.Themes

-- $usage
-- The simplest way to use this configuration module is to use an
-- @~\/.xmonad\/xmonad.hs@ like this:
--
-- > module Main (main) where
-- >
-- > import XMonad
-- > import XMonad.Config.Arossato (arossatoConfig)
-- >
-- > main :: IO ()
-- > main = xmonad =<< arossatoConfig
--
-- NOTE: that I'm using xmobar and, if you don't have xmobar in your
-- PATH, this configuration will produce an error and xmonad will not
-- start. If you don't want to install xmobar get rid of this line at
-- the beginning of 'arossatoConfig'.
--
-- You can use this module also as a starting point for writing your
-- own configuration module from scratch. Save it as your
-- @~\/.xmonad\/xmonad.hs@ and:
--
-- 1. Change the module name from
--
-- > module XMonad.Config.Arossato
-- >     ( -- * Usage
-- >       -- $usage
-- >       arossatoConfig
-- >     ) where
--
-- to
--
-- > module Main where
--
-- 2. Add a line like:
--
-- > main = xmonad =<< arossatoConfig
--
-- 3. Start playing with the configuration options...;)

arossatoConfig :: m (XConfig
     (ModifiedLayout
        AvoidStruts
        (Choose
           (ModifiedLayout
              (Decoration SimpleDecoration DefaultShrinker)
              (ModifiedLayout
                 MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
           (Choose
              (ModifiedLayout
                 WithBorder
                 (ModifiedLayout
                    (Decoration TabbedDecoration DefaultShrinker) Simplest))
              (ModifiedLayout
                 WindowArranger
                 (Choose
                    (ModifiedLayout Magnifier Tall)
                    (Choose
                       (ModifiedLayout WithBorder Full)
                       (Choose (Mirror Tall) Accordion))))))))
arossatoConfig = do
    Handle
xmobar <- String -> m Handle
forall (m :: * -> *). MonadIO m => String -> m Handle
spawnPipe String
"xmobar" -- REMOVE this line if you do not have xmobar installed!
    XConfig
  (ModifiedLayout
     AvoidStruts
     (Choose
        (ModifiedLayout
           (Decoration SimpleDecoration DefaultShrinker)
           (ModifiedLayout
              MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
        (Choose
           (ModifiedLayout
              WithBorder
              (ModifiedLayout
                 (Decoration TabbedDecoration DefaultShrinker) Simplest))
           (ModifiedLayout
              WindowArranger
              (Choose
                 (ModifiedLayout Magnifier Tall)
                 (Choose
                    (ModifiedLayout WithBorder Full)
                    (Choose (Mirror Tall) Accordion)))))))
-> m (XConfig
        (ModifiedLayout
           AvoidStruts
           (Choose
              (ModifiedLayout
                 (Decoration SimpleDecoration DefaultShrinker)
                 (ModifiedLayout
                    MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
              (Choose
                 (ModifiedLayout
                    WithBorder
                    (ModifiedLayout
                       (Decoration TabbedDecoration DefaultShrinker) Simplest))
                 (ModifiedLayout
                    WindowArranger
                    (Choose
                       (ModifiedLayout Magnifier Tall)
                       (Choose
                          (ModifiedLayout WithBorder Full)
                          (Choose (Mirror Tall) Accordion))))))))
forall (m :: * -> *) a. Monad m => a -> m a
return (XConfig
   (ModifiedLayout
      AvoidStruts
      (Choose
         (ModifiedLayout
            (Decoration SimpleDecoration DefaultShrinker)
            (ModifiedLayout
               MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
         (Choose
            (ModifiedLayout
               WithBorder
               (ModifiedLayout
                  (Decoration TabbedDecoration DefaultShrinker) Simplest))
            (ModifiedLayout
               WindowArranger
               (Choose
                  (ModifiedLayout Magnifier Tall)
                  (Choose
                     (ModifiedLayout WithBorder Full)
                     (Choose (Mirror Tall) Accordion)))))))
 -> m (XConfig
         (ModifiedLayout
            AvoidStruts
            (Choose
               (ModifiedLayout
                  (Decoration SimpleDecoration DefaultShrinker)
                  (ModifiedLayout
                     MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
               (Choose
                  (ModifiedLayout
                     WithBorder
                     (ModifiedLayout
                        (Decoration TabbedDecoration DefaultShrinker) Simplest))
                  (ModifiedLayout
                     WindowArranger
                     (Choose
                        (ModifiedLayout Magnifier Tall)
                        (Choose
                           (ModifiedLayout WithBorder Full)
                           (Choose (Mirror Tall) Accordion)))))))))
-> XConfig
     (ModifiedLayout
        AvoidStruts
        (Choose
           (ModifiedLayout
              (Decoration SimpleDecoration DefaultShrinker)
              (ModifiedLayout
                 MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
           (Choose
              (ModifiedLayout
                 WithBorder
                 (ModifiedLayout
                    (Decoration TabbedDecoration DefaultShrinker) Simplest))
              (ModifiedLayout
                 WindowArranger
                 (Choose
                    (ModifiedLayout Magnifier Tall)
                    (Choose
                       (ModifiedLayout WithBorder Full)
                       (Choose (Mirror Tall) Accordion)))))))
-> m (XConfig
        (ModifiedLayout
           AvoidStruts
           (Choose
              (ModifiedLayout
                 (Decoration SimpleDecoration DefaultShrinker)
                 (ModifiedLayout
                    MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
              (Choose
                 (ModifiedLayout
                    WithBorder
                    (ModifiedLayout
                       (Decoration TabbedDecoration DefaultShrinker) Simplest))
                 (ModifiedLayout
                    WindowArranger
                    (Choose
                       (ModifiedLayout Magnifier Tall)
                       (Choose
                          (ModifiedLayout WithBorder Full)
                          (Choose (Mirror Tall) Accordion))))))))
forall a b. (a -> b) -> a -> b
$ XConfig (Choose Tall (Choose (Mirror Tall) Full))
forall a. Default a => a
def
         { workspaces :: [String]
workspaces         = [String
"home",String
"var",String
"dev",String
"mail",String
"web",String
"doc"] [String] -> [String] -> [String]
forall a. [a] -> [a] -> [a]
++
                                (Int -> String) -> [Int] -> [String]
forall a b. (a -> b) -> [a] -> [b]
map Int -> String
forall a. Show a => a -> String
show [Int
7 .. Int
9 :: Int]
         , logHook :: X ()
logHook            = Handle -> X ()
myDynLog Handle
xmobar -- REMOVE this line if you do not have xmobar installed!
         , manageHook :: ManageHook
manageHook         = ManageHook
forall a s l sd.
(Ord a, Eq s) =>
Query (Endo (StackSet String l a s sd))
newManageHook
         , layoutHook :: ModifiedLayout
  AvoidStruts
  (Choose
     (ModifiedLayout
        (Decoration SimpleDecoration DefaultShrinker)
        (ModifiedLayout
           MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
     (Choose
        (ModifiedLayout
           WithBorder
           (ModifiedLayout
              (Decoration TabbedDecoration DefaultShrinker) Simplest))
        (ModifiedLayout
           WindowArranger
           (Choose
              (ModifiedLayout Magnifier Tall)
              (Choose
                 (ModifiedLayout WithBorder Full)
                 (Choose (Mirror Tall) Accordion))))))
  Window
layoutHook         = Choose
  (ModifiedLayout
     (Decoration SimpleDecoration DefaultShrinker)
     (ModifiedLayout
        MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
  (Choose
     (ModifiedLayout
        WithBorder
        (ModifiedLayout
           (Decoration TabbedDecoration DefaultShrinker) Simplest))
     (ModifiedLayout
        WindowArranger
        (Choose
           (ModifiedLayout Magnifier Tall)
           (Choose
              (ModifiedLayout WithBorder Full)
              (Choose (Mirror Tall) Accordion)))))
  Window
-> ModifiedLayout
     AvoidStruts
     (Choose
        (ModifiedLayout
           (Decoration SimpleDecoration DefaultShrinker)
           (ModifiedLayout
              MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
        (Choose
           (ModifiedLayout
              WithBorder
              (ModifiedLayout
                 (Decoration TabbedDecoration DefaultShrinker) Simplest))
           (ModifiedLayout
              WindowArranger
              (Choose
                 (ModifiedLayout Magnifier Tall)
                 (Choose
                    (ModifiedLayout WithBorder Full)
                    (Choose (Mirror Tall) Accordion))))))
     Window
forall (l :: * -> *) a.
LayoutClass l a =>
l a -> ModifiedLayout AvoidStruts l a
avoidStruts (Choose
   (ModifiedLayout
      (Decoration SimpleDecoration DefaultShrinker)
      (ModifiedLayout
         MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
   (Choose
      (ModifiedLayout
         WithBorder
         (ModifiedLayout
            (Decoration TabbedDecoration DefaultShrinker) Simplest))
      (ModifiedLayout
         WindowArranger
         (Choose
            (ModifiedLayout Magnifier Tall)
            (Choose
               (ModifiedLayout WithBorder Full)
               (Choose (Mirror Tall) Accordion)))))
   Window
 -> ModifiedLayout
      AvoidStruts
      (Choose
         (ModifiedLayout
            (Decoration SimpleDecoration DefaultShrinker)
            (ModifiedLayout
               MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
         (Choose
            (ModifiedLayout
               WithBorder
               (ModifiedLayout
                  (Decoration TabbedDecoration DefaultShrinker) Simplest))
            (ModifiedLayout
               WindowArranger
               (Choose
                  (ModifiedLayout Magnifier Tall)
                  (Choose
                     (ModifiedLayout WithBorder Full)
                     (Choose (Mirror Tall) Accordion))))))
      Window)
-> Choose
     (ModifiedLayout
        (Decoration SimpleDecoration DefaultShrinker)
        (ModifiedLayout
           MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
     (Choose
        (ModifiedLayout
           WithBorder
           (ModifiedLayout
              (Decoration TabbedDecoration DefaultShrinker) Simplest))
        (ModifiedLayout
           WindowArranger
           (Choose
              (ModifiedLayout Magnifier Tall)
              (Choose
                 (ModifiedLayout WithBorder Full)
                 (Choose (Mirror Tall) Accordion)))))
     Window
-> ModifiedLayout
     AvoidStruts
     (Choose
        (ModifiedLayout
           (Decoration SimpleDecoration DefaultShrinker)
           (ModifiedLayout
              MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
        (Choose
           (ModifiedLayout
              WithBorder
              (ModifiedLayout
                 (Decoration TabbedDecoration DefaultShrinker) Simplest))
           (ModifiedLayout
              WindowArranger
              (Choose
                 (ModifiedLayout Magnifier Tall)
                 (Choose
                    (ModifiedLayout WithBorder Full)
                    (Choose (Mirror Tall) Accordion))))))
     Window
forall a b. (a -> b) -> a -> b
$
                                ModifiedLayout
  (Decoration SimpleDecoration DefaultShrinker)
  (ModifiedLayout
     MouseResize (ModifiedLayout WindowArranger SimpleFloat))
  Window
forall a.
Eq a =>
ModifiedLayout
  (Decoration SimpleDecoration DefaultShrinker)
  (ModifiedLayout
     MouseResize (ModifiedLayout WindowArranger SimpleFloat))
  a
decorated        ModifiedLayout
  (Decoration SimpleDecoration DefaultShrinker)
  (ModifiedLayout
     MouseResize (ModifiedLayout WindowArranger SimpleFloat))
  Window
-> Choose
     (ModifiedLayout
        WithBorder
        (ModifiedLayout
           (Decoration TabbedDecoration DefaultShrinker) Simplest))
     (ModifiedLayout
        WindowArranger
        (Choose
           (ModifiedLayout Magnifier Tall)
           (Choose
              (ModifiedLayout WithBorder Full)
              (Choose (Mirror Tall) Accordion))))
     Window
-> Choose
     (ModifiedLayout
        (Decoration SimpleDecoration DefaultShrinker)
        (ModifiedLayout
           MouseResize (ModifiedLayout WindowArranger SimpleFloat)))
     (Choose
        (ModifiedLayout
           WithBorder
           (ModifiedLayout
              (Decoration TabbedDecoration DefaultShrinker) Simplest))
        (ModifiedLayout
           WindowArranger
           (Choose
              (ModifiedLayout Magnifier Tall)
              (Choose
                 (ModifiedLayout WithBorder Full)
                 (Choose (Mirror Tall) Accordion)))))
     Window
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
|||
                                ModifiedLayout
  (Decoration TabbedDecoration DefaultShrinker) Simplest Window
-> ModifiedLayout
     WithBorder
     (ModifiedLayout
        (Decoration TabbedDecoration DefaultShrinker) Simplest)
     Window
forall (l :: * -> *).
LayoutClass l Window =>
l Window -> ModifiedLayout WithBorder l Window
noBorders ModifiedLayout
  (Decoration TabbedDecoration DefaultShrinker) Simplest Window
forall a.
Eq a =>
ModifiedLayout
  (Decoration TabbedDecoration DefaultShrinker) Simplest a
mytabs ModifiedLayout
  WithBorder
  (ModifiedLayout
     (Decoration TabbedDecoration DefaultShrinker) Simplest)
  Window
-> ModifiedLayout
     WindowArranger
     (Choose
        (ModifiedLayout Magnifier Tall)
        (Choose
           (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
     Window
-> Choose
     (ModifiedLayout
        WithBorder
        (ModifiedLayout
           (Decoration TabbedDecoration DefaultShrinker) Simplest))
     (ModifiedLayout
        WindowArranger
        (Choose
           (ModifiedLayout Magnifier Tall)
           (Choose
              (ModifiedLayout WithBorder Full)
              (Choose (Mirror Tall) Accordion))))
     Window
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
|||
                                ModifiedLayout
  WindowArranger
  (Choose
     (ModifiedLayout Magnifier Tall)
     (Choose
        (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
  Window
otherLays
         , terminal :: String
terminal           = String
"urxvt +sb"
         , normalBorderColor :: String
normalBorderColor  = String
"white"
         , focusedBorderColor :: String
focusedBorderColor = String
"black"
         , keys :: XConfig Layout -> Map (ButtonMask, Window) (X ())
keys               = XConfig Layout -> Map (ButtonMask, Window) (X ())
newKeys
         , handleEventHook :: Event -> X All
handleEventHook    = Event -> X All
serverModeEventHook
         , focusFollowsMouse :: Bool
focusFollowsMouse  = Bool
False
         }
    where
      -- layouts
      mytabs :: ModifiedLayout
  (Decoration TabbedDecoration DefaultShrinker) Simplest a
mytabs    =       DefaultShrinker
-> Theme
-> ModifiedLayout
     (Decoration TabbedDecoration DefaultShrinker) Simplest a
forall a s.
(Eq a, Shrinker s) =>
s
-> Theme
-> ModifiedLayout (Decoration TabbedDecoration s) Simplest a
tabbed DefaultShrinker
shrinkText (ThemeInfo -> Theme
theme ThemeInfo
smallClean)
      decorated :: ModifiedLayout
  (Decoration SimpleDecoration DefaultShrinker)
  (ModifiedLayout
     MouseResize (ModifiedLayout WindowArranger SimpleFloat))
  a
decorated = DefaultShrinker
-> Theme
-> ModifiedLayout
     (Decoration SimpleDecoration DefaultShrinker)
     (ModifiedLayout
        MouseResize (ModifiedLayout WindowArranger SimpleFloat))
     a
forall a s.
(Eq a, Shrinker s) =>
s
-> Theme
-> ModifiedLayout
     (Decoration SimpleDecoration s)
     (ModifiedLayout
        MouseResize (ModifiedLayout WindowArranger SimpleFloat))
     a
simpleFloat' DefaultShrinker
shrinkText (ThemeInfo -> Theme
theme ThemeInfo
smallClean)
      tiled :: Tall a
tiled     = Int -> Rational -> Rational -> Tall a
forall a. Int -> Rational -> Rational -> Tall a
Tall Int
1 (Rational
3Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
100) (Rational
1Rational -> Rational -> Rational
forall a. Fractional a => a -> a -> a
/Rational
2)
      otherLays :: ModifiedLayout
  WindowArranger
  (Choose
     (ModifiedLayout Magnifier Tall)
     (Choose
        (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
  Window
otherLays = Choose
  (ModifiedLayout Magnifier Tall)
  (Choose
     (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion))
  Window
-> ModifiedLayout
     WindowArranger
     (Choose
        (ModifiedLayout Magnifier Tall)
        (Choose
           (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
     Window
forall (l :: * -> *) a. l a -> ModifiedLayout WindowArranger l a
windowArrange   (Choose
   (ModifiedLayout Magnifier Tall)
   (Choose
      (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion))
   Window
 -> ModifiedLayout
      WindowArranger
      (Choose
         (ModifiedLayout Magnifier Tall)
         (Choose
            (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
      Window)
-> Choose
     (ModifiedLayout Magnifier Tall)
     (Choose
        (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion))
     Window
-> ModifiedLayout
     WindowArranger
     (Choose
        (ModifiedLayout Magnifier Tall)
        (Choose
           (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion)))
     Window
forall a b. (a -> b) -> a -> b
$
                  Tall Window -> ModifiedLayout Magnifier Tall Window
forall (l :: * -> *) a. l a -> ModifiedLayout Magnifier l a
magnifier Tall Window
forall a. Tall a
tiled ModifiedLayout Magnifier Tall Window
-> Choose
     (ModifiedLayout WithBorder Full)
     (Choose (Mirror Tall) Accordion)
     Window
-> Choose
     (ModifiedLayout Magnifier Tall)
     (Choose
        (ModifiedLayout WithBorder Full) (Choose (Mirror Tall) Accordion))
     Window
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
|||
                  Full Window -> ModifiedLayout WithBorder Full Window
forall (l :: * -> *).
LayoutClass l Window =>
l Window -> ModifiedLayout WithBorder l Window
noBorders Full Window
forall a. Full a
Full  ModifiedLayout WithBorder Full Window
-> Choose (Mirror Tall) Accordion Window
-> Choose
     (ModifiedLayout WithBorder Full)
     (Choose (Mirror Tall) Accordion)
     Window
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
|||
                  Tall Window -> Mirror Tall Window
forall (l :: * -> *) a. l a -> Mirror l a
Mirror Tall Window
forall a. Tall a
tiled    Mirror Tall Window
-> Accordion Window -> Choose (Mirror Tall) Accordion Window
forall (l :: * -> *) a (r :: * -> *). l a -> r a -> Choose l r a
|||
                  Accordion Window
forall a. Accordion a
Accordion

      -- manageHook
      myManageHook :: Query (Endo (StackSet String l a s sd))
myManageHook  = [Query (Endo (StackSet String l a s sd))]
-> Query (Endo (StackSet String l a s sd))
forall m. Monoid m => [m] -> m
composeAll [ Query String
resource Query String -> String -> Query Bool
forall a. Eq a => Query a -> a -> Query Bool
=? String
"win"          Query Bool
-> Query (Endo (StackSet String l a s sd))
-> Query (Endo (StackSet String l a s sd))
forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> (StackSet String l a s sd -> StackSet String l a s sd)
-> Query (Endo (StackSet String l a s sd))
forall s. (s -> s) -> Query (Endo s)
doF (String -> StackSet String l a s sd -> StackSet String l a s sd
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 String
"doc") -- xpdf
                                 , Query String
resource Query String -> String -> Query Bool
forall a. Eq a => Query a -> a -> Query Bool
=? String
"firefox-bin"  Query Bool
-> Query (Endo (StackSet String l a s sd))
-> Query (Endo (StackSet String l a s sd))
forall (m :: * -> *) a. (Monad m, Monoid a) => m Bool -> m a -> m a
--> (StackSet String l a s sd -> StackSet String l a s sd)
-> Query (Endo (StackSet String l a s sd))
forall s. (s -> s) -> Query (Endo s)
doF (String -> StackSet String l a s sd -> StackSet String l a s sd
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 String
"web")
                                 ]
      newManageHook :: Query (Endo (StackSet String l a s sd))
newManageHook = Query (Endo (StackSet String l a s sd))
forall a s l sd.
(Ord a, Eq s) =>
Query (Endo (StackSet String l a s sd))
myManageHook

      -- xmobar
      myDynLog :: Handle -> X ()
myDynLog    Handle
h = PP -> X ()
dynamicLogWithPP PP
forall a. Default a => a
def
                      { ppCurrent :: String -> String
ppCurrent = String -> String -> String -> String
xmobarColor String
"yellow" String
"" (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. String -> String -> String -> String
wrap String
"[" String
"]"
                      , ppTitle :: String -> String
ppTitle   = String -> String -> String -> String
xmobarColor String
"green"  String
"" (String -> String) -> (String -> String) -> String -> String
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Int -> String -> String
shorten Int
40
                      , ppVisible :: String -> String
ppVisible = String -> String -> String -> String
wrap String
"(" String
")"
                      , ppOutput :: String -> IO ()
ppOutput  = Handle -> String -> IO ()
hPutStrLn Handle
h
                      }

      -- key bindings stuff
      defKeys :: XConfig Layout -> Map (ButtonMask, Window) (X ())
defKeys    = XConfig (Choose Tall (Choose (Mirror Tall) Full))
-> XConfig Layout -> Map (ButtonMask, Window) (X ())
forall (l :: * -> *).
XConfig l -> XConfig Layout -> Map (ButtonMask, Window) (X ())
keys XConfig (Choose Tall (Choose (Mirror Tall) Full))
forall a. Default a => a
def
      delKeys :: XConfig Layout -> Map (ButtonMask, Window) (X ())
delKeys XConfig Layout
x  = ((ButtonMask, Window)
 -> Map (ButtonMask, Window) (X ())
 -> Map (ButtonMask, Window) (X ()))
-> Map (ButtonMask, Window) (X ())
-> [(ButtonMask, Window)]
-> Map (ButtonMask, Window) (X ())
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (ButtonMask, Window)
-> Map (ButtonMask, Window) (X ())
-> Map (ButtonMask, Window) (X ())
forall k a. Ord k => k -> Map k a -> Map k a
M.delete           (XConfig Layout -> Map (ButtonMask, Window) (X ())
defKeys XConfig Layout
x) (XConfig Layout -> [(ButtonMask, Window)]
forall (l :: * -> *). XConfig l -> [(ButtonMask, Window)]
toRemove XConfig Layout
x)
      newKeys :: XConfig Layout -> Map (ButtonMask, Window) (X ())
newKeys XConfig Layout
x  = (((ButtonMask, Window), X ())
 -> Map (ButtonMask, Window) (X ())
 -> Map (ButtonMask, Window) (X ()))
-> Map (ButtonMask, Window) (X ())
-> [((ButtonMask, Window), X ())]
-> Map (ButtonMask, Window) (X ())
forall (t :: * -> *) a b.
Foldable t =>
(a -> b -> b) -> b -> t a -> b
foldr (((ButtonMask, Window)
 -> X ()
 -> Map (ButtonMask, Window) (X ())
 -> Map (ButtonMask, Window) (X ()))
-> ((ButtonMask, Window), X ())
-> Map (ButtonMask, Window) (X ())
-> Map (ButtonMask, Window) (X ())
forall a b c. (a -> b -> c) -> (a, b) -> c
uncurry (ButtonMask, Window)
-> X ()
-> Map (ButtonMask, Window) (X ())
-> Map (ButtonMask, Window) (X ())
forall k a. Ord k => k -> a -> Map k a -> Map k a
M.insert) (XConfig Layout -> Map (ButtonMask, Window) (X ())
delKeys XConfig Layout
x) (XConfig Layout -> [((ButtonMask, Window), X ())]
forall (l :: * -> *). XConfig l -> [((ButtonMask, Window), X ())]
toAdd    XConfig Layout
x)
      -- remove some of the default key bindings
      toRemove :: XConfig l -> [(ButtonMask, Window)]
toRemove XConfig l
x =
          [ (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_j)
          , (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_k)
          , (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_p)
          , (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_p)
          , (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_q)
          , (XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_q)
          ] [(ButtonMask, Window)]
-> [(ButtonMask, Window)] -> [(ButtonMask, Window)]
forall a. [a] -> [a] -> [a]
++
          -- I want modMask .|. shiftMask 1-9 to be free!
          [(ButtonMask
shiftMask ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x, Window
k) | Window
k <- [Window
xK_1 .. Window
xK_9]]
      -- These are my personal key bindings
      toAdd :: XConfig l -> [((ButtonMask, Window), X ())]
toAdd XConfig l
x   =
          [ ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F12   ), XPConfig -> X ()
xmonadPrompt      XPConfig
forall a. Default a => a
def                 )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F3    ), XPConfig -> X ()
shellPrompt       XPConfig
forall a. Default a => a
def                 )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F4    ), XPConfig -> X ()
sshPrompt         XPConfig
forall a. Default a => a
def                 )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F5    ), XPConfig -> X ()
themePrompt       XPConfig
forall a. Default a => a
def                 )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F6    ), XPConfig -> WindowPrompt -> XWindowMap -> X ()
windowPrompt XPConfig
forall a. Default a => a
def WindowPrompt
Goto  XWindowMap
allWindows     )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F7    ), XPConfig -> WindowPrompt -> XWindowMap -> X ()
windowPrompt XPConfig
forall a. Default a => a
def WindowPrompt
Bring XWindowMap
allWindows     )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_comma ), X ()
prevWS                                )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_period), X ()
nextWS                                )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_Right ), (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                   )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_Left  ), (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                     )
          -- other stuff: launch some useful utilities
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_F2    ), String -> X ()
forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"urxvt -fg white -bg black +sb" )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_F4    ), String -> X ()
forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"~/bin/dict.sh"                 )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_F5    ), String -> X ()
forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"~/bin/urlOpen.sh"              )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_t     ), String -> X ()
forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"~/bin/teaTime.sh"              )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x              , Window
xK_c     ), X ()
kill                                  )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_comma ), IncMasterN -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> IncMasterN
IncMasterN   Int
1 )         )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_period), IncMasterN -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> IncMasterN
IncMasterN (-Int
1))         )
          -- commands fo the Magnifier layout
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_plus ), MagnifyMsg -> X ()
forall a. Message a => a -> X ()
sendMessage MagnifyMsg
MagnifyMore)
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_minus), MagnifyMsg -> X ()
forall a. Message a => a -> X ()
sendMessage MagnifyMsg
MagnifyLess)
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_o    ), MagnifyMsg -> X ()
forall a. Message a => a -> X ()
sendMessage MagnifyMsg
ToggleOff  )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_o    ), MagnifyMsg -> X ()
forall a. Message a => a -> X ()
sendMessage MagnifyMsg
ToggleOn   )
          -- windowArranger
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_a    ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage  WindowArrangerMsg
Arrange           )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, Window
xK_a    ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage  WindowArrangerMsg
DeArrange         )
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_Left ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
DecreaseLeft   Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_Up   ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
DecreaseUp     Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_Right), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
IncreaseRight  Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask              , Window
xK_Down ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
IncreaseDown   Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask                , Window
xK_Left ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
MoveLeft       Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask                , Window
xK_Right), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
MoveRight      Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask                , Window
xK_Down ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
MoveDown       Int
10))
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask                , Window
xK_Up   ), WindowArrangerMsg -> X ()
forall a. Message a => a -> X ()
sendMessage (Int -> WindowArrangerMsg
MoveUp         Int
10))
          -- gaps
          , ((XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x                              , Window
xK_b    ), ToggleStruts -> X ()
forall a. Message a => a -> X ()
sendMessage  ToggleStruts
ToggleStruts      )

          ] [((ButtonMask, Window), X ())]
-> [((ButtonMask, Window), X ())] -> [((ButtonMask, Window), X ())]
forall a. [a] -> [a] -> [a]
++
          -- Use modMask .|. shiftMask .|. controlMask 1-9 instead
          [( (ButtonMask
m ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. XConfig l -> ButtonMask
forall (l :: * -> *). XConfig l -> ButtonMask
modMask XConfig l
x, Window
k), (WindowSet -> WindowSet) -> X ()
windows ((WindowSet -> WindowSet) -> X ())
-> (WindowSet -> WindowSet) -> X ()
forall a b. (a -> b) -> a -> b
$ String -> WindowSet -> WindowSet
f String
i)
           | (String
i, Window
k) <- [String] -> [Window] -> [(String, Window)]
forall a b. [a] -> [b] -> [(a, b)]
zip (XConfig l -> [String]
forall (l :: * -> *). XConfig l -> [String]
workspaces XConfig l
x) [Window
xK_1 .. Window
xK_9]
          ,  (String -> WindowSet -> WindowSet
f, ButtonMask
m) <- [(String -> 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, ButtonMask
0), (String -> 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, ButtonMask
shiftMask ButtonMask -> ButtonMask -> ButtonMask
forall a. Bits a => a -> a -> a
.|. ButtonMask
controlMask)]
          ]