{-# START_FILE .gitignore #-}
# files produced by compiler
*.o
*.hi
*.errors

# compiled xmonad executable
xmonad-*

# files used by stack
.stack-work/

# directory created by `build` script
bin/

# files automatically created by xmonad
xmonad.state

{-# START_FILE build #-}
#!/bin/sh
#
# As of 0.13, xmonad --recompile will look for a custom build script.

set -e

stack build :my-xmonad --verbosity error
stack install :my-xmonad --local-bin-path bin/ --verbosity error
mv bin/my-xmonad "$1"

{-# START_FILE lib/.gitignore #-}
# This file is included so that a `lib/` directory will be created.

{-# START_FILE my-xmonad.cabal #-}
name:                my-xmonad
version:             0.1.0.0
build-type:          Simple
cabal-version:       >=1.10

executable my-xmonad
  main-is:             ../xmonad.hs
  -- other-modules lists custom modules in my ~/.xmonad/lib/ directory
  other-modules:
  build-depends:       base
                     , xmonad >= 0.13
                     , xmonad-contrib >= 0.13
  hs-source-dirs:      lib
  default-language:    Haskell2010
  ghc-options:         -Wall -Werror -fno-warn-missing-signatures -threaded

{-# START_FILE xmonad.hs #-}
--------------------------------------------------------------------------------
-- | Example.hs
--
-- Example configuration file for xmonad using the latest recommended
-- features (e.g., 'desktopConfig').
module Main (main) where

--------------------------------------------------------------------------------
import System.Exit
import XMonad
import XMonad.Config.Desktop
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ManageHelpers
import XMonad.Layout.BinarySpacePartition (emptyBSP)
import XMonad.Layout.NoBorders (noBorders)
import XMonad.Layout.ResizableTile (ResizableTall(..))
import XMonad.Layout.ToggleLayouts (ToggleLayout(..), toggleLayouts)
import XMonad.Prompt
import XMonad.Prompt.ConfirmPrompt
import XMonad.Prompt.Shell
import XMonad.Util.EZConfig

--------------------------------------------------------------------------------
main = do
  spawn "xmobar" -- Start a task bar such as xmobar.

  -- Start xmonad using the main desktop configuration with a few
  -- simple overrides:
  xmonad $ desktopConfig
    { modMask    = mod4Mask -- Use the "Win" key for the mod key
    , manageHook = myManageHook <+> manageHook desktopConfig
    , layoutHook = desktopLayoutModifiers $ myLayouts
    , logHook    = dynamicLogString def >>= xmonadPropLog
    }

    `additionalKeysP` -- Add some extra key bindings:
      [ ("M-S-q",   confirmPrompt myXPConfig "exit" (io exitSuccess))
      , ("M-p",     shellPrompt myXPConfig)
      , ("M-<Esc>", sendMessage (Toggle "Full"))
      ]

--------------------------------------------------------------------------------
-- | Customize layouts.
--
-- This layout configuration uses two primary layouts, 'ResizableTall'
-- and 'BinarySpacePartition'.  You can also use the 'M-<Esc>' key
-- binding defined above to toggle between the current layout and a
-- full screen layout.
myLayouts = toggleLayouts (noBorders Full) others
  where
    others = ResizableTall 1 (1.5/100) (3/5) [] ||| emptyBSP

--------------------------------------------------------------------------------
-- | Customize the way 'XMonad.Prompt' looks and behaves.  It's a
-- great replacement for dzen.
myXPConfig = def
  { position          = Top
  , alwaysHighlight   = True
  , promptBorderWidth = 0
  , font              = "xft:monospace:size=9"
  }

--------------------------------------------------------------------------------
-- | Manipulate windows as they are created.  The list given to
-- @composeOne@ is processed from top to bottom.  The first matching
-- rule wins.
--
-- Use the `xprop' tool to get the info you need for these matches.
-- For className, use the second value that xprop gives you.
myManageHook = composeOne
  [ className =? "Pidgin" -?> doFloat
  , className =? "XCalc"  -?> doFloat
  , className =? "mpv"    -?> doFloat
  , isDialog              -?> doCenterFloat

    -- Move transient windows to their parent:
  , transience
  ]