import XMonad
<<imports>>
import qualified XMonad.StackSet as W
import qualified Data.Map as M
Set up uxterm
as the default terminal.
myTerminal = "uxterm -fa mono -fg white -bg black"
Use the “super” key as the modifier for window actions.
myModMask = mod4Mask
Use the modifier key and b
to hide/reveal the docks.
import XMonad.Util.CustomKeys (customKeys)
import XMonad.Hooks.ManageDocks (avoidStruts, docks, ToggleStruts(..))
myKeys :: XConfig Layout -> [((KeyMask, KeySym), X ())]
myKeys conf@(XConfig {modMask = modMask}) =
[ ((modMask, xK_b), sendMessage ToggleStruts) ]
There are two layouts:
- Horizontally tiled with a main stack and a reserve stack.
- Fullscreen with one application.
import XMonad.Layout.NoBorders (smartBorders)
import XMonad.Layout.Spiral (spiral)
myLayout = avoidStruts $ smartBorders $ tiled ||| Full
where
-- default tiling algorithm partitions the screen into two panes
tiled = Tall nmaster delta ratio
-- The default number of windows in the master pane
nmaster = 1
-- Default proportion of screen occupied by master pane
ratio = 1/2
-- Percent of screen to increment by when resizing panes
delta = 3/100
Some windows need to start out as a floating window. Outside of the managed stack.
myManageHook = composeAll
[ className =? "MPlayer" --> doFloat
, className =? "mpv" --> doFloat
, title =? "CEPL" --> doFloat
, className =? "Xmessage" --> doFloat
, className =? "qemu-system-x86_64" --> doFloat
, className =? "Wine" --> doFloat
, className =? "Screenkey" --> doIgnore
, resource =? "desktop_window" --> doIgnore
, resource =? "kdesktop" --> doIgnore ]
Perform the default logging action.
import XMonad.Hooks.DynamicLog
import System.IO (hPutStrLn)
myLogHook h = def { ppOutput = hPutStrLn h }
Use XMobar as a dock at the top of the screen
import XMonad.Util.Run (spawnPipe)
dock = spawnPipe "xmobar --dock --top"
Putting it all together.
defaults pipe = def { terminal = myTerminal
, modMask = myModMask
, keys = customKeys (\_ -> []) myKeys
, layoutHook = myLayout
, manageHook = myManageHook
, logHook = dynamicLogWithPP $ myLogHook pipe
}
main = dock >>= (\d -> xmonad $ docks $ defaults d)
Use XMobar as a status bar / dock.
Config { <<font>>
<<colors>>
<<interactive-commands>>
<<format-template>>
}
Use the monospace version of the DejaVu fonts.
font = "xft:DejaVu Sans Mono:style=Bold:size=10"
Use grey text on a black background for everything.
, bgColor = "black"
, fgColor = "grey"
- Use the input reader to display window manager status
- Use the battery meter to display how much time is left until the battery is depleted / charged.
, commands = [ Run StdinReader
, Run Battery [ "--template", "Battery left: <timeleft>m charging: <acstatus>"
, "--"
, "-i", "Idle"
] 50
]
Adjust the window manager status to the left. Adjust battery status and date / time on the right.
, sepChar = "%"
, alignSep = "}{"
, template = "%StdinReader% }{ %battery% | %date%"