The current handle returned by `spawnPipe` doesn't have any encoding and it uses the function fdToHandle which returns a Binary Handle. When spawnPipe is used with a program like xmobar, this can easily lead to errors: λ> h <- spawnPipe "xmobar" λ> hPutStrLn h "\35753Haskell\25110\32773Ghci\33021\27491\30830\26174\31034\27721\23383\24182\19988\35835\21462\27721\23383\21629\21517\30340\25991\26723" <stdin>: hGetLine: invalid argument (invalid byte sequence) One workaround, to avoid this is to use `hSetEncoding`. But from reading GHC's source code - the entire Handle and write operations seems stateful. So doing something like hPutStr and hSetEncoding can theoretically lead to an undefined state as the first write will use latin encoding and the second write will use the new encoding. More details about it are present here: * http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Handle.Internals.html#writeCharBuffer * http://hackage.haskell.org/package/base-4.12.0.0/docs/src/GHC.IO.Buffer.html#CharBuffer So having these new functions will ensure that we get the handles in the proper encoding in the first place.
xmonad-contrib: Third Party Extensions to the xmonad Window Manager
You need the ghc compiler and xmonad window manager installed in order to use these extensions.
For installation and configuration instructions, please see the xmonad website, the documents included with the xmonad source distribution, and the online haddock documentation.
Getting or Updating XMonadContrib
-
Latest release: https://hackage.haskell.org/package/xmonad-contrib
-
Git version: https://github.com/xmonad/xmonad-contrib
(To use git xmonad-contrib you must also use the git version of xmonad.)
Contributing
Haskell code contributed to this repo should live under the
appropriate subdivision of the XMonad
namespace (currently includes
Actions
, Config
, Hooks
, Layout
, Prompt
, and Util
). For
example, to use the Grid layout, one would import:
XMonad.Layout.Grid
For further details, see the documentation for the
XMonad.Doc.Developing
module, XMonad's CONTRIBUTING.md and the xmonad website.
License
Code submitted to the contrib repo is licensed under the same license as xmonad itself, with copyright held by the authors.