{-# OPTIONS_GHC -fno-warn-missing-signatures #-}

-----------------------------------------------------------------------------
-- |
-- Module       : XMonad.Config.Xfce
-- Description  : Config for integrating xmonad with Xfce.
-- Copyright    : (c) Ivan Miljenovic <Ivan.Miljenovic@gmail.com>
-- License      : BSD
--
-- Maintainer   :  none
-- Stability    :  unstable
-- Portability  :  unportable
--
-- This module provides a config suitable for use with the Xfce desktop
-- environment.

module XMonad.Config.Xfce (
    -- * Usage
    -- $usage
    xfceConfig,
    desktopLayoutModifiers
    ) where

import XMonad
import XMonad.Config.Desktop

import qualified Data.Map as M

-- $usage
-- To use this module, start with the following @xmonad.hs@:
--
-- > import XMonad
-- > import XMonad.Config.Xfce
-- >
-- > main = xmonad xfceConfig
--
-- For examples of how to further customize @xfceConfig@ see "XMonad.Config.Desktop".

xfceConfig :: XConfig
  (ModifiedLayout
     AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)))
xfceConfig = XConfig
  (ModifiedLayout
     AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)))
desktopConfig
    { terminal :: String
terminal = String
"xfce4-terminal"
    , keys :: XConfig Layout -> Map (ButtonMask, KeySym) (X ())
keys     = forall {m :: * -> *} {l :: * -> *}.
MonadIO m =>
XConfig l -> Map (ButtonMask, KeySym) (m ())
xfceKeys forall a. Semigroup a => a -> a -> a
<> forall (l :: * -> *).
XConfig l -> XConfig Layout -> Map (ButtonMask, KeySym) (X ())
keys XConfig
  (ModifiedLayout
     AvoidStruts (Choose Tall (Choose (Mirror Tall) Full)))
desktopConfig }

xfceKeys :: XConfig l -> Map (ButtonMask, KeySym) (m ())
xfceKeys XConfig{modMask :: forall (l :: * -> *). XConfig l -> ButtonMask
modMask = ButtonMask
modm} = forall k a. Ord k => [(k, a)] -> Map k a
M.fromList
    [ ((ButtonMask
modm,               KeySym
xK_p), forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"xfrun4")
    , ((ButtonMask
modm forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, KeySym
xK_p), forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"xfce4-appfinder")
    , ((ButtonMask
modm forall a. Bits a => a -> a -> a
.|. ButtonMask
shiftMask, KeySym
xK_q), forall (m :: * -> *). MonadIO m => String -> m ()
spawn String
"xfce4-session-logout")
    ]