[xmonad] Code Freeze for v0.12 and Time to Test!

Tuncer Ayaz tuncer.ayaz at gmail.com
Mon Dec 28 21:29:32 UTC 2015


Here's an updated post with a short text that you might want
to include in the announcement:

xmonad (and xmonad-contrib) have evolved a lot since its first
release, and therefore it's a good idea to showcase a modern
xmonad.hs. The config below will give you a good starter xmonad setup
with minor customizations. These are:

(1) Ask for confirmation before exiting

(2) Replace default launcher binding with built-in shellPrompt, which
    is friendlier to use and does not require dmenu.

Arguably, these customizations should be the default, but as it
requires xmonad-contrib, we can not really make it the default.

Some of the things you might want to do next:

* customize looks
* control volume and display backlight
* customize layouts
* customize mouse behavior
* whatever you need and can imagine

Save this as ~/.xmonad/xmonad.hs:

import           System.Exit
import           XMonad
import           XMonad.Hooks.DynamicLog
import           XMonad.Hooks.ManageDocks
import           XMonad.Hooks.ManageHelpers
import           XMonad.Layout.Fullscreen
import           XMonad.Layout.LayoutHints
import           XMonad.Layout.NoBorders
import           XMonad.Prompt
import           XMonad.Prompt.ConfirmPrompt
import           XMonad.Prompt.Shell
import           XMonad.Util.EZConfig
import           XMonad.Util.Run(hPutStrLn, spawnPipe)

main = do
    xmproc <- spawnPipe "xmobar ~/.xmonad/xmobarrc"
    xmonad $ defaultConfig
       {
          terminal = "xterm"
        , manageHook = myManageHook <+> fullscreenManageHook <+> manageDocks
                       <+> manageHook defaultConfig
        , layoutHook = fullscreenFloat $ fullscreenFocus $ layoutHints
                       $ smartBorders $ avoidStruts $ layoutHook defaultConfig
        , handleEventHook = fullscreenEventHook
        , logHook = dynamicLogWithPP $ xmobarPP { ppOutput = hPutStrLn xmproc }
       }
       `additionalKeysP`
         [
            -- Ask for confirmation before exiting by replacing the default
            -- binding with a custom one.
            ("M-S-q", confirmPrompt myXPConfig "exit" $ io exitSuccess)
            -- Replace M-p launcher binding with built-in shellPrompt, which
            -- is friendlier and does not require dmenu.
          , ("M-p", shellPrompt myXPConfig)
         ]
       `additionalKeys`
        [ ((mod4Mask, xK_q), spawn "xmonad --recompile && xmonad --restart") ]

-- see http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Prompt.html#t:XPConfig
myXPConfig = defaultXPConfig
    {
      position = Top
    , promptBorderWidth = 0
    , defaultText = ""
    , alwaysHighlight = True
    , font = "9x15"
    }

-- see http://xmonad.org/xmonad-docs/xmonad/XMonad-ManageHook.html
myManageHook = composeAll
    [
      className =? "Pidgin"             --> doFloat
    , className =? "MuPDF"              --> doFloat
    , className =? "llpp"               --> doFloat
    , className =? "XCalc"              --> doFloat
    , className =? "mpv"                --> doFloat
    , className =? "Gimp"               --> doFloat
    ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-xmonad.hs
Type: application/octet-stream
Size: 2237 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20151228/d70cb25a/attachment-0001.obj>


More information about the xmonad mailing list