Here a is session first showing the output on stdout, then on stderr. Also notice that the input file is also printed to stderr.
I wasn't able to quickly find a minimal example which would trigger the bug, so here is my whole XMonad configuration. Notice the missing (
in the first import statement.
Language.Haskell.Stylish.Parse.parseModule: could not parse <unknown>: ParseFailed (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 12, srcColumn = 1}) "TemplateHaskell is not enabled"
Language.Haskell.Stylish.Parse.parseModule: could not parse <unknown>: ParseFailed (SrcLoc {srcFilename = "<unknown>.hs", srcLine = 11, srcColumn = 53}) "Parse error: first"
--
-- xmonad(1) configuration
--
-- Relevant documentation:
-- http://xmonad.org/xmonad-docs/
-- http://hackage.haskell.org/package/base
-- http://hackage.haskell.org/package/containers
-- http://hackage.haskell.org/package/xmonad-extras
--
import Control.Arrow first, (***))
import Control.Monad ((<=<))
import Data.List (isInfixOf)
import qualified Data.Map as M
import Data.Maybe (fromMaybe)
import Data.Monoid (mconcat)
import System.IO (Handle, hPutStrLn)
import XMonad
import XMonad.Actions.CycleWS
import XMonad.Actions.FloatKeys
import XMonad.Actions.FloatSnap
import XMonad.Actions.RotSlaves
import XMonad.Actions.SpawnOn
import XMonad.Actions.Warp (Corner (..), banish)
import XMonad.Actions.WindowBringer
import XMonad.Hooks.CurrentWorkspaceOnTop
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.EwmhDesktops
import XMonad.Hooks.ManageDocks
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.Place
import XMonad.Hooks.SetWMName
import XMonad.Hooks.UrgencyHook
import XMonad.Layout.Decoration (Theme (..), defaultTheme)
import XMonad.Layout.LayoutHints
import XMonad.Layout.NoBorders
import XMonad.Layout.PerWorkspace
import XMonad.Layout.ResizableTile
import XMonad.Layout.TrackFloating
import qualified XMonad.StackSet as W
import XMonad.Util.Dmenu (menuArgs)
import XMonad.Util.EZConfig (checkKeymap, mkKeymap)
import XMonad.Util.Replace
import XMonad.Util.Run (spawnPipe)
main :: IO ()
main = do
replace
-- handle <- safeSpawnPipe "dzen2"
-- [ "-dock"
-- , "-fn", fontName myTheme
-- , "-fg", inactiveTextColor myTheme
-- , "-bg", inactiveColor myTheme
-- , "-xs", "1"
-- ]
dir <- getXMonadDir
handle <- safeSpawnPipe "xmobar"
[ "-f", fontName myTheme
, "-F", inactiveTextColor myTheme
, "-B", inactiveColor myTheme
, "--", dir ++ "/xmobarrc"
]
let myConfig = defaultConfig
{ terminal = "urxvtc"
, focusFollowsMouse = True
, borderWidth = 1
, modMask = mod4Mask
, workspaces = myWorkspaces
, normalBorderColor = inactiveBorderColor myTheme
, focusedBorderColor = activeBorderColor myTheme
, keys = \c -> mkKeymap c (myKeys c)
, mouseBindings = M.fromList . myMouse
-- , layoutHook = fullscreenFull $ myLayout
, layoutHook =
trackFloating
. layoutHintsWithPlacement (0.5, 0.5)
. avoidStruts
. lessBorders OnlyFloat
$ myLayout
, handleEventHook = mconcat
[ docksEventHook
, ewmhDesktopsEventHook
, fullscreenEventHook
, hintsEventHook
]
, manageHook = myManageHook
, logHook =
currentWorkspaceOnTop
>> (dynamicLogWithPP $ myPP xmobarColor handle)
>> ewmhDesktopsLogHook
-- >> updatePointer (Relative 1 1)
, startupHook =
return ()
>> checkKeymap myConfig (myKeys $ myConfig { layoutHook = Layout $ layoutHook myConfig })
>> ewmhDesktopsStartup
>> setWMName "LG3D"
>> spawn "systemd-notify --ready"
}
xmonad $ withUrgencyHookC BorderUrgencyHook { urgencyBorderColor = urgentBorderColor myTheme }
urgencyConfig { suppressWhen = Focused }
myConfig
myKeys :: XConfig Layout -> [(String, X ())]
myKeys conf =
-- focus, move, resize
[ ("M-h" , rotAllUp)
, ("M-j" , windows W.focusDown >> whenX isFloating (windows W.shiftMaster))
, ("M-k" , windows W.focusUp >> whenX isFloating (windows W.shiftMaster))
, ("M-l" , rotAllDown)
, ("M-m" , windows W.focusMaster)
, ("M-g" , nextScreen)
, ("M-S-h" , move L)
, ("M-S-j" , move D)
, ("M-S-k" , move U)
, ("M-S-l" , move R)
, ("M-S-m" , ifX isFloating (windows W.shiftMaster) (windows W.swapMaster))
, ("M-S-g" , shiftNextScreen)
, ("M-C-h" , resize L)
, ("M-C-j" , resize D)
, ("M-C-k" , resize U)
, ("M-C-l" , resize R)
, ("M-C-g" , swapNextScreen)
]
++
(map (("M-" ++) *** toggleOrView ) . zip keys . workspaces) conf
++
(map (("M-z " ++) *** (windows . W.shift)) . zip keys . workspaces) conf
++
-- other actions
[ ("M-q" , kill)
, ("M-<F5>" , refresh)
, ("M-," , sendMessage $ IncMasterN 1)
, ("M-." , sendMessage $ IncMasterN (-1))
, ("M-<Space>" , sendMessage NextLayout)
, ("M-S-<Space>" , setLayout $ layoutHook conf)
, ("M-t" , withFocused $ \w -> ifX isFloating (windows . W.sink $ w) (float w))
, ("M-;" , spawnHere =<< menuArgs "env" ("SHELL=cat" : "dmenu_run" : dmenuArgs) [])
, ("M-<F3>" , gotoMenuArgs $ dmenuArgs ++ ["-i", "-l", "64"])
-- reclaim focus from flashplugin
, ("M-<Escape>" , banish LowerRight >> spawn "xdotool mousemove_relative --sync -- -1 -1 getactivewindow click --clearmodifiers --window %1 2")
-- copy, paste
-- This only works on applications which accept events
-- generated by XSendEvent(3). Generally with Shift+Insert
-- GUI toolkits paste from the clipboard, but terminal
-- emulators paste from the pirmary selection. In order
-- to consistently paste from the clipboard we copy its
-- contents to primary selection before pasting. Also
-- remember to setup approriate bindigs for Shift+Insert in
-- Emacs and gVim.
, ("M-y" , spawn "xsel -op | xsel -ib")
, ("M-p" , spawn "xsel -ob | xsel -ip; xdotool getactivewindow key --clearmodifiers --window %1 Shift+Insert")
-- audio, video
, ("M-<Up>" , spawn "my-mpc stop")
, ("M-<Down>" , spawn "my-mpc toggle")
, ("M-<Left>" , spawn "my-mpc prev")
, ("M-<Right>" , spawn "my-mpc next")
, ("M-S-<Up>" , spawn "my-mpc seek -30")
, ("M-S-<Down>" , spawn "my-mpc seek +30")
, ("M-S-<Left>" , spawn "my-mpc seek -5")
, ("M-S-<Right>" , spawn "my-mpc seek +5")
, ("<XF86AudioNext>", spawn "my-mpc next")
, ("<XF86AudioPlay>", spawn "my-mpc toggle")
, ("<XF86AudioPrev>", spawn "my-mpc prev")
, ("<XF86AudioStop>", spawn "my-mpc stop")
, ("<XF86PowerOff>" , spawn "systemctl --user start xdg-screensaver.service")
]
-- spawn clients
++ map (first ("M-a " ++))
[ ("w" , spawn "systemctl --user start [email protected]")
, ("S-w", spawn "systemctl --user start chromium.service")
-- , ("C-w", spawn $ "rsync -aE --delete --exclude-from ~/.mozilla/firefox/{exclude.txt,default/,testing} && exec systemctl --user start [email protected]")
, ("e" , spawn "systemctl --user start ncmpcpp.service")
, ("S-e", spawn $ ". \"$XDG_CONFIG_HOME/user-dirs.dirs\"; exec " ++ terminal conf ++ " -cd \"$XDG_MUSIC_DIR\" -name mus")
, ("r" , spawn $ ". \"$XDG_CONFIG_HOME/user-dirs.dirs\"; exec " ++ terminal conf ++ " -cd \"$XDG_VIDEOS_DIR\" -name vid")
, ("s" , spawn "emacsclient -a /bin/false -c -e '(notmuch)' -F '((menu-bar-lines . 0) (icon-name . \"mail\"))' -n -s \"$XDG_RUNTIME_DIR/emacs\"")
, ("S-s", spawn "systemctl --user start [email protected]")
, ("d" , spawn "systemctl --user start weechat-curses.service")
, ("f" , withWindowSet $ spawn . (++) "systemctl --user start urxvtc@" . W.tag . W.workspace . W.current)
, ("S-f", withWindowSet $ spawn . (++) "systemctl --user start emacsclient@" . W.tag . W.workspace . W.current)
, ("x" , spawn "systemctl --user start transmission-remote-cli.service")
]
where keys = words "w e r s d f x c v"
--myLayout :: You don't want to know.
myLayout =
onWorkspace "www" (Full ||| tiled ||| Mirror tiled) $
onWorkspaces (words "dl im vid") (Mirror tiled ||| Full ||| tiled) $
tiled ||| Full ||| Mirror tiled
where
tiled = ResizableTall nmaster delta ratio []
nmaster = 1
ratio = 1/2
delta = 3/100
myManageHook :: ManageHook
myManageHook = mconcat
-- fullscreen
[ composeOne . map (-?> doFullFloat) $
[ isFullscreen
, stringProperty "WM_WINDOW_ROLE" =? "presentationWidget"
]
-- float
, placeHook $ withGaps (19, 0, 0, 0) $ smart (0.5, 0.5)
, composeOne . map (-?> doFloat) $
[ isDialog
, appName =? "explorer.exe" <&&> className =? "Wine"
, appName =? "sdlmame" <&&> className =? "sdlmame"
, className =? "Basicwin" -- CGoban
, className =? "Kioexec"
, className =? "MPlayer"
, title =? "ePSXe - Enhanced PSX emulator"
]
-- swap
-- TODO: shift urxvtc -e man ... to master
-- , insertPosition Below Newer
-- shift
, manageSpawn
, composeOne . (:) transience . map (\(w, q) -> q -?> doShift w) $
[ ("dl" , appName =? "Download" <&&> className =? "Firefox")
, ("www", appName =? "chromium" <&&> className =? "Chromium" <&&> stringProperty "WM_WINDOW_ROLE" =? "browser")
, ("www", appName =? "Addons" <&&> className =? "Firefox" <&&> stringProperty "WM_WINDOW_ROLE" =? "Compatibility")
, ("www", appName =? "Navigator" <&&> className =? "Firefox")
]
++ map (\w -> (w, stringProperty "WM_ICON_NAME" =? w <&&> className =? "Emacs")) myWorkspaces
++ map (\w -> (w, appName =? w <&&> className =? "URxvt")) myWorkspaces
++ map (\w -> (w, appName =? "xterm" <&&> className =? w )) myWorkspaces
-- ignore
, composeOne . map (-?> doIgnore) $
[ checkDock
, isKDETrayWindow
, className =? "Docker"
, className =? "stalonetray"
, className =? "Xfce4-notifyd"
]
]
myMouse :: XConfig l -> [((KeyMask, Button), Window -> X ())]
myMouse (XConfig {modMask = m}) =
[ ((m, button1), \w -> focus w >> mouseMoveWindow w
>> snapMagicMove margin margin w
>> windows W.shiftMaster)
, ((m, button2), \w -> focus w >> windows W.shiftMaster)
, ((m, button3), \w -> focus w >> mouseResizeWindow w
>> snapMagicResize [D, R] margin margin w
>> windows W.shiftMaster)
]
where margin = Just . fromIntegral . decoHeight $ myTheme
myPP :: (String -> String -> String -> String) -> Handle -> PP
myPP coloring handle = defaultPP
{ ppCurrent = coloring (activeTextColor myTheme) (activeColor myTheme)
, ppVisible = coloring (activeTextColor myTheme) (inactiveColor myTheme)
, ppUrgent = coloring (urgentTextColor myTheme) (urgentColor myTheme)
, ppWsSep = " "
, ppSep = " :: "
, ppLayout = const ""
, ppTitle = id
, ppOutput = hPutStrLn handle
}
myTheme :: Theme
myTheme = defaultTheme
{ activeBorderColor = "Red"
, activeColor = "Red"
, activeTextColor = "Black"
, decoHeight = 16
, fontName = "-*-dina-medium-r-*-*-13-*-*-*-*-*-*-*"
, inactiveBorderColor = "Black"
, inactiveColor = "Black"
, inactiveTextColor = "White"
, urgentBorderColor = "Yellow"
, urgentColor = "Yellow"
, urgentTextColor = "Black"
}
myWorkspaces :: [String]
myWorkspaces = let ws = words "www mus vid mail im ctrl dl msc work"
in ws ++ map show [(length ws + 1) .. 9]
-- utitity functions -----------------------------------------------------------
dmenuArgs :: [String]
dmenuArgs = [ "-fn", fontName myTheme
, "-nf", inactiveTextColor myTheme
, "-nb", inactiveColor myTheme
, "-sf", inactiveTextColor myTheme
, "-sb", inactiveColor myTheme
]
ifX :: X Bool -> X a -> X a -> X a
ifX x t f = x >>= \b -> if b then t else f
isFloating :: X Bool
isFloating = withWindowSet $ \w -> return . fromMaybe False .
(return . flip M.member (W.floating w) . W.focus
<=< W.stack . W.workspace . W.current) $ w
move :: Direction2D -> X ()
move d = case d of
U -> m ( 0, -1) W.swapUp
D -> m ( 0, 1) W.swapDown
L -> m (-1, 0) W.swapUp
R -> m ( 1, 0) W.swapDown
where
m d' f = ifX isFloating
(withFocused $ keysMoveWindow (d' `sm` decoHeight myTheme))
(windows f)
resize :: Direction2D -> X ()
resize d = case d of
U -> r ( 0, -1) Shrink MirrorExpand
D -> r ( 0, 1) Expand MirrorShrink
L -> r (-1, 0) MirrorExpand Shrink
R -> r ( 1, 0) MirrorShrink Expand
where
r d' m1 m2 = ifX isFloating
(withFocused $ keysResizeWindow (d' `sm` decoHeight myTheme) (0, 0))
(ifX (withWindowSet $ return . isInfixOf "Mirror"
. description
. W.layout
. W.workspace
. W.current)
(sendMessage m1)
(sendMessage m2))
safeSpawnPipe :: MonadIO m => FilePath -> [String] -> m Handle
safeSpawnPipe x = spawnPipe . unwords . map shellQuote . (:) x
shellQuote :: String -> String
shellQuote s = '\'' : quote s
where
quote [] = "\'"
quote ('\'':cs) = '\'':'\\':'\'':'\'' : quote cs
quote (c:cs) = c : quote cs
-- scalar multiplication
sm :: Num a => (a, a) -> a -> (a, a)
sm (x, y) z = (x * z, y * z)
-- vim: foldclose=all foldlevelstart=0 foldopen=all