[xmonad] Code Freeze for v0.12 and Time to Test!
Tuncer Ayaz
tuncer.ayaz at gmail.com
Wed Mar 2 19:06:46 UTC 2016
Adapted to dock changes by adding docksEventHook as suggested by
Bogdan.
Here's v3 with more fixes and better wording:
xmonad and xmonad-contrib have evolved a lot over the years, 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.
Things you might want to configure next:
* customize looks
* control volume and display back-light
* customize layouts
* customize mouse behavior
* add more prompts (ssh, man, password, etc.)
* whatever you can imagine and/or need
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 <+> docksEventHook
, 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 =? "XCalc" --> doFloat
, className =? "mpv" --> doFloat
]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sample-xmonad.hs
Type: application/octet-stream
Size: 2100 bytes
Desc: not available
URL: <http://mail.haskell.org/pipermail/xmonad/attachments/20160302/884c493a/attachment.obj>
More information about the xmonad
mailing list